x86: Mask X86_FEATURE_XSAVE in cpuid leaf 1, ecx, as we don't allow
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Mar 2009 08:54:19 +0000 (08:54 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Mar 2009 08:54:19 +0000 (08:54 +0000)
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@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/libxc/xc_cpufeature.h
tools/libxc/xc_cpuid_x86.c
xen/arch/x86/traps.c
xen/include/asm-x86/cpufeature.h

index 047a6c9fc797d1d960ece597da45a3f8dca9a4f1..b5ab901c6846fcba508492d4c87cee497a868074 100644 (file)
@@ -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 */
index d75fe2b013aea796039d106b2aa0e4fe2e24e56d..f9ef0de10b3574e06d1258f22378b61a1c22d887 100644 (file)
@@ -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:
index 84f09c6c76525d9006fa26de02c9c2b983a452d4..1f246c950b713fe2f1158164fddd546b0fc726f1 100644 (file)
@@ -757,6 +757,7 @@ static void pv_cpuid(struct cpu_user_regs *regs)
         __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);
index 7df04869819067c69aabda7cb41fbb5de90bfdb9..4c6eeabc55dc1f4e46896ce584fed972fd7d1cc2 100644 (file)
@@ -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 */