aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2012-09-18 07:07:06 -0400
committerChristoffer Dall <cdall@cs.columbia.edu>2013-03-06 18:48:43 -0500
commit23b415d61a80c0c63f43dd2b3a08a1fa0b79b8ea (patch)
treec5d736a85f1840beaf17f534b16182acedcfefdf
parenta7123377e7107a5f4f7ae198aa5b5000c9362871 (diff)
ARM: KVM: abstract IL decoding 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_emulate.h6
-rw-r--r--arch/arm/kvm/arm.c3
-rw-r--r--arch/arm/kvm/coproc.c2
-rw-r--r--arch/arm/kvm/mmio.c2
4 files changed, 9 insertions, 4 deletions
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h
index e4a4fc2f9156..a9b853f35aed 100644
--- a/arch/arm/include/asm/kvm_emulate.h
+++ b/arch/arm/include/asm/kvm_emulate.h
@@ -136,4 +136,10 @@ static inline int kvm_vcpu_dabt_get_as(struct kvm_vcpu *vcpu)
136 } 136 }
137} 137}
138 138
139/* This one is not specific to Data Abort */
140static inline bool kvm_vcpu_trap_il_is32bit(struct kvm_vcpu *vcpu)
141{
142 return kvm_vcpu_get_hsr(vcpu) & HSR_IL;
143}
144
139#endif /* __ARM_KVM_EMULATE_H__ */ 145#endif /* __ARM_KVM_EMULATE_H__ */
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 6626c7e62371..31616336255c 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -624,8 +624,7 @@ static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
624 * that fail their condition code check" 624 * that fail their condition code check"
625 */ 625 */
626 if (!kvm_condition_valid(vcpu)) { 626 if (!kvm_condition_valid(vcpu)) {
627 bool is_wide = kvm_vcpu_get_hsr(vcpu) & HSR_IL; 627 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
628 kvm_skip_instr(vcpu, is_wide);
629 return 1; 628 return 1;
630 } 629 }
631 630
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index b30591615da4..94eee8befc83 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -293,7 +293,7 @@ static int emulate_cp15(struct kvm_vcpu *vcpu,
293 293
294 if (likely(r->access(vcpu, params, r))) { 294 if (likely(r->access(vcpu, params, r))) {
295 /* Skip instruction, since it was emulated */ 295 /* Skip instruction, since it was emulated */
296 kvm_skip_instr(vcpu, (kvm_vcpu_get_hsr(vcpu) >> 25) & 1); 296 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
297 return 1; 297 return 1;
298 } 298 }
299 /* If access function fails, it should complain. */ 299 /* If access function fails, it should complain. */
diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
index 0b8f49985b70..02ca76555bd4 100644
--- a/arch/arm/kvm/mmio.c
+++ b/arch/arm/kvm/mmio.c
@@ -101,7 +101,7 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
101 * The MMIO instruction is emulated and should not be re-executed 101 * The MMIO instruction is emulated and should not be re-executed
102 * in the guest. 102 * in the guest.
103 */ 103 */
104 kvm_skip_instr(vcpu, (kvm_vcpu_get_hsr(vcpu) >> 25) & 1); 104 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
105 return 0; 105 return 0;
106} 106}
107 107