kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joseph Cihula <joseph.cihula@intel.com>
To: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org
Cc: shane.wang@intel.com, joseph.cihula@intel.com
Subject: [PATCH] kvm: fix detection of BIOS disabling VMX
Date: Tue, 08 Feb 2011 11:45:56 -0800	[thread overview]
Message-ID: <4D519D74.1010701@intel.com> (raw)

This patch fixes the logic used to detect whether BIOS has disabled VMX.

Signed-off-by:  Joseph Cihula <joseph.cihula@intel.com>


diff -uprN linux-2.6.38-rc3/arch/x86/kvm/vmx.c
linux-2.6.38-rc3-patched/arch/x86/kvm/vmx.c
--- linux-2.6.38-rc3/arch/x86/kvm/vmx.c	2011-01-31 19:05:49.000000000 -0800
+++ linux-2.6.38-rc3-patched/arch/x86/kvm/vmx.c	2011-02-08
09:21:22.639995662 -0800
@@ -1333,19 +1333,25 @@ static __init int vmx_disabled_by_bios(v

 	rdmsrl(MSR_IA32_FEATURE_CONTROL, msr);
 	if (msr & FEATURE_CONTROL_LOCKED) {
+		/* launched w/ TXT and VMX disabled */
 		if (!(msr & FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX)
 			&& tboot_enabled())
 			return 1;
+		/* launched w/o TXT and VMX only enabled w/ TXT */
 		if (!(msr & FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX)
+			&& (msr & FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX)
 			&& !tboot_enabled()) {
 			printk(KERN_WARNING "kvm: disable TXT in the BIOS or "
-				" activate TXT before enabling KVM\n");
+				"activate TXT before enabling KVM\n");
 			return 1;
 		}
+		/* launched w/o TXT and VMX disabled */
+		if (!(msr & FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX)
+			&& !tboot_enabled())
+			return 1;
 	}

 	return 0;
-	/* locked but not enabled */
 }

 static void kvm_cpu_vmxon(u64 addr)

             reply	other threads:[~2011-02-08 19:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08 19:45 Joseph Cihula [this message]
2011-02-10 10:01 ` [PATCH] kvm: fix detection of BIOS disabling VMX Avi Kivity
2011-02-19  0:02   ` Cihula, Joseph
2011-02-20  9:00     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D519D74.1010701@intel.com \
    --to=joseph.cihula@intel.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=shane.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).