aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2016-04-27 12:47:04 -0400
committerWill Deacon <will.deacon@arm.com>2016-04-28 07:05:46 -0400
commitc94b0cf28281d483c8b43b4874fcb7ab14ade1b1 (patch)
tree9a1b36f51a6dc5d2886f36454a1e3ac63eae640f /arch/arm64/kvm
parentad72e59ff2bad55f6b9e7ac1fe5d824831ea2550 (diff)
arm64: hyp/kvm: Make hyp-stub reject kvm_call_hyp()
A later patch implements kvm_arch_hardware_disable(), to remove kvm from el2, and re-instate the hyp-stub. This can happen while guests are running, particularly when kvm_reboot() calls kvm_arch_hardware_disable() on each cpu. This can interrupt a guest, remove kvm, then allow the guest to be scheduled again. This causes kvm_call_hyp() to be run against the hyp-stub. Change the hyp-stub to return a new exception type when this happens, and add code to kvm's handle_exit() to tell userspace we failed to enter the guest. Signed-off-by: James Morse <james.morse@arm.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r--arch/arm64/kvm/handle_exit.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
index eba89e42f0ed..3246c4aba5b1 100644
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@ -186,6 +186,13 @@ int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
186 exit_handler = kvm_get_exit_handler(vcpu); 186 exit_handler = kvm_get_exit_handler(vcpu);
187 187
188 return exit_handler(vcpu, run); 188 return exit_handler(vcpu, run);
189 case ARM_EXCEPTION_HYP_GONE:
190 /*
191 * EL2 has been reset to the hyp-stub. This happens when a guest
192 * is pre-empted by kvm_reboot()'s shutdown call.
193 */
194 run->exit_reason = KVM_EXIT_FAIL_ENTRY;
195 return 0;
189 default: 196 default:
190 kvm_pr_unimpl("Unsupported exception type: %d", 197 kvm_pr_unimpl("Unsupported exception type: %d",
191 exception_index); 198 exception_index);