mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Fuad Tabba <fuad.tabba@linux.dev>
Cc: Oliver Upton <oupton@kernel.org>,
	kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Fuad Tabba <tabba@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: arm64: nv: Don't WARN when L1 sets IMO and FMO differently
Date: Thu, 22 Oct 2026 12:56:07 +0100	[thread overview]
Message-ID: <86ik2uymnc.wl-maz@kernel.org> (raw)
In-Reply-To: <20261022100319.3046476-1-fuad.tabba@linux.dev>

On Thu, 22 Oct 2026 11:03:19 +0100,
Fuad Tabba <fuad.tabba@linux.dev> 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@kernel.org>
> Closes: https://lore.kernel.org/all/20260714235020.2F4151F000E9@smtp.kernel.org/
> Cc: stable@vger.kernel.org
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
> ---
> 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.

  reply	other threads:[~2026-10-22 11:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 10:03 Fuad Tabba
2026-10-22 11:56 ` Marc Zyngier [this message]
2026-10-22 12:49   ` Fuad Tabba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ik2uymnc.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®