ia64/xen-unstable

changeset 19291:9ed53e602119

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@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 09 08:54:19 2009 +0000 (2009-03-09)
parents 5a981686bbf8
children cd5697e00e86
files tools/libxc/xc_cpufeature.h tools/libxc/xc_cpuid_x86.c xen/arch/x86/traps.c xen/include/asm-x86/cpufeature.h
line diff
     1.1 --- a/tools/libxc/xc_cpufeature.h	Mon Mar 09 08:43:11 2009 +0000
     1.2 +++ b/tools/libxc/xc_cpufeature.h	Mon Mar 09 08:54:19 2009 +0000
     1.3 @@ -83,6 +83,7 @@
     1.4  #define X86_FEATURE_SSE4_1	(4*32+19) /* Streaming SIMD Extensions 4.1 */
     1.5  #define X86_FEATURE_SSE4_2	(4*32+20) /* Streaming SIMD Extensions 4.2 */
     1.6  #define X86_FEATURE_POPCNT	(4*32+23) /* POPCNT instruction */
     1.7 +#define X86_FEATURE_XSAVE	(4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
     1.8  #define X86_FEATURE_HYPERVISOR	(4*32+31) /* Running under some hypervisor */
     1.9  
    1.10  /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
     2.1 --- a/tools/libxc/xc_cpuid_x86.c	Mon Mar 09 08:43:11 2009 +0000
     2.2 +++ b/tools/libxc/xc_cpuid_x86.c	Mon Mar 09 08:54:19 2009 +0000
     2.3 @@ -311,6 +311,7 @@ static void xc_cpuid_pv_policy(
     2.4          clear_bit(X86_FEATURE_XTPR, regs[2]);
     2.5          clear_bit(X86_FEATURE_PDCM, regs[2]);
     2.6          clear_bit(X86_FEATURE_DCA, regs[2]);
     2.7 +        clear_bit(X86_FEATURE_XSAVE, regs[2]);
     2.8          set_bit(X86_FEATURE_HYPERVISOR, regs[2]);
     2.9          break;
    2.10      case 0x80000001:
     3.1 --- a/xen/arch/x86/traps.c	Mon Mar 09 08:43:11 2009 +0000
     3.2 +++ b/xen/arch/x86/traps.c	Mon Mar 09 08:54:19 2009 +0000
     3.3 @@ -757,6 +757,7 @@ static void pv_cpuid(struct cpu_user_reg
     3.4          __clear_bit(X86_FEATURE_XTPR % 32, &c);
     3.5          __clear_bit(X86_FEATURE_PDCM % 32, &c);
     3.6          __clear_bit(X86_FEATURE_DCA % 32, &c);
     3.7 +        __clear_bit(X86_FEATURE_XSAVE % 32, &c);
     3.8          if ( !cpu_has_apic )
     3.9             __clear_bit(X86_FEATURE_X2APIC % 32, &c);
    3.10          __set_bit(X86_FEATURE_HYPERVISOR % 32, &c);
     4.1 --- a/xen/include/asm-x86/cpufeature.h	Mon Mar 09 08:43:11 2009 +0000
     4.2 +++ b/xen/include/asm-x86/cpufeature.h	Mon Mar 09 08:54:19 2009 +0000
     4.3 @@ -95,6 +95,7 @@
     4.4  #define X86_FEATURE_SSE4_2	(4*32+20) /* Streaming SIMD Extensions 4.2 */
     4.5  #define X86_FEATURE_X2APIC	(4*32+21) /* Extended xAPIC */
     4.6  #define X86_FEATURE_POPCNT	(4*32+23) /* POPCNT instruction */
     4.7 +#define X86_FEATURE_XSAVE	(4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
     4.8  #define X86_FEATURE_HYPERVISOR	(4*32+31) /* Running under some hypervisor */
     4.9  
    4.10  /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */