Re: [PATCH] KVM: arm64: nv: Don't WARN when L1 sets IMO and FMO differently

From: Marc Zyngier

Date: Thu Oct 22 2026 - 07:56:16 EST


On Thu, 22 Oct 2026 11:03:19 +0100,
Fuad Tabba <fuad.tabba@xxxxxxxxx> wrote:
>
> 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")
> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/20260714235020.2F4151F000E9@xxxxxxxxxxxxxxx/
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
> ---
> 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(-)
>
> diff --git a/arch/arm64/kvm/vgic/vgic-v3-nested.c b/arch/arm64/kvm/vgic/vgic-v3-nested.c
> index 82bfc4d4f122f..c70e06c46a7a5 100644
> --- a/arch/arm64/kvm/vgic/vgic-v3-nested.c
> +++ b/arch/arm64/kvm/vgic/vgic-v3-nested.c
> @@ -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.

--
Without deviation from the norm, progress is not possible.