aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorMohammed Gamal <m.gamal005@gmail.com>2010-05-31 15:40:54 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 03:39:24 -0400
commit5120702e732ed72c7055f511f8dd01de36424569 (patch)
tree0294b9e9c71a504d30e50e539e9bb1661e7ac762 /arch/x86/kvm/vmx.c
parentb66d80006e415ee083e59c9429911eab78047f8f (diff)
KVM: VMX: Properly return error to userspace on vmentry failure
The vmexit handler returns KVM_EXIT_UNKNOWN since there is no handler for vmentry failures. This intercepts vmentry failures and returns KVM_FAIL_ENTRY to userspace instead. Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index e71c731433ee..8c9085d44c37 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3665,6 +3665,13 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
3665 if (enable_ept && is_paging(vcpu)) 3665 if (enable_ept && is_paging(vcpu))
3666 vcpu->arch.cr3 = vmcs_readl(GUEST_CR3); 3666 vcpu->arch.cr3 = vmcs_readl(GUEST_CR3);
3667 3667
3668 if (exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) {
3669 vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
3670 vcpu->run->fail_entry.hardware_entry_failure_reason
3671 = exit_reason;
3672 return 0;
3673 }
3674
3668 if (unlikely(vmx->fail)) { 3675 if (unlikely(vmx->fail)) {
3669 vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY; 3676 vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
3670 vcpu->run->fail_entry.hardware_entry_failure_reason 3677 vcpu->run->fail_entry.hardware_entry_failure_reason