Skip to contentSkip to conversation

KVM: arm64: GICv3: Don't advertise ICH_HCR_EL2.En==1 when no vgic is configured

PATCH Superseded Marc Zyngier 2 participants 2 messages Nov 14, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Marc Zyngier

author maintainer
#0 lore raw

PATCH 1/1 KVM: arm64: GICv3: Don't advertise ICH_HCR_EL2.En==1 when no vgic is configured

Configuring GICv3 to deal with the lack of GIC in the guest relies on not setting ICH_HCR_EL2.En in the shadow register, as this is an indication of the fact that we want to trap all system registers to report an UNDEF in the guest.

Make sure we leave vgic_hcr untouched in this case.

Fixes 877324a1b5415 ("KVM: arm64: Revamp vgic maintenance interrupt configuration")
---
 arch/arm64/kvm/vgic/vgic-v3.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/kvm/vgic/vgic-v3.c +3 -0
index 598621b14a30d..1d6dd1b545bdd 100644
@@ -26,6 +26,9 @@ void vgic_v3_configure_hcr(struct kvm_vcpu *vcpu,
 {
 	struct vgic_v3_cpu_if *cpuif = &vcpu->arch.vgic_cpu.vgic_v3;
 
+	if (!irqchip_in_kernel(vcpu->kvm))
+		return;
+
 	cpuif->vgic_hcr = ICH_HCR_EL2_En;
 
 	if (irqs_pending_outside_lrs(als))
Signature · 1 line
2.47.3
Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Marc Zyngier

Configuring GICv3 to deal with the lack of GIC in the guest relies on not setting ICH_HCR_EL2.En in the shadow register, as this is an indication of the fact that we want to trap all system registers to report an UNDEF in the guest.

Make sure we leave vgic_hcr untouched in this case.

This resolves the issues I was seeing with no-vgic-v3: