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

[Xen-devel] [PATCH] Enable RDWRGSFS feature support for HVM guests


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Yang, Wei Y" <wei.y.yang@xxxxxxxxx>
  • Date: Tue, 14 Jun 2011 22:43:32 +0800
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Delivery-date: Tue, 14 Jun 2011 07:44:32 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcwqknbozyHaBmbNQ8uwJBWpthaSzgACCtBgAACjcoAAAQx1YA==
  • Thread-topic: [PATCH] Enable RDWRGSFS feature support for HVM guests

This patch enables RDWRGSFS feature to HVM guests.

Write/read FS/GS base instructions enable user level code to
read/write FS & GS segment base registers for thread local storage.

 Signed-off-by: Yang, Wei <wei.y.yang@xxxxxxxxx>

---
 tools/libxc/xc_cpuid_x86.c    |    3 ++-
 xen/include/asm-x86/hvm/hvm.h |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)


 diff -r f4a47275aebf tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c        Tue Jun 14 13:13:18 2011 +0100
+++ b/tools/libxc/xc_cpuid_x86.c        Tue Jun 14 22:09:24 2011 +0800
@@ -356,7 +356,8 @@ static void xc_cpuid_hvm_policy(
     case 0x00000007: /* Intel-defined CPU features */
         if ( input[1] == 0 ) {
             regs[1] &= (bitmaskof(X86_FEATURE_SMEP) |
-                        bitmaskof(X86_FEATURE_ERMS));
+                        bitmaskof(X86_FEATURE_ERMS) |
+                        bitmaskof(X86_FEATURE_FSGSBASE));
         } else
             regs[1] = 0;
         regs[0] = regs[2] = regs[3] = 0;
diff -r f4a47275aebf xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Tue Jun 14 13:13:18 2011 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h     Tue Jun 14 22:09:24 2011 +0800
@@ -324,6 +324,7 @@ static inline int hvm_do_pmu_interrupt(s
         X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE |       \
         X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT |           \
         (cpu_has_smep ? X86_CR4_SMEP : 0) |             \
+        (cpu_has_fsgsbase ? X86_CR4_FSGSBASE : 0) |     \
         (xsave_enabled(_v) ? X86_CR4_OSXSAVE : 0))))
 
 /* These exceptions must always be intercepted. */

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


 


Rackspace

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