From patchwork Sun May 23 22:01:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 101780 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 o4NM1ein002157 for ; Sun, 23 May 2010 22:01:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755394Ab0EWWBW (ORCPT ); Sun, 23 May 2010 18:01:22 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:63780 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755374Ab0EWWBR (ORCPT ); Sun, 23 May 2010 18:01:17 -0400 Received: by wwe15 with SMTP id 15so116116wwe.19 for ; Sun, 23 May 2010 15:01:16 -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=V/PI80nufFxpZqtiqIKYTljMlg/a/ZPmlhm2WaIB2EA=; b=RsojgSNgWG5Bc7qWe9MrT6a2PbuH6qcm9Rz6zhU+UY8tMmEm+iD1TghEPbx1ZOGROJ KRa5fsy8Wl5/dgZezDw9o6uVg86tVyLYcWW446Sl21CwJNQhbQ1KTx08aM7WU6Bowjim B5nUDJqdbSDhAKMl4aCsjNuTCkqSb3UXYYKJs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=eAho45ITDl8SkWovgFHl991cQfgTq3JwOc0wAU5WuEUxIxqvI8gVeRA8pnySaqXNCu NW66VMM0snm59YmoYZbCQPdQKRWK8o78mA4VWosQGPZDdoGtHCqL5B63W1JFGGOeaKpT vx0r2Qp5GtdMlZdD3GLnco3qBCh+Uqb24qBvg= Received: by 10.227.155.213 with SMTP id t21mr4553425wbw.66.1274652076159; Sun, 23 May 2010 15:01:16 -0700 (PDT) Received: from localhost ([41.239.65.235]) by mx.google.com with ESMTPS id t20sm26519640wbc.22.2010.05.23.15.01.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 23 May 2010 15:01:15 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH 1/2] VMX: Properly return error to userspace on vmentry failure Date: Mon, 24 May 2010 01:01:03 +0300 Message-Id: <1274652064-8267-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]); Sun, 23 May 2010 22:01:40 +0000 (UTC) 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