summaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2020-01-21 12:33:56 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-14 16:33:26 -0500
commitf8d4dfffbb4a3e3f8fcc97a1cfe6797b39cc053b (patch)
tree372d0f70dd384667e788760487ac5a9db685ca35 /virt/kvm
parent8ea83328b2bc11f4d115e7dd21afcf51889f350a (diff)
downloadlinux-stable-f8d4dfffbb4a3e3f8fcc97a1cfe6797b39cc053b.tar.gz
linux-stable-f8d4dfffbb4a3e3f8fcc97a1cfe6797b39cc053b.tar.bz2
linux-stable-f8d4dfffbb4a3e3f8fcc97a1cfe6797b39cc053b.zip
KVM: arm: Make inject_abt32() inject an external abort instead
commit 21aecdbd7f3ab02c9b82597dc733ee759fb8b274 upstream. KVM's inject_abt64() injects an external-abort into an aarch64 guest. The KVM_CAP_ARM_INJECT_EXT_DABT is intended to do exactly this, but for an aarch32 guest inject_abt32() injects an implementation-defined exception, 'Lockdown fault'. Change this to external abort. For non-LPAE we now get the documented: | Unhandled fault: external abort on non-linefetch (0x008) at 0x9c800f00 and for LPAE: | Unhandled fault: synchronous external abort (0x210) at 0x9c800f00 Fixes: 74a64a981662a ("KVM: arm/arm64: Unify 32bit fault injection") Reported-by: Beata Michalska <beata.michalska@linaro.org> Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20200121123356.203000-3-james.morse@arm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/arm/aarch32.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/virt/kvm/arm/aarch32.c b/virt/kvm/arm/aarch32.c
index 23ad2a4a39dc..18d6d5124397 100644
--- a/virt/kvm/arm/aarch32.c
+++ b/virt/kvm/arm/aarch32.c
@@ -26,6 +26,10 @@
#include <asm/kvm_emulate.h>
#include <asm/kvm_hyp.h>
+#define DFSR_FSC_EXTABT_LPAE 0x10
+#define DFSR_FSC_EXTABT_nLPAE 0x08
+#define DFSR_LPAE BIT(9)
+
/*
* Table taken from ARMv8 ARM DDI0487B-B, table G1-10.
*/
@@ -193,10 +197,10 @@ static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt,
/* Give the guest an IMPLEMENTATION DEFINED exception */
is_lpae = (vcpu_cp15(vcpu, c2_TTBCR) >> 31);
if (is_lpae) {
- *fsr = 1 << 9 | 0x34;
+ *fsr = DFSR_LPAE | DFSR_FSC_EXTABT_LPAE;
} else {
- /* Surprise! DFSR's FS[4] lives in bit 10 */
- *fsr = BIT(10) | 0x4; /* 0x14 */
+ /* no need to shuffle FS[4] into DFSR[10] as its 0 */
+ *fsr = DFSR_FSC_EXTABT_nLPAE;
}
}