From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oupton@kernel.org>
Cc: Alexandru Elisei <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
Subject: Re: [PATCH 3/4] KVM: arm64: nv: Don't mask VTCR_EL2.HA if FEAT_HAFDBS is present
Date: Sat, 29 Nov 2025 11:35:17 +0000 [thread overview]
Message-ID: <86sedxoyve.wl-maz@kernel.org> (raw)
In-Reply-To: <aSnuauBCe1Ru2q0T@kernel.org>
On Fri, 28 Nov 2025 18:48:10 +0000,
Oliver Upton <oupton@kernel.org> 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 <alexandru.elisei@arm.com> 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 <alexandru.elisei@arm.com>
> > > ---
> > > 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.
next prev parent reply other threads:[~2025-11-29 11:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 10:09 [PATCH 0/4] KVM: arm64: nv: HAF fixes Alexandru Elisei
2025-11-28 10:09 ` [PATCH 1/4] KVM: arm64: Document KVM_PGTABLE_PROT_{UX,PX} Alexandru Elisei
2025-11-28 10:09 ` [PATCH 2/4] KVM: arm64: at: Use correct HA bit in TCR_EL2 when regime is EL2 Alexandru Elisei
2025-11-28 10:09 ` [PATCH 3/4] KVM: arm64: nv: Don't mask VTCR_EL2.HA if FEAT_HAFDBS is present Alexandru Elisei
2025-11-28 15:46 ` Marc Zyngier
2025-11-28 18:48 ` Oliver Upton
2025-11-29 11:35 ` Marc Zyngier [this message]
2025-11-28 10:09 ` [PATCH 4/4] KVM: arm64: at: Update AF on software walk only if VM has FEAT_HAFDBS Alexandru Elisei
2025-11-28 15:51 ` Marc Zyngier
2025-11-28 18:51 ` [PATCH 0/4] KVM: arm64: nv: HAF fixes Oliver Upton
2025-11-30 13:11 ` Marc Zyngier
2025-12-01 9:19 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86sedxoyve.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=alexandru.elisei@arm.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=oliver.upton@linux.dev \
--cc=oupton@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).