From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8FEC0C38142 for ; Tue, 31 Jan 2023 22:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NkAEk5Qrof3ZteSdx4MP954zY0g5skoJp+ndk93g5OM=; b=a7Dw4i54OwPA96 JevQoMfSNOTZ1twAE7tBO4UYxy553kTWqZg9wQSFa59k3Vu0EHlixKfXd5R3+A4FvAXz3hCx1EUhf f9rKwwSBYgTIUs3q9EYLjpv+riB+6Go/y8BDWeTmUmfqBtmYti5qAV+m73naeWOuyITVJ/TPTtQXa 2pNedb+GwwO59ogTDjzf5fMzRIRW0sCC9ynAi1VZp+Y1h50HMfz0o7Krtn16mfQkODcQ0TW3ca9C/ xlCjkgCwZQMPVCr4MzIgTCbCcSTH5UgitLgNgsMc6ZoPZER0veSMn3lO3NVxh/e3WX5A+QCS/dU1R H1dN019/XWTlIjuLIEAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMypN-009Tui-Jc; Tue, 31 Jan 2023 22:10:09 +0000 Received: from out-202.mta0.migadu.com ([91.218.175.202]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMypK-009Tta-B8 for linux-arm-kernel@lists.infradead.org; Tue, 31 Jan 2023 22:10:07 +0000 Date: Tue, 31 Jan 2023 22:09:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1675203002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=S8R6dRX63xPA5DjHb6DqdmOndQN9/0JU0PO7uTkzMT8=; b=qVKIj7kinVwdF8Mibg20xjp5SP+3XncPl/VnhOIgFPsIBFPYg/Wz5LjiPw+76hW9D15kgF Ur4P2Iy1ZGUoCMTWQ0qf78aJW7g0mkBlzvbdXLQysDmtpe/HfOwi/Hxc6N44OzTF/GbT+a AB+Pi6Gh/Wwxb+QGWsfKEmXSbtyxhoM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Alexandru Elisei , Andre Przywara , Chase Conklin , Christoffer Dall , Ganapatrao Kulkarni , Jintack Lim , Russell King , James Morse , Suzuki K Poulose , Zenghui Yu Subject: Re: [PATCH v8 09/69] KVM: arm64: nv: Reset VMPIDR_EL2 and VPIDR_EL2 to sane values Message-ID: References: <20230131092504.2880505-1-maz@kernel.org> <20230131092504.2880505-10-maz@kernel.org> <87zg9ycqdj.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87zg9ycqdj.wl-maz@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230131_141006_562861_650FA2BC X-CRM114-Status: GOOD ( 23.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jan 31, 2023 at 10:04:40PM +0000, Marc Zyngier wrote: > On Tue, 31 Jan 2023 20:17:50 +0000, Oliver Upton wrote: > > > > On Tue, Jan 31, 2023 at 09:24:04AM +0000, Marc Zyngier wrote: > > > From: Christoffer Dall > > > > > > The VMPIDR_EL2 and VPIDR_EL2 are architecturally UNKNOWN at reset, but > > > let's be nice to a guest hypervisor behaving foolishly and reset these > > > to something reasonable anyway. > > > > Must we be so kind? :) > > > > In all seriousness, I've found the hexspeak value of reset_unknown() to > > be a rather useful debugging aid. And I can promise you that I'll use NV > > to debug my own crap changes! > > > > Any particular reason against just using reset_unknown()? > > Because debugging NV itself is hell when all you have is a model! Blech! > As we were trying to debug the early code base, we really wanted to > make it easy to run tiny guests without much setup, and work out of > the box. That's how this sort of changes came about. > > In any case, something like this the hack below works as well (I just > booted an L1 and a couple of L2s with it, and nothing caught fire). LGTM, mind squashing it into the previous patch? -- Thanks, Oliver > M. > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > index 924afc40ab8b..c1016a35a996 100644 > --- a/arch/arm64/kvm/sys_regs.c > +++ b/arch/arm64/kvm/sys_regs.c > @@ -924,16 +924,6 @@ static void reset_mpidr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) > vcpu_write_sys_reg(vcpu, compute_reset_mpidr(vcpu), MPIDR_EL1); > } > > -static void reset_vmpidr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) > -{ > - vcpu_write_sys_reg(vcpu, compute_reset_mpidr(vcpu), VMPIDR_EL2); > -} > - > -static void reset_vpidr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) > -{ > - vcpu_write_sys_reg(vcpu, read_cpuid_id(), VPIDR_EL2); > -} > - > static unsigned int pmu_visibility(const struct kvm_vcpu *vcpu, > const struct sys_reg_desc *r) > { > @@ -2678,8 +2668,8 @@ static const struct sys_reg_desc sys_reg_descs[] = { > { PMU_SYS_REG(SYS_PMCCFILTR_EL0), .access = access_pmu_evtyper, > .reset = reset_val, .reg = PMCCFILTR_EL0, .val = 0 }, > > - EL2_REG(VPIDR_EL2, access_rw, reset_vpidr, 0), > - EL2_REG(VMPIDR_EL2, access_rw, reset_vmpidr, 0), > + EL2_REG(VPIDR_EL2, access_rw, reset_unknown, 0), > + EL2_REG(VMPIDR_EL2, access_rw, reset_unknown, 0), > EL2_REG(SCTLR_EL2, access_rw, reset_val, SCTLR_EL2_RES1), > EL2_REG(ACTLR_EL2, access_rw, reset_val, 0), > EL2_REG(HCR_EL2, access_rw, reset_val, 0), > > -- > Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel