[PATCH v2 4/5] KVM: arm64: Report optional ID register traps with a 0x18 syndrome
Marc Zyngier
maz at kernel.org
Thu Nov 27 08:35:02 PST 2025
On Thu, 27 Nov 2025 06:43:51 +0000,
Oliver Upton <oupton at 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 at 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.
More information about the linux-arm-kernel
mailing list