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

[Xen-changelog] [xen-unstable] x86: Mask X86_FEATURE_XSAVE in cpuid leaf 1, ecx, as we don't allow



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1236588859 0
# Node ID 9ed53e60211954c2a04dfdcae207819276b2cca0
# Parent  5a981686bbf85f686bbf9f1e5f77e7da72200f8a
x86: Mask X86_FEATURE_XSAVE in cpuid leaf 1, ecx, as we don't allow
guests to use it (by setting cr4.OSXSAVE).

This prevents crashes in pvops kernels, as new versions of Linux
try to use this feature.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/libxc/xc_cpufeature.h      |    1 +
 tools/libxc/xc_cpuid_x86.c       |    1 +
 xen/arch/x86/traps.c             |    1 +
 xen/include/asm-x86/cpufeature.h |    1 +
 4 files changed, 4 insertions(+)

diff -r 5a981686bbf8 -r 9ed53e602119 tools/libxc/xc_cpufeature.h
--- a/tools/libxc/xc_cpufeature.h       Mon Mar 09 08:43:11 2009 +0000
+++ b/tools/libxc/xc_cpufeature.h       Mon Mar 09 08:54:19 2009 +0000
@@ -83,6 +83,7 @@
 #define X86_FEATURE_SSE4_1     (4*32+19) /* Streaming SIMD Extensions 4.1 */
 #define X86_FEATURE_SSE4_2     (4*32+20) /* Streaming SIMD Extensions 4.2 */
 #define X86_FEATURE_POPCNT     (4*32+23) /* POPCNT instruction */
+#define X86_FEATURE_XSAVE      (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
 #define X86_FEATURE_HYPERVISOR (4*32+31) /* Running under some hypervisor */
 
 /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
diff -r 5a981686bbf8 -r 9ed53e602119 tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c        Mon Mar 09 08:43:11 2009 +0000
+++ b/tools/libxc/xc_cpuid_x86.c        Mon Mar 09 08:54:19 2009 +0000
@@ -311,6 +311,7 @@ static void xc_cpuid_pv_policy(
         clear_bit(X86_FEATURE_XTPR, regs[2]);
         clear_bit(X86_FEATURE_PDCM, regs[2]);
         clear_bit(X86_FEATURE_DCA, regs[2]);
+        clear_bit(X86_FEATURE_XSAVE, regs[2]);
         set_bit(X86_FEATURE_HYPERVISOR, regs[2]);
         break;
     case 0x80000001:
diff -r 5a981686bbf8 -r 9ed53e602119 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Mon Mar 09 08:43:11 2009 +0000
+++ b/xen/arch/x86/traps.c      Mon Mar 09 08:54:19 2009 +0000
@@ -757,6 +757,7 @@ static void pv_cpuid(struct cpu_user_reg
         __clear_bit(X86_FEATURE_XTPR % 32, &c);
         __clear_bit(X86_FEATURE_PDCM % 32, &c);
         __clear_bit(X86_FEATURE_DCA % 32, &c);
+        __clear_bit(X86_FEATURE_XSAVE % 32, &c);
         if ( !cpu_has_apic )
            __clear_bit(X86_FEATURE_X2APIC % 32, &c);
         __set_bit(X86_FEATURE_HYPERVISOR % 32, &c);
diff -r 5a981686bbf8 -r 9ed53e602119 xen/include/asm-x86/cpufeature.h
--- a/xen/include/asm-x86/cpufeature.h  Mon Mar 09 08:43:11 2009 +0000
+++ b/xen/include/asm-x86/cpufeature.h  Mon Mar 09 08:54:19 2009 +0000
@@ -95,6 +95,7 @@
 #define X86_FEATURE_SSE4_2     (4*32+20) /* Streaming SIMD Extensions 4.2 */
 #define X86_FEATURE_X2APIC     (4*32+21) /* Extended xAPIC */
 #define X86_FEATURE_POPCNT     (4*32+23) /* POPCNT instruction */
+#define X86_FEATURE_XSAVE      (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
 #define X86_FEATURE_HYPERVISOR (4*32+31) /* Running under some hypervisor */
 
 /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */

_______________________________________________
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®.