Skip to contentSkip to conversation

KVM: arm64: nv: Don't WARN when L1 sets IMO and FMO differently

PATCH In review Fuad Tabba 2 participants 3 messages Oct 22

Subsystems (2)
lore
Share & tools
lore

Fuad Tabba

author reviewer
#0 lore raw

PATCH 1/1 KVM: arm64: nv: Don't WARN when L1 sets IMO and FMO differently

When L1 runs L2 with only one of IMO and FMO set in its HCR_EL2, vgic_state_is_nested() WARNs that this isn't supported. KVM then runs L2 as if both bits were set.

However, IMO and FMO are independent bits, so any L1 can trigger the WARN, which panics a host running with panic_on_warn.

Drop the WARN.

Fixes 146a050f2d8c4 ("KVM: arm64: nv: Nested GICv3 emulation")

---
I dropped the WARN rather than demoting it to a print, the same way e6e3e0022ef8f ("KVM: arm64: timer: Drop warning on failed interrupt signalling") dropped one that was loud and easy to trigger from userspace.

Tested on QEMU with kvm-arm.mode=nested. A reproducer of mine sets L1's HCR_EL2 to IMO=1, FMO=0, TGE=0 through KVM_SET_ONE_REG and starts the vCPU at EL1. The host WARNs on the first KVM_RUN without this patch, and not with it.

Based on kvmarm/fixes (c5b7894f1a26b), which has the HCR_EL2_* rename.

 arch/arm64/kvm/vgic/vgic-v3-nested.c | 3 ---
 1 file changed, 3 deletions(-)
arch/arm64/kvm/vgic/vgic-v3-nested.c +0 -3
index 82bfc4d4f122f..c70e06c46a7a5 100644
@@ -121,9 +121,6 @@ bool vgic_state_is_nested(struct kvm_vcpu *vcpu)
 
 	if (is_nested_ctxt(vcpu)) {
 		xmo = __vcpu_sys_reg(vcpu, HCR_EL2) & (HCR_EL2_IMO | HCR_EL2_FMO);
-		WARN_ONCE(xmo && xmo != (HCR_EL2_IMO | HCR_EL2_FMO),
-			  "Separate virtual IRQ/FIQ settings not supported\n");
-
 		return !!xmo;
 	}
 

base-commit: c5b7894f1a26b5cc942be1cd11b15c3876c837a1

Signature · 1 line
2.47.3
maintainer
#1 lore raw
Quoted 36 lines · Fuad Tabba

When L1 runs L2 with only one of IMO and FMO set in its HCR_EL2, vgic_state_is_nested() WARNs that this isn't supported. KVM then runs L2 as if both bits were set.

However, IMO and FMO are independent bits, so any L1 can trigger the WARN, which panics a host running with panic_on_warn.

Drop the WARN.

Fixes 146a050f2d8c4 ("KVM: arm64: nv: Nested GICv3 emulation")

---
I dropped the WARN rather than demoting it to a print, the same way e6e3e0022ef8f ("KVM: arm64: timer: Drop warning on failed interrupt signalling") dropped one that was loud and easy to trigger from userspace.

Tested on QEMU with kvm-arm.mode=nested. A reproducer of mine sets L1's HCR_EL2 to IMO=1, FMO=0, TGE=0 through KVM_SET_ONE_REG and starts the vCPU at EL1. The host WARNs on the first KVM_RUN without this patch, and not with it.

Based on kvmarm/fixes (c5b7894f1a26b), which has the HCR_EL2_* rename.

 arch/arm64/kvm/vgic/vgic-v3-nested.c | 3 ---
 1 file changed, 3 deletions(-)
arch/arm64/kvm/vgic/vgic-v3-nested.c +0 -0
index 82bfc4d4f122f..c70e06c46a7a5 100644

arch/arm64/kvm/vgic/vgic-v3-nested.c bool vgic_state_is_nested(struct kvm_vcpu *vcpu) · line 126

Quoted 9 lines
arch/arm64/kvm/vgic/vgic-v3-nested.c +0 -3
@@ -121,9 +121,6 @@ bool vgic_state_is_nested(struct kvm_vcpu *vcpu)
 
 	if (is_nested_ctxt(vcpu)) {
 		xmo = __vcpu_sys_reg(vcpu, HCR_EL2) & (HCR_EL2_IMO | HCR_EL2_FMO);
-		WARN_ONCE(xmo && xmo != (HCR_EL2_IMO | HCR_EL2_FMO),
-			  "Separate virtual IRQ/FIQ settings not supported\n");
-
 		return !!xmo;
 	}
 

No. Either we fix the bug, or the WARN_ON() stays. There is no alternative.

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
author reviewer
#2 lore raw

Hi Marc,

On Thu, 22 Oct 2026 12:56:07 +0100, Marc Zyngier <[email protected]> wrote:
[...]

Quoted 2 lines

No. Either we fix the bug, or the WARN_ON() stays. There is no alternative.

Ack, I'll look into emulation instead, after -rc1.

Cheers,
/fuad