Re: [PATCH v14 3/5] KVM: arm64: Manage GCS access and registers for guests

From: Marc Zyngier
Date: Sat Oct 05 2024 - 10:03:08 EST


On Sat, 05 Oct 2024 14:48:09 +0100,
Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> [1 <text/plain; us-ascii (7bit)>]
> On Sat, Oct 05, 2024 at 02:18:57PM +0100, Marc Zyngier wrote:
> > Mark Brown <broonie@xxxxxxxxxx> wrote:
> > > On Sat, Oct 05, 2024 at 12:34:20PM +0100, Marc Zyngier wrote:
>
> > > > Where is the handling of traps resulting of HFGITR_EL2.nGCSSTR_EL1?
>
> > > These will trap with an EC of 0x2d which isn't known so I was expecting
> > > this to get handled in the same way as for example a return of false
> > > from kvm_hyp_handle_fpsimd() for SVE when unsupported, or for the
> > > simiarly unknown SME EC, currently. I gather from your comment that
> > > you're instead expecting to see an explicit exit handler for this EC
> > > that just injects the UNDEF directly?
>
> > Not just inject an UNDEF directly, but also track whether this needs
> > to be forwarded when the guest's HFGITR_EL2.nGCSSTR_EL1 is 0 while not
> > being not RES0. Basically following what the pseudocode describes.
>
> Ah, I see. I'd been under the impression that the generic machinery was
> supposed to handle this already using the descriptions in
> emulate-nested.c and we only needed handlers for more specific actions.

From that very file:

/*
* Map encoding to trap bits for exception reported with EC=0x18.
[...]
*/

Everything else needs special handling.

M.

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