diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2016-09-06 09:02:09 -0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2016-09-08 06:53:00 -0400 |
commit | bfb78b5c98d0e6b6dbd9af9cd71e853670a34044 (patch) | |
tree | 01fec0fb15ec6452c279b513fa585345c7dfaacb | |
parent | 1f7e378d1235a3cb5c9cdd8c62fe13cb6c3cf157 (diff) |
arm: KVM: Add Virtual Abort injection helper
Now that we're able to context switch the HCR.VA bit, let's
introduce a helper that injects an Abort into a vcpu.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
-rw-r--r-- | arch/arm/include/asm/kvm_emulate.h | 1 | ||||
-rw-r--r-- | arch/arm/kvm/emulate.c | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h index 448d63cdcc3d..9a8a45aaf19a 100644 --- a/arch/arm/include/asm/kvm_emulate.h +++ b/arch/arm/include/asm/kvm_emulate.h | |||
@@ -43,6 +43,7 @@ static inline void vcpu_set_reg(struct kvm_vcpu *vcpu, u8 reg_num, | |||
43 | bool kvm_condition_valid32(const struct kvm_vcpu *vcpu); | 43 | bool kvm_condition_valid32(const struct kvm_vcpu *vcpu); |
44 | void kvm_skip_instr32(struct kvm_vcpu *vcpu, bool is_wide_instr); | 44 | void kvm_skip_instr32(struct kvm_vcpu *vcpu, bool is_wide_instr); |
45 | void kvm_inject_undefined(struct kvm_vcpu *vcpu); | 45 | void kvm_inject_undefined(struct kvm_vcpu *vcpu); |
46 | void kvm_inject_vabt(struct kvm_vcpu *vcpu); | ||
46 | void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr); | 47 | void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr); |
47 | void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr); | 48 | void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr); |
48 | 49 | ||
diff --git a/arch/arm/kvm/emulate.c b/arch/arm/kvm/emulate.c index ff9acd1b027b..0064b86a2c87 100644 --- a/arch/arm/kvm/emulate.c +++ b/arch/arm/kvm/emulate.c | |||
@@ -303,3 +303,15 @@ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr) | |||
303 | { | 303 | { |
304 | inject_abt(vcpu, true, addr); | 304 | inject_abt(vcpu, true, addr); |
305 | } | 305 | } |
306 | |||
307 | /** | ||
308 | * kvm_inject_vabt - inject an async abort / SError into the guest | ||
309 | * @vcpu: The VCPU to receive the exception | ||
310 | * | ||
311 | * It is assumed that this code is called from the VCPU thread and that the | ||
312 | * VCPU therefore is not currently executing guest code. | ||
313 | */ | ||
314 | void kvm_inject_vabt(struct kvm_vcpu *vcpu) | ||
315 | { | ||
316 | vcpu_set_hcr(vcpu, vcpu_get_hcr(vcpu) | HCR_VA); | ||
317 | } | ||