Commit 23b415d6 authored by Marc Zyngier's avatar Marc Zyngier Committed by Christoffer Dall

ARM: KVM: abstract IL decoding away

Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarChristoffer Dall <cdall@cs.columbia.edu>
parent a7123377
...@@ -136,4 +136,10 @@ static inline int kvm_vcpu_dabt_get_as(struct kvm_vcpu *vcpu) ...@@ -136,4 +136,10 @@ static inline int kvm_vcpu_dabt_get_as(struct kvm_vcpu *vcpu)
} }
} }
/* This one is not specific to Data Abort */
static inline bool kvm_vcpu_trap_il_is32bit(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) & HSR_IL;
}
#endif /* __ARM_KVM_EMULATE_H__ */ #endif /* __ARM_KVM_EMULATE_H__ */
...@@ -624,8 +624,7 @@ static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run, ...@@ -624,8 +624,7 @@ static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
* that fail their condition code check" * that fail their condition code check"
*/ */
if (!kvm_condition_valid(vcpu)) { if (!kvm_condition_valid(vcpu)) {
bool is_wide = kvm_vcpu_get_hsr(vcpu) & HSR_IL; kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
kvm_skip_instr(vcpu, is_wide);
return 1; return 1;
} }
......
...@@ -293,7 +293,7 @@ static int emulate_cp15(struct kvm_vcpu *vcpu, ...@@ -293,7 +293,7 @@ static int emulate_cp15(struct kvm_vcpu *vcpu,
if (likely(r->access(vcpu, params, r))) { if (likely(r->access(vcpu, params, r))) {
/* Skip instruction, since it was emulated */ /* Skip instruction, since it was emulated */
kvm_skip_instr(vcpu, (kvm_vcpu_get_hsr(vcpu) >> 25) & 1); kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
return 1; return 1;
} }
/* If access function fails, it should complain. */ /* If access function fails, it should complain. */
......
...@@ -101,7 +101,7 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, ...@@ -101,7 +101,7 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
* The MMIO instruction is emulated and should not be re-executed * The MMIO instruction is emulated and should not be re-executed
* in the guest. * in the guest.
*/ */
kvm_skip_instr(vcpu, (kvm_vcpu_get_hsr(vcpu) >> 25) & 1); kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment