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 C3761CFD2F6 for ; Sat, 29 Nov 2025 11:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YTwXAzA1hhfW0ljeFsbEgjOsHoWHWpD7Aqd7WLjMq24=; b=kB0tKoyxhIrKPaz3AsFIn4DvVV qpVpru357flUUgPF3escOIqSJ5szS/CILqs8zs2ZEkJQuHkcb2VAIpjmowhdQgqMWGyHyyuWbik41 XhUHprq8Zbh4rZ+hATkJPjNfjIjliM46HS9TV0Omg++A5F/axc/dsm55OPaUTavROu/oQDfQi170+ 3lQ7AEoNsWCIyW2SYbRvQrP/Jn5N6GlmBoXUJ91dm6MRuzvXvuM447mgOC2u7TV6QTEX+MINLQfUm mIH1Wt0tTNuo0abyWFdUxT09q7exupe3TD32F8LjvbF3/zHNRe+fcCevAbbLkohBpSqcq3++pVBhI 32ySu+Jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vPJEc-00000001USf-1pN0; Sat, 29 Nov 2025 11:35:26 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vPJEZ-00000001USC-47Oo for linux-arm-kernel@lists.infradead.org; Sat, 29 Nov 2025 11:35:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 70746402B5; Sat, 29 Nov 2025 11:35:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42102C4CEF7; Sat, 29 Nov 2025 11:35:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764416120; bh=JM98PJFfINVzJy2hg19um8addcWX+p6PWfjrRa9Rxq8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QHuOadfQ9Mhe2iysqF3zIDtoJ1up90mrOFzwieqHyZj/++9/G+wSRx2ED1S3uUe5s 7LqVGI/CUxNLSFisDG4+bZForKf9Q5SlvXRql6rfQf1d0/YOeMO8NiDG5inAJ4U1df z+tNewHbzHJhL7rWRffbQVltO34uBhVRl1zkp3CQGcZNEXR6GyR5aLuP06cRyhCJZN d8XTvrmDXv0+R4j1YBXlAgk0qf6PxWyAnnOX1V3kCd2PGzidYFdvfCuWsgeRuS4iv+ WplN7D9v4ra4tTBs0J0KI/x0HxRLRezzVG01a1UjX0Oq5yr10xH7eqQlj4ay2MxSRm HLbiUpeZwKFng== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vPJET-00000009GPJ-37Hi; Sat, 29 Nov 2025 11:35:17 +0000 Date: Sat, 29 Nov 2025 11:35:17 +0000 Message-ID: <86sedxoyve.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: Alexandru Elisei , oliver.upton@linux.dev, joey.gouly@arm.com, yuzenghui@huawei.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Subject: Re: [PATCH 3/4] KVM: arm64: nv: Don't mask VTCR_EL2.HA if FEAT_HAFDBS is present In-Reply-To: References: <20251128100946.74210-1-alexandru.elisei@arm.com> <20251128100946.74210-4-alexandru.elisei@arm.com> <86v7iup3bv.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oupton@kernel.org, alexandru.elisei@arm.com, oliver.upton@linux.dev, joey.gouly@arm.com, yuzenghui@huawei.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251129_033524_086003_B2912B87 X-CRM114-Status: GOOD ( 31.86 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 28 Nov 2025 18:48:10 +0000, Oliver Upton wrote: > > On Fri, Nov 28, 2025 at 03:46:44PM +0000, Marc Zyngier wrote: > > On Fri, 28 Nov 2025 10:09:45 +0000, > > Alexandru Elisei wrote: > > > > > > Commit 39db933ba67f ("KVM: arm64: nv: Implement HW access flag management > > > in stage-2 SW PTW") added support for hardware updates to the access flag > > > to stage 2 if the feature is available to the virtual machine, but forgot > > > to remove the VTCR_EL2.HA bit from the res0 mask for the register. Remove > > > it from the mask to allow the VM to use the feature. > > > > > > Fixes: 39db933ba67f ("KVM: arm64: nv: Implement HW access flag management in stage-2 SW PTW") > > > Signed-off-by: Alexandru Elisei > > > --- > > > arch/arm64/kvm/nested.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c > > > index 911fc99ed99d..7a34163f6c68 100644 > > > --- a/arch/arm64/kvm/nested.c > > > +++ b/arch/arm64/kvm/nested.c > > > @@ -1719,7 +1719,9 @@ int kvm_init_nv_sysregs(struct kvm_vcpu *vcpu) > > > set_sysreg_masks(kvm, VTTBR_EL2, res0, res1); > > > > > > /* VTCR_EL2 */ > > > - res0 = GENMASK(63, 32) | GENMASK(30, 20); > > > + res0 = GENMASK(63, 32) | GENMASK(30, 22) | BIT(20); > > > + if (!kvm_has_feat(kvm, ID_AA64MMFR1_EL1, HAFDBS, AF)) > > > + res0 |= VTCR_EL2_HA; > > > res1 = BIT(31); > > > set_sysreg_masks(kvm, VTCR_EL2, res0, res1); > > > > > > > The fix is correct, but I really do not want to add more of these > > tedious checks, one after the other. We should fix this once and for > > all by converting VTCR_EL2 to the feature dependency infrastructure > > and be done with it. > > > > I've pushed a small series at [1] that does that (very lightly > > tested). > > This looks alright to me, do you want to post it? Still fixing some of the fallout from the sysreg conversion -- a bunch of things that were shifted constants are now unshifted, and need to be FIELD_PREP()'d. I *think* I got them all now, but this is all a bit fiddly. Should the last tests run smoothly, Note that the TCR conversion will be even more invasive, and probably not merge window material, so you may want to pick Alexandru's 4th patch as well. Thanks, M. -- Without deviation from the norm, progress is not possible.