WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] vmx: Do not set bit 1 of FEATURE_CONTROL

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] vmx: Do not set bit 1 of FEATURE_CONTROL MSR if SMX is not supported
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Dec 2007 12:40:16 -0800
Delivery-date: Wed, 19 Dec 2007 12:41:26 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1198079461 0
# Node ID 35ab2bb25e0972f8843db2b52636d5a35930bf39
# Parent  643ab64d12d5ce57e5f1e08f85ab4bb7fbc136ae
vmx: Do not set bit 1 of FEATURE_CONTROL MSR if SMX is not supported
by the CPU. Also generally beef up robustness of VMXON instruction.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmcs.c       |   14 ++++----------
 xen/arch/x86/traps.c              |    6 ++++++
 xen/include/asm-x86/hvm/vmx/vmx.h |   36 ++++++++++++++++++++++--------------
 3 files changed, 32 insertions(+), 24 deletions(-)

diff -r 643ab64d12d5 -r 35ab2bb25e09 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Wed Dec 19 15:05:15 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Wed Dec 19 15:51:01 2007 +0000
@@ -274,17 +274,11 @@ int vmx_cpu_up(void)
     }
     else
     {
-        eax = (IA32_FEATURE_CONTROL_MSR_LOCK |
-               IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_OUTSIDE_SMX |
-               IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_INSIDE_SMX);
+        eax  = IA32_FEATURE_CONTROL_MSR_LOCK;
+        eax |= IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_OUTSIDE_SMX;
+        if ( test_bit(X86_FEATURE_SMXE, &boot_cpu_data.x86_capability) )
+            eax |= IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_INSIDE_SMX;
         wrmsr(IA32_FEATURE_CONTROL_MSR, eax, 0);
-    }
-
-    if ( !tboot_in_measured_env() &&
-         !(eax & IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_OUTSIDE_SMX) )
-    {
-        printk("VMX only allowed in SMX but SMX not active.\n");
-        return 0;
     }
 
     vmx_init_vmcs_config();
diff -r 643ab64d12d5 -r 35ab2bb25e09 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Wed Dec 19 15:05:15 2007 +0000
+++ b/xen/arch/x86/traps.c      Wed Dec 19 15:51:01 2007 +0000
@@ -719,6 +719,7 @@ asmlinkage void do_invalid_op(struct cpu
     struct bug_frame bug;
     struct bug_frame_str bug_str;
     char *filename, *predicate, *eip = (char *)regs->eip;
+    unsigned long fixup;
     int id, lineno;
 
     DEBUGGER_trap_entry(TRAP_invalid_op, regs);
@@ -789,6 +790,11 @@ asmlinkage void do_invalid_op(struct cpu
           predicate, filename, lineno);
 
  die:
+    if ( (fixup = search_exception_table(regs->eip)) != 0 )
+    {
+        regs->eip = fixup;
+        return;
+    }
     DEBUGGER_trap_fatal(TRAP_invalid_op, regs);
     show_execution_state(regs);
     panic("FATAL TRAP: vector = %d (invalid opcode)\n", TRAP_invalid_op);
diff -r 643ab64d12d5 -r 35ab2bb25e09 xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h Wed Dec 19 15:05:15 2007 +0000
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h Wed Dec 19 15:51:01 2007 +0000
@@ -240,23 +240,31 @@ static inline void __vm_clear_bit(unsign
     __vmwrite(field, __vmread(field) & ~(1UL << bit));
 }
 
-static inline void __vmxoff (void)
-{
-    __asm__ __volatile__ ( VMXOFF_OPCODE
-                           ::: "memory");
-}
-
-static inline int __vmxon (u64 addr)
+static inline void __vmxoff(void)
+{
+    asm volatile (
+        VMXOFF_OPCODE
+        : : : "memory" );
+}
+
+static inline int __vmxon(u64 addr)
 {
     int rc;
 
-    __asm__ __volatile__ ( VMXON_OPCODE
-                           MODRM_EAX_06
-                           /* CF==1 or ZF==1 --> rc = -1 */
-                           "setna %b0 ; neg %0"
-                           : "=q" (rc)
-                           : "0" (0), "a" (&addr)
-                           : "memory");
+    asm volatile ( 
+        "1: " VMXON_OPCODE MODRM_EAX_06 "\n"
+        "   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 */
+        ".previous\n"
+        ".section __ex_table,\"a\"\n"
+        "   "__FIXUP_ALIGN"\n"
+        "   "__FIXUP_WORD" 1b,3b\n"
+        ".previous\n"
+        : "=q" (rc)
+        : "0" (0), "a" (&addr)
+        : "memory");
 
     return rc;
 }

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] vmx: Do not set bit 1 of FEATURE_CONTROL MSR if SMX is not supported, Xen patchbot-unstable <=