Skip to content

Commit bfb7a30

Browse files
committed
KVM: arm64: Don't retire MMIO instruction w/ pending (emulated) SError
KVM might have an emulated SError queued for the guest if userspace returned an abort for MMIO. Better yet, it could actually be a *synchronous* exception in disguise if SCTLR2_ELx.EASE is set. Don't advance PC if KVM owes an emulated SError, just like the handling of emulated SEA injection. Reviewed-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent a3c4a00 commit bfb7a30

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/arm64/kvm/mmio.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ unsigned long kvm_mmio_read_buf(const void *buf, unsigned int len)
7272
return data;
7373
}
7474

75-
static bool kvm_pending_sync_exception(struct kvm_vcpu *vcpu)
75+
static bool kvm_pending_external_abort(struct kvm_vcpu *vcpu)
7676
{
7777
if (!vcpu_get_flag(vcpu, PENDING_EXCEPTION))
7878
return false;
@@ -90,6 +90,8 @@ static bool kvm_pending_sync_exception(struct kvm_vcpu *vcpu)
9090
switch (vcpu_get_flag(vcpu, EXCEPT_MASK)) {
9191
case unpack_vcpu_flag(EXCEPT_AA64_EL1_SYNC):
9292
case unpack_vcpu_flag(EXCEPT_AA64_EL2_SYNC):
93+
case unpack_vcpu_flag(EXCEPT_AA64_EL1_SERR):
94+
case unpack_vcpu_flag(EXCEPT_AA64_EL2_SERR):
9395
return true;
9496
default:
9597
return false;
@@ -113,7 +115,7 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu)
113115
* Detect if the MMIO return was already handled or if userspace aborted
114116
* the MMIO access.
115117
*/
116-
if (unlikely(!vcpu->mmio_needed || kvm_pending_sync_exception(vcpu)))
118+
if (unlikely(!vcpu->mmio_needed || kvm_pending_external_abort(vcpu)))
117119
return 1;
118120

119121
vcpu->mmio_needed = 0;

0 commit comments

Comments
 (0)