[PATCH] KVM: arm64: Drop a pending MMIO access when injecting an unmasked SError
Fuad Tabba
fuad.tabba at linux.dev
Sat Nov 28 07:42:50 PST 2026
Hi Dan,
On Fri, 27 Nov 2026 17:52:37 +0000, Dan Carpenter <dan at pereq.eu> wrote:
[...]
> diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
[...]
> @@ -396,6 +396,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;
This is the check I suggested on v1, but after taking a closer look I
found an issue with the drop itself, which I missed then.
With the access dropped, the vcpu runs the same instruction again with
the vSError pending, and the instruction faults at stage 2 again. For
the first instruction after an exception return, R_RBZYL in the ARM ARM
states:
If the first instruction after the Context synchronization event
generates a synchronous exception, the architecture does not define
whether the PE takes the asynchronous exception or the synchronous
exception first.
If the PE takes the abort first, the vcpu exits on the same access
again and the next KVM_RUN completes it. The emulated entry isn't
affected, since KVM emulates it before the vcpu runs.
So I don't think the drop can be relied on, and I'd leave the code as
it is. Could you instead make your selftest not depend on whether the
access completes for a vcpu without EL2?
Regarding Sashiko's finding, that isn't an issue, since NMEA doesn't
affect a virtual SError. The description of SCTLR2_EL1.NMEA reads "This
field has no effect on the masking of virtual and delegated SError
interrupts."
Cheers,
/fuad
More information about the linux-arm-kernel
mailing list