diff options
author | Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> | 2012-10-17 01:46:52 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-10-18 10:30:29 -0400 |
commit | b9bf6882c1f9451ce1e80aaed32107673a735613 (patch) | |
tree | b9861c5f037f1a0ed9c803a8de5e7c310a5d6a32 | |
parent | 471842ec49726bc589322e8498e6620b4d723c74 (diff) |
KVM: VMX: report internal error for the unhandleable event
VM exits during Event Delivery is really unexpected if it is not caused
by Exceptions/EPT-VIOLATION/TASK_SWITCH, we'd better to report an internal
and freeze the guest, the VMM has the chance to check the guest
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/vmx.c | 19 | ||||
-rw-r--r-- | include/linux/kvm.h | 8 |
2 files changed, 21 insertions, 6 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ad6b1dd06f8b..b8a0841dfe7d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -5979,13 +5979,24 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu) | |||
5979 | return 0; | 5979 | return 0; |
5980 | } | 5980 | } |
5981 | 5981 | ||
5982 | /* | ||
5983 | * Note: | ||
5984 | * Do not try to fix EXIT_REASON_EPT_MISCONFIG if it caused by | ||
5985 | * delivery event since it indicates guest is accessing MMIO. | ||
5986 | * The vm-exit can be triggered again after return to guest that | ||
5987 | * will cause infinite loop. | ||
5988 | */ | ||
5982 | if ((vectoring_info & VECTORING_INFO_VALID_MASK) && | 5989 | if ((vectoring_info & VECTORING_INFO_VALID_MASK) && |
5983 | (exit_reason != EXIT_REASON_EXCEPTION_NMI && | 5990 | (exit_reason != EXIT_REASON_EXCEPTION_NMI && |
5984 | exit_reason != EXIT_REASON_EPT_VIOLATION && | 5991 | exit_reason != EXIT_REASON_EPT_VIOLATION && |
5985 | exit_reason != EXIT_REASON_TASK_SWITCH)) | 5992 | exit_reason != EXIT_REASON_TASK_SWITCH)) { |
5986 | printk(KERN_WARNING "%s: unexpected, valid vectoring info " | 5993 | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; |
5987 | "(0x%x) and exit reason is 0x%x\n", | 5994 | vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV; |
5988 | __func__, vectoring_info, exit_reason); | 5995 | vcpu->run->internal.ndata = 2; |
5996 | vcpu->run->internal.data[0] = vectoring_info; | ||
5997 | vcpu->run->internal.data[1] = exit_reason; | ||
5998 | return 0; | ||
5999 | } | ||
5989 | 6000 | ||
5990 | if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked && | 6001 | if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked && |
5991 | !(is_guest_mode(vcpu) && nested_cpu_has_virtual_nmis( | 6002 | !(is_guest_mode(vcpu) && nested_cpu_has_virtual_nmis( |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 65ad5c624c70..494a84c37c3e 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -170,8 +170,12 @@ struct kvm_pit_config { | |||
170 | #define KVM_EXIT_WATCHDOG 21 | 170 | #define KVM_EXIT_WATCHDOG 21 |
171 | 171 | ||
172 | /* For KVM_EXIT_INTERNAL_ERROR */ | 172 | /* For KVM_EXIT_INTERNAL_ERROR */ |
173 | #define KVM_INTERNAL_ERROR_EMULATION 1 | 173 | /* Emulate instruction failed. */ |
174 | #define KVM_INTERNAL_ERROR_SIMUL_EX 2 | 174 | #define KVM_INTERNAL_ERROR_EMULATION 1 |
175 | /* Encounter unexpected simultaneous exceptions. */ | ||
176 | #define KVM_INTERNAL_ERROR_SIMUL_EX 2 | ||
177 | /* Encounter unexpected vm-exit due to delivery event. */ | ||
178 | #define KVM_INTERNAL_ERROR_DELIVERY_EV 3 | ||
175 | 179 | ||
176 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ | 180 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ |
177 | struct kvm_run { | 181 | struct kvm_run { |