Skip to content

Commit 21aecdb

Browse files
James MorseMarc Zyngier
authored andcommitted
KVM: arm: Make inject_abt32() inject an external abort instead
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: 74a64a9 ("KVM: arm/arm64: Unify 32bit fault injection") Reported-by: Beata Michalska <[email protected]> Signed-off-by: James Morse <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 018f22f commit 21aecdb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

virt/kvm/arm/aarch32.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
#include <asm/kvm_emulate.h>
1616
#include <asm/kvm_hyp.h>
1717

18+
#define DFSR_FSC_EXTABT_LPAE 0x10
19+
#define DFSR_FSC_EXTABT_nLPAE 0x08
20+
#define DFSR_LPAE BIT(9)
21+
1822
/*
1923
* Table taken from ARMv8 ARM DDI0487B-B, table G1-10.
2024
*/
@@ -182,10 +186,10 @@ static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt,
182186
/* Give the guest an IMPLEMENTATION DEFINED exception */
183187
is_lpae = (vcpu_cp15(vcpu, c2_TTBCR) >> 31);
184188
if (is_lpae) {
185-
*fsr = 1 << 9 | 0x34;
189+
*fsr = DFSR_LPAE | DFSR_FSC_EXTABT_LPAE;
186190
} else {
187-
/* Surprise! DFSR's FS[4] lives in bit 10 */
188-
*fsr = BIT(10) | 0x4; /* 0x14 */
191+
/* no need to shuffle FS[4] into DFSR[10] as its 0 */
192+
*fsr = DFSR_FSC_EXTABT_nLPAE;
189193
}
190194
}
191195

0 commit comments

Comments
 (0)