public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] VMX: Properly return error to userspace on vmentry failure
@ 2010-05-23 22:01 Mohammed Gamal
  2010-05-23 22:01 ` [PATCH 2/2] VMX: Add constant for invalid guest state exit reason Mohammed Gamal
  2010-05-25 11:45 ` [PATCH 1/2] VMX: Properly return error to userspace on vmentry failure Avi Kivity
  0 siblings, 2 replies; 7+ messages in thread
From: Mohammed Gamal @ 2010-05-23 22:01 UTC (permalink / raw)
  To: avi; +Cc: mtosatti, kvm, Mohammed Gamal

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>
---
 arch/x86/kvm/vmx.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 99ae513..4edcffb 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)
 	if (enable_ept && is_paging(vcpu))
 		vcpu->arch.cr3 = vmcs_readl(GUEST_CR3);
 
+	if (exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) {
+		vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
+		vcpu->run->fail_entry.hardware_entry_failure_reason
+			= exit_reason & ~VMX_EXIT_REASONS_FAILED_VMENTRY;
+		return 0;
+	}
+
 	if (unlikely(vmx->fail)) {
 		vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
 		vcpu->run->fail_entry.hardware_entry_failure_reason
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-05-25 12:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-23 22:01 [PATCH 1/2] VMX: Properly return error to userspace on vmentry failure Mohammed Gamal
2010-05-23 22:01 ` [PATCH 2/2] VMX: Add constant for invalid guest state exit reason Mohammed Gamal
2010-05-25 11:46   ` Avi Kivity
2010-05-25 11:45 ` [PATCH 1/2] VMX: Properly return error to userspace on vmentry failure Avi Kivity
2010-05-25 12:01   ` Mohammed Gamal
2010-05-25 12:10     ` Avi Kivity
2010-05-25 12:15       ` Mohammed Gamal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox