[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] vmx: Better diagnostic messages when VMXON might have failed due to



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1212400555 -3600
# Node ID a4775034ef83946803eb6a61e0af33fb6971123f
# Parent  0216f0d07efed1bebab5b742e72756236363d8cc
vmx: Better diagnostic messages when VMXON might have failed due to
bad setting of the IA32_FEATURE_CONTROL MSR.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmcs.c       |   29 ++++++++++++++++++++++++-----
 xen/include/asm-x86/hvm/vmx/vmx.h |    2 +-
 2 files changed, 25 insertions(+), 6 deletions(-)

diff -r 0216f0d07efe -r a4775034ef83 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Mon Jun 02 10:04:19 2008 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Mon Jun 02 10:55:55 2008 +0100
@@ -267,7 +267,7 @@ int vmx_cpu_up(void)
 int vmx_cpu_up(void)
 {
     u32 eax, edx;
-    int cpu = smp_processor_id();
+    int bios_locked, cpu = smp_processor_id();
     u64 cr0, vmx_cr0_fixed0, vmx_cr0_fixed1;
 
     BUG_ON(!(read_cr4() & X86_CR4_VMXE));
@@ -288,7 +288,8 @@ int vmx_cpu_up(void)
 
     rdmsr(IA32_FEATURE_CONTROL_MSR, eax, edx);
 
-    if ( eax & IA32_FEATURE_CONTROL_MSR_LOCK )
+    bios_locked = !!(eax & IA32_FEATURE_CONTROL_MSR_LOCK);
+    if ( bios_locked )
     {
         if ( !(eax & (IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_OUTSIDE_SMX |
                       IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_INSIDE_SMX)) )
@@ -320,10 +321,28 @@ int vmx_cpu_up(void)
         }
     }
 
-    if ( __vmxon(virt_to_maddr(this_cpu(host_vmcs))) )
-    {
-        printk("CPU%d: VMXON failed\n", cpu);
+    switch ( __vmxon(virt_to_maddr(this_cpu(host_vmcs))) )
+    {
+    case -2: /* #UD or #GP */
+        if ( bios_locked &&
+             test_bit(X86_FEATURE_SMXE, &boot_cpu_data.x86_capability) &&
+             (!(eax & IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_OUTSIDE_SMX) ||
+              !(eax & IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_INSIDE_SMX)) )
+        {
+            printk("CPU%d: VMXON failed: perhaps because of TXT settings "
+                   "in your BIOS configuration?\n", cpu);
+            printk(" --> Disable TXT in your BIOS unless using a secure "
+                   "bootloader.\n");
+            return 0;
+        }
+        /* fall through */
+    case -1: /* CF==1 or ZF==1 */
+        printk("CPU%d: unexpected VMXON failure\n", cpu);
         return 0;
+    case 0: /* success */
+        break;
+    default:
+        BUG();
     }
 
     ept_sync_all();
diff -r 0216f0d07efe -r a4775034ef83 xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h Mon Jun 02 10:04:19 2008 +0100
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h Mon Jun 02 10:55:55 2008 +0100
@@ -334,7 +334,7 @@ static inline int __vmxon(u64 addr)
         "   setna %b0 ; neg %0\n" /* CF==1 or ZF==1 --> rc = -1 */
         "2:\n"
         ".section .fixup,\"ax\"\n"
-        "3: not %0 ; jmp 2b\n"    /* #UD --> rc = -1 */
+        "3: sub $2,%0 ; jmp 2b\n"    /* #UD or #GP --> rc = -2 */
         ".previous\n"
         ".section __ex_table,\"a\"\n"
         "   "__FIXUP_ALIGN"\n"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.