aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2012-09-10 13:32:32 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2012-09-18 18:52:24 -0400
commite00229819f306b1f86134095347e9187dc346bd1 (patch)
tree58184b30fb2dca0f14c0b2cdc60b958529154893
parent212b02125f3725127148475059a70031bd031bdb (diff)
x86, fpu: make eagerfpu= boot param tri-state
Add the "eagerfpu=auto" (that selects the default scheme in enabling eagerfpu) which can override compiled-in boot parameters like "eagerfpu=on/off" (that force enable/disable eagerfpu). Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Link: http://lkml.kernel.org/r/1347300665-6209-5-git-send-email-suresh.b.siddha@intel.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--Documentation/kernel-parameters.txt4
-rw-r--r--arch/x86/kernel/xsave.c17
2 files changed, 15 insertions, 6 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e8f7faaa4571..46a6a8288dec 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1834,8 +1834,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
1834 enabling legacy floating-point and sse state. 1834 enabling legacy floating-point and sse state.
1835 1835
1836 eagerfpu= [X86] 1836 eagerfpu= [X86]
1837 on enable eager fpu restore (default for xsaveopt) 1837 on enable eager fpu restore
1838 off disable eager fpu restore 1838 off disable eager fpu restore
1839 auto selects the default scheme, which automatically
1840 enables eagerfpu restore for xsaveopt.
1839 1841
1840 nohlt [BUGS=ARM,SH] Tells the kernel that the sleep(SH) or 1842 nohlt [BUGS=ARM,SH] Tells the kernel that the sleep(SH) or
1841 wfi(ARM) instruction doesn't work correctly and not to 1843 wfi(ARM) instruction doesn't work correctly and not to
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index e99f75439f6d..4e89b3dd408d 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -508,13 +508,15 @@ static void __init setup_init_fpu_buf(void)
508 xsave_state(init_xstate_buf, -1); 508 xsave_state(init_xstate_buf, -1);
509} 509}
510 510
511static int disable_eagerfpu; 511static enum { AUTO, ENABLE, DISABLE } eagerfpu = AUTO;
512static int __init eager_fpu_setup(char *s) 512static int __init eager_fpu_setup(char *s)
513{ 513{
514 if (!strcmp(s, "on")) 514 if (!strcmp(s, "on"))
515 setup_force_cpu_cap(X86_FEATURE_EAGER_FPU); 515 eagerfpu = ENABLE;
516 else if (!strcmp(s, "off")) 516 else if (!strcmp(s, "off"))
517 disable_eagerfpu = 1; 517 eagerfpu = DISABLE;
518 else if (!strcmp(s, "auto"))
519 eagerfpu = AUTO;
518 return 1; 520 return 1;
519} 521}
520__setup("eagerfpu=", eager_fpu_setup); 522__setup("eagerfpu=", eager_fpu_setup);
@@ -557,8 +559,9 @@ static void __init xstate_enable_boot_cpu(void)
557 prepare_fx_sw_frame(); 559 prepare_fx_sw_frame();
558 setup_init_fpu_buf(); 560 setup_init_fpu_buf();
559 561
560 if (cpu_has_xsaveopt && !disable_eagerfpu) 562 /* Auto enable eagerfpu for xsaveopt */
561 setup_force_cpu_cap(X86_FEATURE_EAGER_FPU); 563 if (cpu_has_xsaveopt && eagerfpu != DISABLE)
564 eagerfpu = ENABLE;
562 565
563 pr_info("enabled xstate_bv 0x%llx, cntxt size 0x%x\n", 566 pr_info("enabled xstate_bv 0x%llx, cntxt size 0x%x\n",
564 pcntxt_mask, xstate_size); 567 pcntxt_mask, xstate_size);
@@ -598,6 +601,10 @@ void __cpuinit eager_fpu_init(void)
598 601
599 clear_used_math(); 602 clear_used_math();
600 current_thread_info()->status = 0; 603 current_thread_info()->status = 0;
604
605 if (eagerfpu == ENABLE)
606 setup_force_cpu_cap(X86_FEATURE_EAGER_FPU);
607
601 if (!cpu_has_eager_fpu) { 608 if (!cpu_has_eager_fpu) {
602 stts(); 609 stts();
603 return; 610 return;