]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Set HCR_EL2.PTW to prevent AT taking synchronous exception
authorJames Morse <james.morse@arm.com>
Fri, 21 Aug 2020 14:07:07 +0000 (15:07 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 28 Aug 2020 14:27:47 +0000 (15:27 +0100)
commitf0a018a4f70b2008508e22dd54f251d411689269
treebd0e55a525cea26851ddca7e5473ba1923650713
parentbc1e6956a6bd96cb82a43a768f7c463c2e363805
KVM: arm64: Set HCR_EL2.PTW to prevent AT taking synchronous exception

AT instructions do a translation table walk and return the result, or
the fault in PAR_EL1. KVM uses these to find the IPA when the value is
not provided by the CPU in HPFAR_EL1.

If a translation table walk causes an external abort it is taken as an
exception, even if it was due to an AT instruction. (DDI0487F.a's D5.2.11
"Synchronous faults generated by address translation instructions")

While we previously made KVM resilient to exceptions taken due to AT
instructions, the device access causes mismatched attributes, and may
occur speculatively. Prevent this, by forbidding a walk through memory
described as device at stage2. Now such AT instructions will report a
stage2 fault.

Such a fault will cause KVM to restart the guest. If the AT instructions
always walk the page tables, but guest execution uses the translation cached
in the TLB, the guest can't make forward progress until the TLB entry is
evicted. This isn't a problem, as since commit 264f5708e6af ("KVM: arm64:
Defer guest entry when an asynchronous exception is pending"), KVM will
return to the host to process IRQs allowing the rest of the system to keep
running.

Cc: stable@vger.kernel.org # <v5.3: 264f5708e6af ("KVM: arm64: Defer guest entry when an asynchronous exception is pending")
Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/kvm_arm.h