Prev: [PATCH] x86, numa: fix boot without RAM on node0 again
Next: [PATCH 08/10] x86, xsave: introduce xstate enable functions
From: Robert Richter on 20 Jul 2010 15:00 The patch adds a check that tests if XSTATE_CPUID exists. Signed-off-by: Robert Richter <robert.richter(a)amd.com> --- arch/x86/include/asm/xsave.h | 2 ++ arch/x86/kernel/xsave.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h index 4d3b5d1..d1b5f3a 100644 --- a/arch/x86/include/asm/xsave.h +++ b/arch/x86/include/asm/xsave.h @@ -4,6 +4,8 @@ #include <linux/types.h> #include <asm/processor.h> +#define XSTATE_CPUID 0x0000000d + #define XSTATE_FP 0x1 #define XSTATE_SSE 0x2 #define XSTATE_YMM 0x4 diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 2322f58..49540b7 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c @@ -423,9 +423,15 @@ static void __init setup_xstate_init(void) */ static void __cpuinit xstate_enable_boot_cpu(void) { + struct cpuinfo_x86 *c = &cpu_data(0); unsigned int eax, ebx, ecx, edx; - cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx); + if (c->cpuid_level < XSTATE_CPUID) { + WARN(1, KERN_ERR "XSTATE_CPUID missing\n"); + return; + } + + cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx); pcntxt_mask = eax + ((u64)edx << 32); if ((pcntxt_mask & XSTATE_FPSSE) != XSTATE_FPSSE) { -- 1.7.1.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |