diff options
Diffstat (limited to 'arch/x86/kernel/xsave.c')
-rw-r--r-- | arch/x86/kernel/xsave.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index cfc7901ee94..b2549c3eb2c 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c | |||
@@ -360,10 +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 inline void xstate_enable(u64 mask) | 363 | static inline void xstate_enable(void) |
364 | { | 364 | { |
365 | set_in_cr4(X86_CR4_OSXSAVE); | 365 | set_in_cr4(X86_CR4_OSXSAVE); |
366 | xsetbv(XCR_XFEATURE_ENABLED_MASK, mask); | 366 | xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask); |
367 | } | 367 | } |
368 | 368 | ||
369 | /* | 369 | /* |
@@ -421,7 +421,7 @@ static void __init setup_xstate_init(void) | |||
421 | /* | 421 | /* |
422 | * Enable and initialize the xsave feature. | 422 | * Enable and initialize the xsave feature. |
423 | */ | 423 | */ |
424 | static void __cpuinit xstate_enable_boot_cpu(void) | 424 | static void __init xstate_enable_boot_cpu(void) |
425 | { | 425 | { |
426 | unsigned int eax, ebx, ecx, edx; | 426 | unsigned int eax, ebx, ecx, edx; |
427 | 427 | ||
@@ -444,7 +444,7 @@ static void __cpuinit xstate_enable_boot_cpu(void) | |||
444 | */ | 444 | */ |
445 | pcntxt_mask = pcntxt_mask & XCNTXT_MASK; | 445 | pcntxt_mask = pcntxt_mask & XCNTXT_MASK; |
446 | 446 | ||
447 | xstate_enable(pcntxt_mask); | 447 | xstate_enable(); |
448 | 448 | ||
449 | /* | 449 | /* |
450 | * Recompute the context size for enabled features | 450 | * Recompute the context size for enabled features |
@@ -462,16 +462,22 @@ static void __cpuinit xstate_enable_boot_cpu(void) | |||
462 | pcntxt_mask, xstate_size); | 462 | pcntxt_mask, xstate_size); |
463 | } | 463 | } |
464 | 464 | ||
465 | /* | ||
466 | * For the very first instance, this calls xstate_enable_boot_cpu(); | ||
467 | * for all subsequent instances, this calls xstate_enable(). | ||
468 | * | ||
469 | * This is somewhat obfuscated due to the lack of powerful enough | ||
470 | * overrides for the section checks. | ||
471 | */ | ||
465 | void __cpuinit xsave_init(void) | 472 | void __cpuinit xsave_init(void) |
466 | { | 473 | { |
474 | static __refdata void (*next_func)(void) = xstate_enable_boot_cpu; | ||
475 | void (*this_func)(void); | ||
476 | |||
467 | if (!cpu_has_xsave) | 477 | if (!cpu_has_xsave) |
468 | return; | 478 | return; |
469 | 479 | ||
470 | /* | 480 | this_func = next_func; |
471 | * Boot processor to setup the FP and extended state context info. | 481 | next_func = xstate_enable; |
472 | */ | 482 | this_func(); |
473 | if (!smp_processor_id()) | ||
474 | xstate_enable_boot_cpu(); | ||
475 | else | ||
476 | xstate_enable(pcntxt_mask); | ||
477 | } | 483 | } |