From: Dan Carpenter <dan@pereq.eu>
To: Fuad Tabba <fuad.tabba@linux.dev>
Cc: "Marc Zyngier" <maz@kernel.org>,
"Oliver Upton" <oupton@kernel.org>,
"Joey Gouly" <joey.gouly@arm.com>,
"Steffen Eiden" <seiden@linux.ibm.com>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>,
"Zenghui Yu" <yuzenghui@huawei.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Karthik Bhargavan" <karthik@pereq.eu>,
"Clément Blaudeau" <clement@cryspen.com>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev
Subject: Re: [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError
Date: Fri, 27 Nov 2026 19:23:46 +0300 [thread overview]
Message-ID: <awmukv2SwxTt6l9s@stanley.mountain> (raw)
In-Reply-To: <CA+EHjTwi=nFyBKKT_beb60DHU8N98yGQsNHcFRSdc3Vcu7D24w@mail.gmail.com>
On Wed, Nov 25, 2026 at 01:52:53PM +0000, Fuad Tabba wrote:
> Hi Dan,
>
> On Wed, 25 Nov 2026 12:26:47 +0000, Dan Carpenter <dan@pereq.eu> wrote:
> [...]
> > diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
> > index 1d5dfd4b9e00..91b835bc939b 100644
> [...]
> > @@ -396,6 +396,14 @@ 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. The host's copy of a protected vcpu's
> > + * PSTATE is stale so checking serror_is_masked() doesn't make sense.
> > + */
> > + if (!vcpu_is_protected(vcpu) && !serror_is_masked(vcpu))
> > + vcpu->mmio_needed = false;
>
> Could you check PSTATE.A directly instead of calling
> serror_is_masked()? That helper treats SCTLR2_EL1.NMEA=1 as unmasked,
> but NMEA doesn't affect a virtual SError. With NMEA and PSTATE.A both
> set, the patch would drop the access while the SError stays pending.
>
> Checking PSTATE.A also covers protected vCPUs, since EL2 always sets A
> in the host's copy of a protected vCPU's PSTATE (pvm_host_pstate()).
> You can then drop the vcpu_is_protected() check. Something like:
>
> if (!(*vcpu_cpsr(vcpu) & PSR_A_BIT))
> vcpu->mmio_needed = false;
>
That obviously works. I'll send it. I wonder if it would be prettier
inside a wrapper like if (!vserror_is_masked(vcpu)) instead?
regards,
dan carpenter
prev parent reply other threads:[~2026-11-27 16:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 12:26 [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError Dan Carpenter
2026-11-25 13:52 ` Fuad Tabba
2026-11-27 16:23 ` Dan Carpenter [this message]
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=awmukv2SwxTt6l9s@stanley.mountain \
--to=dan@pereq.eu \
--cc=catalin.marinas@arm.com \
--cc=clement@cryspen.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=karthik@pereq.eu \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.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