All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oupton@kernel.org>
Cc: Yao Yuan <yaoyuan@linux.alibaba.com>,
	kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Ben Horgan <ben.horgan@arm.com>
Subject: Re: [PATCH v2 4/5] KVM: arm64: Report optional ID register traps with a 0x18 syndrome
Date: Thu, 27 Nov 2025 16:35:02 +0000	[thread overview]
Message-ID: <86zf87ph6x.wl-maz@kernel.org> (raw)
In-Reply-To: <aSfzJxBfdI17pyPD@kernel.org>

On Thu, 27 Nov 2025 06:43:51 +0000,
Oliver Upton <oupton@kernel.org> wrote:
> 
> On Thu, Nov 27, 2025 at 02:07:08PM +0800, Yao Yuan wrote:
> > On Wed, Nov 26, 2025 at 03:59:50PM +0800, Marc Zyngier wrote:
> > > With FEAT_IDST, unimplemented system registers in the feature ID space
> > > must be reported using EC=0x18 at the closest handling EL, rather than
> > > with an UNDEF.
> > >
> > > Most of these system registers are always implemented thanks to their
> > > dependency on FEAT_AA64, except for a set of (currently) three registers:
> > > GMID_EL1 (depending on MTE2), CCSIDR2_EL1 (depending on FEAT_CCIDX),
> > > and SMIDR_EL1 (depending on SME).
> > >
> > > For these three registers, report their trap as EC=0x18 if they
> > > end-up trapping into KVM and that FEAT_IDST is not implemented in the
> > > guest. Otherwise, just make them UNDEF.
> > >
> > > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > > ---
> > >  arch/arm64/kvm/sys_regs.c | 16 +++++++++++++---
> > >  1 file changed, 13 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> > > index 2ca6862e935b5..7705f703e7c6d 100644
> > > --- a/arch/arm64/kvm/sys_regs.c
> > > +++ b/arch/arm64/kvm/sys_regs.c
> > > @@ -82,6 +82,16 @@ static bool write_to_read_only(struct kvm_vcpu *vcpu,
> > >  			"sys_reg write to read-only register");
> > >  }
> > >
> > > +static bool idst_access(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
> > > +			const struct sys_reg_desc *r)
> > > +{
> > > +	if (kvm_has_feat_enum(vcpu->kvm, ID_AA64MMFR2_EL1, IDS, 0x0))
> > 
> > Hi Marc,
> > 
> > Minor: maybe beter readability if use NI instead of 0x0, just like
> > things in feat_nv2() below, but depends on you.
> 
> +1, using the ESR value as an identifier in the sysreg tables is just
> terrible. This reads like a literal.

Yeah, I was a bit shocked when I found how it was encoded in the
sysreg file, but kept it as is. Since there is a consensus that this
is pretty lame, I'll add a patch repainting it using the usual NI/IMP
identifiers.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2025-11-27 16:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 15:59 [PATCH v2 0/5] KVM: arm64: Add support for FEAT_IDST Marc Zyngier
2025-11-26 15:59 ` [PATCH v2 1/5] KVM: arm64: Add routing/handling for GMID_EL1 Marc Zyngier
2025-11-26 15:59 ` [PATCH v2 2/5] KVM: arm64: Force trap of GMID_EL1 when the guest doesn't have MTE Marc Zyngier
2025-11-27  5:52   ` Yao Yuan
2025-11-27  6:37   ` Oliver Upton
2025-11-27 16:31     ` Marc Zyngier
2025-11-26 15:59 ` [PATCH v2 3/5] KVM: arm64: Add a generic synchronous exception injection primitive Marc Zyngier
2025-11-26 16:58   ` Ben Horgan
2025-11-27  5:57   ` Yao Yuan
2025-11-26 15:59 ` [PATCH v2 4/5] KVM: arm64: Report optional ID register traps with a 0x18 syndrome Marc Zyngier
2025-11-26 17:10   ` Ben Horgan
2025-11-26 17:14     ` Ben Horgan
2025-11-27  6:07   ` Yao Yuan
2025-11-27  6:43     ` Oliver Upton
2025-11-27 16:35       ` Marc Zyngier [this message]
2025-11-26 15:59 ` [PATCH v2 5/5] KVM: arm64: selftests: Add a test for FEAT_IDST Marc Zyngier
2025-11-27 16:38 ` [PATCH v2 0/5] KVM: arm64: Add support " 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=86zf87ph6x.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=ben.horgan@arm.com \
    --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=yaoyuan@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.