From: Marc Zyngier <maz@kernel.org>
To: Joey Gouly <joey.gouly@arm.com>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Oliver Upton <oupton@kernel.org>,
Zenghui Yu <yuzenghui@huawei.com>
Subject: Re: [PATCH 2/5] KVM: arm64: Force trap of GMID_EL1 when the guest doesn't have MTE
Date: Thu, 20 Nov 2025 14:51:44 +0000 [thread overview]
Message-ID: <865xb4sqnz.wl-maz@kernel.org> (raw)
In-Reply-To: <20251120143419.GA2325986@e124191.cambridge.arm.com>
On Thu, 20 Nov 2025 14:34:19 +0000,
Joey Gouly <joey.gouly@arm.com> wrote:
>
> On Thu, Nov 20, 2025 at 01:31:59PM +0000, Marc Zyngier wrote:
> > If our host has MTE, but the guest doesn't, make sure we set HCR_EL2.TID5
> > to force GMID_EL1 being trapped.
> >
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> > arch/arm64/kvm/sys_regs.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> > index 84e6f04220589..40f32b017f107 100644
> > --- a/arch/arm64/kvm/sys_regs.c
> > +++ b/arch/arm64/kvm/sys_regs.c
> > @@ -5558,6 +5558,8 @@ static void vcpu_set_hcr(struct kvm_vcpu *vcpu)
> >
> > if (kvm_has_mte(vcpu->kvm))
> > vcpu->arch.hcr_el2 |= HCR_ATA;
> > + else if (id_aa64pfr1_mte(read_sanitised_ftr_reg(SYS_ID_AA64PFR1_EL1)))
> > + vcpu->arch.hcr_el2 |= HCR_TID5;
>
> This is because we want to enable the trapping regardless of CONFIG_ARM64_MTE
> (so we can't use system_supports_mte()).
Indeed. In general, we cannot rely on the kernel's own configuration,
since the guest sees most of the actual HW.
>
> Reviewed-by: Joey Gouly <joey.gouly@arm.com>
Thanks!
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2025-11-20 14:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 13:31 [PATCH 0/5] KVM: arm64: Add support for FEAT_IDST Marc Zyngier
2025-11-20 13:31 ` [PATCH 1/5] KVM: arm64: Add routing/handling for GMID_EL1 Marc Zyngier
2025-11-20 13:31 ` [PATCH 2/5] KVM: arm64: Force trap of GMID_EL1 when the guest doesn't have MTE Marc Zyngier
2025-11-20 14:34 ` Joey Gouly
2025-11-20 14:51 ` Marc Zyngier [this message]
2025-11-20 13:32 ` [PATCH 3/5] KVM: arm64: Add a generic synchronous exception injection primitive Marc Zyngier
2025-11-20 13:32 ` [PATCH 4/5] KVM: arm64: Report optional ID register traps with a 0x18 syndrome Marc Zyngier
2025-11-24 10:41 ` Ben Horgan
2025-11-24 11:48 ` Marc Zyngier
2025-11-20 13:32 ` [PATCH 5/5] KVM: arm64: selftests: Add a test for FEAT_IDST 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=865xb4sqnz.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--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).