diff options
author | Robert Richter <robert.richter@amd.com> | 2010-07-21 13:03:53 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-07-21 17:06:04 -0400 |
commit | 97e80a70db689fb1e876df9f12305cc72f85ca53 (patch) | |
tree | 4525d629614950a4e4d77b0fcbfdcd130377f1ac /arch/x86 | |
parent | 0e49bf66d2ca649b167428adddbbbe9d9bd4894c (diff) |
x86, xsave: Introduce xstate enable functions
The patch renames xsave_cntxt_init() and __xsave_init() into
xstate_enable_boot_cpu() and xstate_enable() as this names are more
meaningful.
It also removes the duplicate xcr setup for the boot cpu.
Signed-off-by: Robert Richter <robert.richter@amd.com>
LKML-Reference: <1279731838-1522-3-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')
-rw-r--r-- | arch/x86/kernel/xsave.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 550bf45236f4..2322f586c051 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c | |||
@@ -360,15 +360,10 @@ unsigned int sig_xstate_size = sizeof(struct _fpstate); | |||
360 | /* | 360 | /* |
361 | * Enable the extended processor state save/restore feature | 361 | * Enable the extended processor state save/restore feature |
362 | */ | 362 | */ |
363 | static void __cpuinit __xsave_init(void) | 363 | static inline void xstate_enable(u64 mask) |
364 | { | 364 | { |
365 | set_in_cr4(X86_CR4_OSXSAVE); | 365 | set_in_cr4(X86_CR4_OSXSAVE); |
366 | 366 | xsetbv(XCR_XFEATURE_ENABLED_MASK, mask); | |
367 | /* | ||
368 | * Enable all the features that the HW is capable of | ||
369 | * and the Linux kernel is aware of. | ||
370 | */ | ||
371 | xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask); | ||
372 | } | 367 | } |
373 | 368 | ||
374 | /* | 369 | /* |
@@ -426,7 +421,7 @@ static void __init setup_xstate_init(void) | |||
426 | /* | 421 | /* |
427 | * Enable and initialize the xsave feature. | 422 | * Enable and initialize the xsave feature. |
428 | */ | 423 | */ |
429 | static void __cpuinit xsave_cntxt_init(void) | 424 | static void __cpuinit xstate_enable_boot_cpu(void) |
430 | { | 425 | { |
431 | unsigned int eax, ebx, ecx, edx; | 426 | unsigned int eax, ebx, ecx, edx; |
432 | 427 | ||
@@ -443,7 +438,8 @@ static void __cpuinit xsave_cntxt_init(void) | |||
443 | * Support only the state known to OS. | 438 | * Support only the state known to OS. |
444 | */ | 439 | */ |
445 | pcntxt_mask = pcntxt_mask & XCNTXT_MASK; | 440 | pcntxt_mask = pcntxt_mask & XCNTXT_MASK; |
446 | __xsave_init(); | 441 | |
442 | xstate_enable(pcntxt_mask); | ||
447 | 443 | ||
448 | /* | 444 | /* |
449 | * Recompute the context size for enabled features | 445 | * Recompute the context size for enabled features |
@@ -470,6 +466,7 @@ void __cpuinit xsave_init(void) | |||
470 | * Boot processor to setup the FP and extended state context info. | 466 | * Boot processor to setup the FP and extended state context info. |
471 | */ | 467 | */ |
472 | if (!smp_processor_id()) | 468 | if (!smp_processor_id()) |
473 | xsave_cntxt_init(); | 469 | xstate_enable_boot_cpu(); |
474 | __xsave_init(); | 470 | else |
471 | xstate_enable(pcntxt_mask); | ||
475 | } | 472 | } |