All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan@pereq.eu>
To: sashiko-reviews@lists.linux.dev
Cc: kvmarm@lists.linux.dev, Oliver Upton <oupton@kernel.org>,
	Marc Zyngier <maz@kernel.org>, Fuad Tabba <fuad.tabba@linux.dev>
Subject: Re: [PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError
Date: Sat, 28 Nov 2026 11:59:54 +0300	[thread overview]
Message-ID: <awqYCojgJpQGnWiQ@stanley.mountain> (raw)
In-Reply-To: <sashiko-outbox-238059@kernel.org>

On Fri, Nov 27, 2026 at 06:14:08PM +0000, sashiko-bot@kernel.org wrote:
> > +	/*
> > +	 * 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 is basically saying we go back to v1.  I don't think that's true
because Fuad is the expert here and because what Fuad is saying matches
what the Specs say.

The original bug was found in testing, but truth is that I'm using Qemu
so I can't actually test the difference between v1 and v2.  I had already
added the new case to my test matrix before I sent the patch, but on my
test setup it's a skip.  I am planning to push the test after everything
is working so we will eventually see if the specs match real CPUs.

regards,
dan carpenter


  reply	other threads:[~2026-11-28  9:00 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
2026-11-28  8:59   ` Dan Carpenter [this message]
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=awqYCojgJpQGnWiQ@stanley.mountain \
    --to=dan@pereq.eu \
    --cc=fuad.tabba@linux.dev \
    --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.