ARM: KVM: abstract (and fix) external abort detection away
authorMarc Zyngier <marc.zyngier@arm.com>
Tue, 18 Sep 2012 10:36:16 +0000 (11:36 +0100)
committerChristoffer Dall <cdall@cs.columbia.edu>
Wed, 6 Mar 2013 23:48:42 +0000 (15:48 -0800)
Bit 8 is cache maintenance, bit 9 is external abort.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
arch/arm/include/asm/kvm_arm.h
arch/arm/include/asm/kvm_emulate.h
arch/arm/kvm/mmio.c

index 7c3d813e15dffe76720472252995c27a22950cd6..990764e894893554becfce15b5e01549a1c86dd9 100644 (file)
 
 #define HSR_HVC_IMM_MASK       ((1UL << 16) - 1)
 
+#define HSR_DABT_CM            (1U << 8)
+#define HSR_DABT_EA            (1U << 9)
+
 #endif /* __ARM_KVM_ARM_H__ */
index d548078af4d888ecae8b22cb3c7bcbe3b8859347..2d1c5854243bc24cf19888c5b39e9e3dde012e09 100644 (file)
@@ -110,4 +110,9 @@ static inline int kvm_vcpu_dabt_get_rd(struct kvm_vcpu *vcpu)
        return (kvm_vcpu_get_hsr(vcpu) & HSR_SRT_MASK) >> HSR_SRT_SHIFT;
 }
 
+static inline bool kvm_vcpu_dabt_isextabt(struct kvm_vcpu *vcpu)
+{
+       return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_EA;
+}
+
 #endif /* __ARM_KVM_EMULATE_H__ */
index 586063d0697a713b001654624bdf4697cf0b8afa..e4682a3af31345bb0366da9d9e3af4ba852c739a 100644 (file)
@@ -65,7 +65,7 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
        unsigned long rt, len;
        bool is_write, sign_extend;
 
-       if ((kvm_vcpu_get_hsr(vcpu) >> 8) & 1) {
+       if (kvm_vcpu_dabt_isextabt(vcpu)) {
                /* cache operation on I/O addr, tell guest unsupported */
                kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu));
                return 1;