]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: GICv3: Preserve EOIcount on exit
authorMarc Zyngier <maz@kernel.org>
Thu, 20 Nov 2025 17:25:01 +0000 (17:25 +0000)
committerOliver Upton <oupton@kernel.org>
Mon, 24 Nov 2025 22:29:12 +0000 (14:29 -0800)
EOIcount is how the virtual CPU interface signals that the guest
is deactivating interrupts outside of the LRs when EOImode==0.

We therefore need to preserve that information so that we can find
out what actually needs deactivating.

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-12-maz@kernel.org
Signed-off-by: Oliver Upton <oupton@kernel.org>
arch/arm64/kvm/hyp/vgic-v3-sr.c

index e72d436dd6a36235de54ce2de61c11f5af37dc11..9bfcbfd91118a9068b0b28a6f537380ae2345db4 100644 (file)
@@ -225,6 +225,12 @@ void __vgic_v3_save_state(struct vgic_v3_cpu_if *cpu_if)
 
                elrsr = read_gicreg(ICH_ELRSR_EL2);
 
+               if (cpu_if->vgic_hcr & ICH_HCR_EL2_LRENPIE) {
+                       u64 val = read_gicreg(ICH_HCR_EL2);
+                       cpu_if->vgic_hcr &= ~ICH_HCR_EL2_EOIcount;
+                       cpu_if->vgic_hcr |= val & ICH_HCR_EL2_EOIcount;
+               }
+
                write_gicreg(0, ICH_HCR_EL2);
 
                for (i = 0; i < used_lrs; i++) {