All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dan Carpenter" <dan@pereq.eu>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
	"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError
Date: Fri, 27 Nov 2026 18:14:08 +0000	[thread overview]
Message-ID: <sashiko-outbox-238059@kernel.org> (raw)
In-Reply-To: <20261127-serror-drop-mmio-v2-v1-1-96bd01bef6d8@pereq.eu>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: arm64: PSR_A_BIT check in kvm_inject_serror_esr() ignores
  SCTLR2_ELx.NMEA
--

commit 3baf52b3ece0a678fb430e38fdfba08de0591af4
Author: Dan Carpenter <dan@pereq.eu>

KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError

This commit clears vcpu->mmio_needed when injecting an unmasked SError via
HCR_EL2.VSE so that non-NV vCPUs cancel a pending MMIO exit like NV vCPUs
do.

> diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
> index aa2011cc0d5a0..61df0338290d9 100644
> --- a/arch/arm64/kvm/inject_fault.c
> +++ b/arch/arm64/kvm/inject_fault.c
> @@ -386,6 +386,13 @@ int kvm_inject_serror_esr(struct kvm_vcpu *vcpu, u64 esr)
>  		return 1;
>  	}
>  
> +	/*
> +	 * Like the emulated entry above, an unmasked SError cancels the MMIO
> +	 * access the vcpu exited on.
> +	 */
> +	if (!(*vcpu_cpsr(vcpu) & PSR_A_BIT))
> +		vcpu->mmio_needed = false;

[Severity: Low]
Does hardware deliver a virtual SError pended via HCR_EL2.VSE when
PSTATE.A is 1 and the effective SCTLR2_ELx.NMEA bit is 1?

This rests on an architecture detail that could not be confirmed from the
kernel source.  Earlier in this file, serror_is_masked() treats SErrors as
unmasked when effective_sctlr2_nmea(vcpu) is set, and the NV path right
above emulates the exception entry and clears vcpu->mmio_needed in that
state:

arch/arm64/kvm/inject_fault.c:serror_is_masked() {
	return (*vcpu_cpsr(vcpu) & PSR_A_BIT) && !effective_sctlr2_nmea(vcpu);
}

If HCR_EL2.VSE also delivers the virtual SError when PSTATE.A is 1 and
effective SCTLR2_EL1.NMEA is 1, testing only PSR_A_BIT here leaves
vcpu->mmio_needed set on a non-NV vCPU, so the next KVM_RUN completes the
MMIO access and advances PC before the guest takes the SError.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-serror-drop-mmio-v2-v1-1-96bd01bef6d8@pereq.eu?part=1

  reply	other threads:[~2026-11-27 18:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 17:52 [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError Dan Carpenter
2026-11-27 18:14 ` sashiko-bot [this message]
2026-11-28  8:59   ` Dan Carpenter
2026-11-28 15:42 ` Fuad Tabba
2026-11-28 17:48   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2026-11-25 12:26 Dan Carpenter
2026-11-25 12:40 ` sashiko-bot
2026-11-25 12:57   ` Dan Carpenter
2026-11-25 13:52 ` Fuad Tabba
2026-11-27 16:23   ` Dan Carpenter

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=sashiko-outbox-238059@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dan@pereq.eu \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.