From patchwork Mon May 31 19:40:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 103319 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4VJf9H2016273 for ; Mon, 31 May 2010 19:41:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757220Ab0EaTlB (ORCPT ); Mon, 31 May 2010 15:41:01 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:47405 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757218Ab0EaTlA (ORCPT ); Mon, 31 May 2010 15:41:00 -0400 Received: by mail-ww0-f46.google.com with SMTP id 28so1490631wwb.19 for ; Mon, 31 May 2010 12:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=1ww8fJ9hGUOtSUQHcVIYFW8F3pc+TjwETTXphR7VbjU=; b=AmaOJCQH3CHLc7DjG3WFsEb2Y6Ix8wgUqW9UpzGGvYk+pu1aRhtWRFUIR0zocVUXAH QWIURHi2wygUW/hrpzebsvgycQ0MPVyQH188OjHFj5PmcMnD2EdDy9xzOaTRyzMPwwJ4 gBCd+Fb8BpDP+ZfIf7GI91d+fHPfFGGD2qYd0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=kQf8gJ7k3Cbect7BEK0B2ldTaILrMYDW45xBDUdf94lT9rNrmCTPLmUgEjCtdz0fGc XvpvkcF2T/TuIYYOdOJM5/ClxLuIoLzleRbbjQ/3PUO1Ladr0nsFnGRU/2aiPRLRmOgw u1Qk0fKySWz1qJ5W/u8xxuJARcddTjSlCzHHI= Received: by 10.227.157.69 with SMTP id a5mr4819173wbx.146.1275334859577; Mon, 31 May 2010 12:40:59 -0700 (PDT) Received: from localhost ([41.237.144.24]) by mx.google.com with ESMTPS id h1sm2225486wee.19.2010.05.31.12.40.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 31 May 2010 12:40:59 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH][RESEND] VMX: Properly return error to userspace on vmentry failure Date: Mon, 31 May 2010 22:40:54 +0300 Message-Id: <1275334854-6134-1-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.7.0.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 31 May 2010 19:41:10 +0000 (UTC) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 0e561a5..1b6a3be 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3668,6 +3668,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; + return 0; + } + if (unlikely(vmx->fail)) { vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY; vcpu->run->fail_entry.hardware_entry_failure_reason