diff options
-rw-r--r-- | drivers/kvm/svm.c | 15 | ||||
-rw-r--r-- | include/linux/kvm.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 717aabb012cc..9c70ff65e6b7 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -502,6 +502,7 @@ static void init_vmcb(struct vmcb *vmcb) | |||
502 | (1ULL << INTERCEPT_IOIO_PROT) | | 502 | (1ULL << INTERCEPT_IOIO_PROT) | |
503 | (1ULL << INTERCEPT_MSR_PROT) | | 503 | (1ULL << INTERCEPT_MSR_PROT) | |
504 | (1ULL << INTERCEPT_TASK_SWITCH) | | 504 | (1ULL << INTERCEPT_TASK_SWITCH) | |
505 | (1ULL << INTERCEPT_SHUTDOWN) | | ||
505 | (1ULL << INTERCEPT_VMRUN) | | 506 | (1ULL << INTERCEPT_VMRUN) | |
506 | (1ULL << INTERCEPT_VMMCALL) | | 507 | (1ULL << INTERCEPT_VMMCALL) | |
507 | (1ULL << INTERCEPT_VMLOAD) | | 508 | (1ULL << INTERCEPT_VMLOAD) | |
@@ -892,6 +893,19 @@ static int pf_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
892 | return 0; | 893 | return 0; |
893 | } | 894 | } |
894 | 895 | ||
896 | static int shutdown_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | ||
897 | { | ||
898 | /* | ||
899 | * VMCB is undefined after a SHUTDOWN intercept | ||
900 | * so reinitialize it. | ||
901 | */ | ||
902 | memset(vcpu->svm->vmcb, 0, PAGE_SIZE); | ||
903 | init_vmcb(vcpu->svm->vmcb); | ||
904 | |||
905 | kvm_run->exit_reason = KVM_EXIT_SHUTDOWN; | ||
906 | return 0; | ||
907 | } | ||
908 | |||
895 | static int io_get_override(struct kvm_vcpu *vcpu, | 909 | static int io_get_override(struct kvm_vcpu *vcpu, |
896 | struct vmcb_seg **seg, | 910 | struct vmcb_seg **seg, |
897 | int *addr_override) | 911 | int *addr_override) |
@@ -1249,6 +1263,7 @@ static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
1249 | [SVM_EXIT_IOIO] = io_interception, | 1263 | [SVM_EXIT_IOIO] = io_interception, |
1250 | [SVM_EXIT_MSR] = msr_interception, | 1264 | [SVM_EXIT_MSR] = msr_interception, |
1251 | [SVM_EXIT_TASK_SWITCH] = task_switch_interception, | 1265 | [SVM_EXIT_TASK_SWITCH] = task_switch_interception, |
1266 | [SVM_EXIT_SHUTDOWN] = shutdown_interception, | ||
1252 | [SVM_EXIT_VMRUN] = invalid_op_interception, | 1267 | [SVM_EXIT_VMRUN] = invalid_op_interception, |
1253 | [SVM_EXIT_VMMCALL] = invalid_op_interception, | 1268 | [SVM_EXIT_VMMCALL] = invalid_op_interception, |
1254 | [SVM_EXIT_VMLOAD] = invalid_op_interception, | 1269 | [SVM_EXIT_VMLOAD] = invalid_op_interception, |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index bc8b4616bad7..1be148f0fce4 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -46,6 +46,7 @@ enum kvm_exit_reason { | |||
46 | KVM_EXIT_HLT = 5, | 46 | KVM_EXIT_HLT = 5, |
47 | KVM_EXIT_MMIO = 6, | 47 | KVM_EXIT_MMIO = 6, |
48 | KVM_EXIT_IRQ_WINDOW_OPEN = 7, | 48 | KVM_EXIT_IRQ_WINDOW_OPEN = 7, |
49 | KVM_EXIT_SHUTDOWN = 8, | ||
49 | }; | 50 | }; |
50 | 51 | ||
51 | /* for KVM_RUN */ | 52 | /* for KVM_RUN */ |