[PATCH] KVM: arm64: Fix handling of FEAT_GTG for unimplemented granule sizes

Marc Zyngier maz at kernel.org
Thu Jul 3 01:52:38 PDT 2025


On Wed, 02 Jul 2025 03:35:44 +0100,
Oliver Upton <oliver.upton at linux.dev> wrote:
> 
> On Tue, Jul 01, 2025 at 03:22:25PM +0100, Marc Zyngier wrote:
> > Booting an EL2 guest on a system only supporting a subset of the
> > possible page sizes leads to interesting situations.
> > 
> > For example, on a system that only supports 4kB and 64kB, and is
> > booted with a 4kB kernel, we end-up advertising 16kB support at
> > stage-2, which is pretty weird.
> > 
> > That's because we consider that any S2 bigger than our base granule
> > is fair game, irrespective of what the HW actually supports.
> 
> While this is ugly as hell, it is _technically_ OK though right? Since
> we always shadow the stage-2 MMU we can emulate the otherwise
> unsupported page size.
> 
> Now, mismatched granularity at S1 and S2 is a massive can of worms we
> should not entertain :)
> 
> > Add new checks that will verify that this granule size is actually
> > supported before publishing it to the guest.
> > 
> > Fixes: e7ef6ed4583ea ("KVM: arm64: Enforce NV limits on a per-idregs basis")
> > Signed-off-by: Marc Zyngier <maz at kernel.org>
> 
> It'd be good to clarify the rationale a bit further in the changelog,
> but full agreement on disallowing this sort of stupidity.

Indeed, I have now added some verbiage to that effect.

> Reviewed-by: Oliver Upton <oliver.upton at linux.dev>

Thanks!

	M.

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



More information about the linux-arm-kernel mailing list