@@ -587,13 +587,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
/*
* Re-check atomic conditions
*/
- if (unlikely(!__this_cpu_read(kvm_arm_hardware_enabled))) {
- /* cpu has been torn down */
- ret = 0;
- run->exit_reason = KVM_EXIT_FAIL_ENTRY;
- run->fail_entry.hardware_entry_failure_reason
- = (u64)-ENOEXEC;
- } else if (signal_pending(current)) {
+ if (signal_pending(current)) {
ret = -EINTR;
run->exit_reason = KVM_EXIT_INTR;
}
@@ -22,6 +22,7 @@
#define ARM_EXCEPTION_IRQ 0
#define ARM_EXCEPTION_TRAP 1
+#define ARM_EXCEPTION_HYP_GONE 2
#define KVM_ARM64_DEBUG_DIRTY_SHIFT 0
#define KVM_ARM64_DEBUG_DIRTY (1 << KVM_ARM64_DEBUG_DIRTY_SHIFT)
@@ -34,6 +34,11 @@
*/
#define HVC_SET_VECTORS 1
+/*
+ * HVC_KEXEC_RESTART
+ */
+#define HVC_KEXEC_RESTART 2
+
#define BOOT_CPU_MODE_EL1 (0xe11)
#define BOOT_CPU_MODE_EL2 (0xe12)
@@ -41,10 +41,7 @@ ENTRY(__cpu_soft_restart)
isb
cbz x0, 1f // el2_switch?
- mov x0, x1 // entry
- mov x1, x2 // arg0
- mov x2, x3 // arg1
- mov x3, x4 // arg2
+ mov x0, #HVC_KEXEC_RESTART
hvc #0 // no return
1: mov x18, x1 // entry
@@ -22,7 +22,8 @@
#include <linux/irqchip/arm-gic-v3.h>
#include <asm/assembler.h>
-#include <asm/kvm_arm.h>
+#include <asm/esr.h>
+#include <asm/kvm_asm.h>
#include <asm/ptrace.h>
#include <asm/virt.h>
@@ -70,7 +71,16 @@ el1_sync:
msr vbar_el2, x1
b 9f
-2: do_el2_call
+2: cmp x0, #HVC_KEXEC_RESTART
+ b.eq 3f
+ mov x0, #ARM_EXCEPTION_HYP_GONE
+ b 9f
+
+3: mov lr, x1
+ mov x0, x2
+ mov x1, x3
+ mov x2, x4
+ blr lr
9: eret
ENDPROC(el1_sync)
@@ -186,6 +186,10 @@ int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
exit_handler = kvm_get_exit_handler(vcpu);
return exit_handler(vcpu, run);
+ case ARM_EXCEPTION_HYP_GONE:
+ /* due to kexec reboot */
+ run->exit_reason = KVM_EXIT_SHUTDOWN;
+ return 0;
default:
kvm_pr_unimpl("Unsupported exception type: %d",
exception_index);