[PATCH 0/2] KVM: arm64: Fix HCRX_EL2.GCSEn handling

Marc Zyngier maz at kernel.org
Wed Apr 30 03:59:14 PDT 2025


Will points out[1] that GCS is completely busted on the host if we
ever run a guest, as HCRX_EL2 gets set to a fixed value on vcpu exit,
value that doesn't include the GCSEn bit. This is likely to kaboom on
a nVHE/hVHE setup.

Obviously, nobody ever tested this.

This series moves the handling of HCRX_EL2 to being correctly
saved/restored, which should address the problem. I say "should", as
in keeping with the tradition, I haven't tested it either. Or at least
not with GCS, as I don't have the correct SW setup (I don't even know
what you need to enable GCS).

I'd very much appreciate some help in testing this.

Marc Zyngier (2):
  KVM: arm64: Properly save/restore HCRX_EL2
  KVM: arm64: Kill HCRX_HOST_FLAGS

 arch/arm64/include/asm/el2_setup.h      |  2 +-
 arch/arm64/include/asm/kvm_arm.h        |  1 -
 arch/arm64/kvm/hyp/include/hyp/switch.h | 13 ++++++-------
 3 files changed, 7 insertions(+), 9 deletions(-)

-- 
2.39.2




More information about the linux-arm-kernel mailing list