]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: arm64: GICv3: nv: Resync LRs/VMCR/HCR early for better MI emulation
authorMarc Zyngier <maz@kernel.org>
Thu, 20 Nov 2025 17:25:24 +0000 (17:25 +0000)
committerOliver Upton <oupton@kernel.org>
Mon, 24 Nov 2025 22:29:14 +0000 (14:29 -0800)
commiteb33ffa2bd3f1842d2960aff7484869fc64aa2fb
tree6e56d33cbdadf807437b51bd626e48f2d509619e
parent84792050e0392fbc1f285f9d9a0266b8480f6f06
KVM: arm64: GICv3: nv: Resync LRs/VMCR/HCR early for better MI emulation

The current approach to nested GICv3 support is to not do anything
while L2 is running, wait a transition from L2 to L1 to resync
LRs, VMCR and HCR, and only then evaluate the state to decide
whether to generate a maintenance interrupt.

This doesn't provide a good quality of emulation, and it would be
far preferable to find out early that we need to perform a switch.

Move the LRs/VMCR and HCR resync into vgic_v3_sync_nested(), so
that we have most of the state available. As we turning the vgic
off at this stage to avoid a screaming host MI, add a new helper
vgic_v3_flush_nested() that switches the vgic on again. The MI can
then be directly injected as required.

Tested-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Tested-by: Mark Brown <broonie@kernel.org>
Link: https://msgid.link/20251120172540.2267180-35-maz@kernel.org
Signed-off-by: Oliver Upton <oupton@kernel.org>
arch/arm64/include/asm/kvm_hyp.h
arch/arm64/kvm/hyp/vgic-v3-sr.c
arch/arm64/kvm/vgic/vgic-v3-nested.c
arch/arm64/kvm/vgic/vgic.c
arch/arm64/kvm/vgic/vgic.h