From: Keir Fraser Date: Mon, 9 Mar 2009 08:54:19 +0000 (+0000) Subject: x86: Mask X86_FEATURE_XSAVE in cpuid leaf 1, ecx, as we don't allow X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13994^2~13 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=52699620965db5bd229788223427d4559644b36e;p=xen.git 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 Signed-off-by: Keir Fraser --- diff --git a/tools/libxc/xc_cpufeature.h b/tools/libxc/xc_cpufeature.h index 047a6c9fc7..b5ab901c68 100644 --- a/tools/libxc/xc_cpufeature.h +++ b/tools/libxc/xc_cpufeature.h @@ -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 --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index d75fe2b013..f9ef0de10b 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -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 --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 84f09c6c76..1f246c950b 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -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); diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h index 7df0486981..4c6eeabc55 100644 --- a/xen/include/asm-x86/cpufeature.h +++ b/xen/include/asm-x86/cpufeature.h @@ -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 */