diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2016-09-06 09:02:13 -0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2016-09-08 06:53:00 -0400 |
commit | 5d7bcf7d644a88183fb34fca12ad6ea40a8db7ab (patch) | |
tree | 48969d8e6e14a595e1bf3e8034ac122b1d7fff1d | |
parent | c39798f471259dacf56df6bfb2bd071dfe074486 (diff) |
arm: KVM: Inject a Virtual Abort if it was pending
If we have caught an Abort whilst exiting, we've tagged the
exit code with the pending information. In that case, let's
re-inject the error into the guest, after having adjusted
the PC if required.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
-rw-r--r-- | arch/arm/kvm/handle_exit.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c index 863fdf42668e..4eacb5cb60e8 100644 --- a/arch/arm/kvm/handle_exit.c +++ b/arch/arm/kvm/handle_exit.c | |||
@@ -144,6 +144,25 @@ int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run, | |||
144 | { | 144 | { |
145 | exit_handle_fn exit_handler; | 145 | exit_handle_fn exit_handler; |
146 | 146 | ||
147 | if (ARM_ABORT_PENDING(exception_index)) { | ||
148 | u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu); | ||
149 | |||
150 | /* | ||
151 | * HVC/SMC already have an adjusted PC, which we need | ||
152 | * to correct in order to return to after having | ||
153 | * injected the abort. | ||
154 | */ | ||
155 | if (hsr_ec == HSR_EC_HVC || hsr_ec == HSR_EC_SMC) { | ||
156 | u32 adj = kvm_vcpu_trap_il_is32bit(vcpu) ? 4 : 2; | ||
157 | *vcpu_pc(vcpu) -= adj; | ||
158 | } | ||
159 | |||
160 | kvm_inject_vabt(vcpu); | ||
161 | return 1; | ||
162 | } | ||
163 | |||
164 | exception_index = ARM_EXCEPTION_CODE(exception_index); | ||
165 | |||
147 | switch (exception_index) { | 166 | switch (exception_index) { |
148 | case ARM_EXCEPTION_IRQ: | 167 | case ARM_EXCEPTION_IRQ: |
149 | return 1; | 168 | return 1; |