diff options
author | Robert Richter <robert.richter@amd.com> | 2010-07-21 13:03:54 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-07-21 17:06:04 -0400 |
commit | ee813d53a8e980a3a28318efb8935d45723f5211 (patch) | |
tree | 4729849d80a1fde57071b3baacdae78528348a68 /arch/x86/kernel/xsave.c | |
parent | 97e80a70db689fb1e876df9f12305cc72f85ca53 (diff) |
x86, xsave: Check cpuid level for XSTATE_CPUID (0x0d)
The patch introduces the XSTATE_CPUID macro and adds a check that
tests if XSTATE_CPUID exists.
Signed-off-by: Robert Richter <robert.richter@amd.com>
LKML-Reference: <1279731838-1522-4-git-send-email-robert.richter@amd.com>
Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/xsave.c')
-rw-r--r-- | arch/x86/kernel/xsave.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 2322f586c051..5adb7fb408f0 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c | |||
@@ -379,7 +379,7 @@ static void setup_xstate_features(void) | |||
379 | xstate_sizes = alloc_bootmem(xstate_features * sizeof(int)); | 379 | xstate_sizes = alloc_bootmem(xstate_features * sizeof(int)); |
380 | 380 | ||
381 | do { | 381 | do { |
382 | cpuid_count(0xd, leaf, &eax, &ebx, &ecx, &edx); | 382 | cpuid_count(XSTATE_CPUID, leaf, &eax, &ebx, &ecx, &edx); |
383 | 383 | ||
384 | if (eax == 0) | 384 | if (eax == 0) |
385 | break; | 385 | break; |
@@ -425,7 +425,12 @@ static void __cpuinit xstate_enable_boot_cpu(void) | |||
425 | { | 425 | { |
426 | unsigned int eax, ebx, ecx, edx; | 426 | unsigned int eax, ebx, ecx, edx; |
427 | 427 | ||
428 | cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx); | 428 | if (boot_cpu_data.cpuid_level < XSTATE_CPUID) { |
429 | WARN(1, KERN_ERR "XSTATE_CPUID missing\n"); | ||
430 | return; | ||
431 | } | ||
432 | |||
433 | cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx); | ||
429 | pcntxt_mask = eax + ((u64)edx << 32); | 434 | pcntxt_mask = eax + ((u64)edx << 32); |
430 | 435 | ||
431 | if ((pcntxt_mask & XSTATE_FPSSE) != XSTATE_FPSSE) { | 436 | if ((pcntxt_mask & XSTATE_FPSSE) != XSTATE_FPSSE) { |
@@ -444,7 +449,7 @@ static void __cpuinit xstate_enable_boot_cpu(void) | |||
444 | /* | 449 | /* |
445 | * Recompute the context size for enabled features | 450 | * Recompute the context size for enabled features |
446 | */ | 451 | */ |
447 | cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx); | 452 | cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx); |
448 | xstate_size = ebx; | 453 | xstate_size = ebx; |
449 | 454 | ||
450 | update_regset_xstate_info(xstate_size, pcntxt_mask); | 455 | update_regset_xstate_info(xstate_size, pcntxt_mask); |