linux/arch/arm64
James Morse 5dcd0fdbb4 KVM: arm64: Defer guest entry when an asynchronous exception is pending
SError that occur during world-switch's entry to the guest will be
accounted to the guest, as the exception is masked until we enter the
guest... but we want to attribute the SError as precisely as possible.

Reading DISR_EL1 before guest entry requires free registers, and using
ESB+DISR_EL1 to consume and read back the ESR would leave KVM holding
a host SError... We would rather leave the SError pending and let the
host take it once we exit world-switch. To do this, we need to defer
guest-entry if an SError is pending.

Read the ISR to see if SError (or an IRQ) is pending. If so fake an
exit. Place this check between __guest_enter()'s save of the host
registers, and restore of the guest's. SError that occur between
here and the eret into the guest must have affected the guest's
registers, which we can naturally attribute to the guest.

The dsb is needed to ensure any previous writes have been done before
we read ISR_EL1. On systems without the v8.2 RAS extensions this
doesn't give us anything as we can't contain errors, and the ESR bits
to describe the severity are all implementation-defined. Replace
this with a nop for these systems.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2019-07-05 13:03:30 +01:00
..
boot treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 332 2019-06-05 17:37:06 +02:00
configs ARM: SoC defconfig updates 2019-05-16 09:35:26 -07:00
crypto treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
include KVM: arm64: Consume pending SError as early as possible 2019-07-05 13:03:29 +01:00
kernel SPDX update for 5.2-rc6 2019-06-21 09:58:42 -07:00
kvm KVM: arm64: Defer guest entry when an asynchronous exception is pending 2019-07-05 13:03:30 +01:00
lib treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
mm treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
net treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
xen treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Kconfig Second round of arm64 fixes for -rc2 2019-05-24 11:03:26 -07:00
Kconfig.debug treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Kconfig.platforms Texas Instruments AM65x fixes for v5.2 2019-06-16 13:30:30 -07:00
Makefile arm64: Don't unconditionally add -Wno-psabi to KBUILD_CFLAGS 2019-06-12 10:54:47 +01:00