diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2012-09-18 06:37:28 -0400 |
---|---|---|
committer | Christoffer Dall <cdall@cs.columbia.edu> | 2013-03-06 18:48:42 -0500 |
commit | b37670b0f37d8015d0d428e6a63bd07397430a2f (patch) | |
tree | 8bc2b42b3be447effbc077ff832e139cd38d81e2 | |
parent | 78abfcde49e0e454cabf8e56cd4c1591752e2706 (diff) |
ARM: KVM: abstract S1TW abort detection away
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
-rw-r--r-- | arch/arm/include/asm/kvm_arm.h | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/kvm_emulate.h | 5 | ||||
-rw-r--r-- | arch/arm/kvm/mmio.c | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h index 990764e89489..124623e5ef14 100644 --- a/arch/arm/include/asm/kvm_arm.h +++ b/arch/arm/include/asm/kvm_arm.h | |||
@@ -211,6 +211,7 @@ | |||
211 | 211 | ||
212 | #define HSR_HVC_IMM_MASK ((1UL << 16) - 1) | 212 | #define HSR_HVC_IMM_MASK ((1UL << 16) - 1) |
213 | 213 | ||
214 | #define HSR_DABT_S1PTW (1U << 7) | ||
214 | #define HSR_DABT_CM (1U << 8) | 215 | #define HSR_DABT_CM (1U << 8) |
215 | #define HSR_DABT_EA (1U << 9) | 216 | #define HSR_DABT_EA (1U << 9) |
216 | 217 | ||
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h index 2d1c5854243b..6b43653865fb 100644 --- a/arch/arm/include/asm/kvm_emulate.h +++ b/arch/arm/include/asm/kvm_emulate.h | |||
@@ -115,4 +115,9 @@ static inline bool kvm_vcpu_dabt_isextabt(struct kvm_vcpu *vcpu) | |||
115 | return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_EA; | 115 | return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_EA; |
116 | } | 116 | } |
117 | 117 | ||
118 | static inline bool kvm_vcpu_dabt_iss1tw(struct kvm_vcpu *vcpu) | ||
119 | { | ||
120 | return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_S1PTW; | ||
121 | } | ||
122 | |||
118 | #endif /* __ARM_KVM_EMULATE_H__ */ | 123 | #endif /* __ARM_KVM_EMULATE_H__ */ |
diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c index e4682a3af313..6495c1ca7bfa 100644 --- a/arch/arm/kvm/mmio.c +++ b/arch/arm/kvm/mmio.c | |||
@@ -71,7 +71,7 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, | |||
71 | return 1; | 71 | return 1; |
72 | } | 72 | } |
73 | 73 | ||
74 | if ((kvm_vcpu_get_hsr(vcpu) >> 7) & 1) { | 74 | if (kvm_vcpu_dabt_iss1tw(vcpu)) { |
75 | /* page table accesses IO mem: tell guest to fix its TTBR */ | 75 | /* page table accesses IO mem: tell guest to fix its TTBR */ |
76 | kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu)); | 76 | kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu)); |
77 | return 1; | 77 | return 1; |