Commit e0022981 authored by Suresh Siddha's avatar Suresh Siddha Committed by H. Peter Anvin

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: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Link: http://lkml.kernel.org/r/1347300665-6209-5-git-send-email-suresh.b.siddha@intel.comSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 212b0212
...@@ -1834,8 +1834,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted. ...@@ -1834,8 +1834,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
enabling legacy floating-point and sse state. enabling legacy floating-point and sse state.
eagerfpu= [X86] eagerfpu= [X86]
on enable eager fpu restore (default for xsaveopt) on enable eager fpu restore
off disable eager fpu restore off disable eager fpu restore
auto selects the default scheme, which automatically
enables eagerfpu restore for xsaveopt.
nohlt [BUGS=ARM,SH] Tells the kernel that the sleep(SH) or nohlt [BUGS=ARM,SH] Tells the kernel that the sleep(SH) or
wfi(ARM) instruction doesn't work correctly and not to wfi(ARM) instruction doesn't work correctly and not to
......
...@@ -508,13 +508,15 @@ static void __init setup_init_fpu_buf(void) ...@@ -508,13 +508,15 @@ static void __init setup_init_fpu_buf(void)
xsave_state(init_xstate_buf, -1); xsave_state(init_xstate_buf, -1);
} }
static int disable_eagerfpu; static enum { AUTO, ENABLE, DISABLE } eagerfpu = AUTO;
static int __init eager_fpu_setup(char *s) static int __init eager_fpu_setup(char *s)
{ {
if (!strcmp(s, "on")) if (!strcmp(s, "on"))
setup_force_cpu_cap(X86_FEATURE_EAGER_FPU); eagerfpu = ENABLE;
else if (!strcmp(s, "off")) else if (!strcmp(s, "off"))
disable_eagerfpu = 1; eagerfpu = DISABLE;
else if (!strcmp(s, "auto"))
eagerfpu = AUTO;
return 1; return 1;
} }
__setup("eagerfpu=", eager_fpu_setup); __setup("eagerfpu=", eager_fpu_setup);
...@@ -557,8 +559,9 @@ static void __init xstate_enable_boot_cpu(void) ...@@ -557,8 +559,9 @@ static void __init xstate_enable_boot_cpu(void)
prepare_fx_sw_frame(); prepare_fx_sw_frame();
setup_init_fpu_buf(); setup_init_fpu_buf();
if (cpu_has_xsaveopt && !disable_eagerfpu) /* Auto enable eagerfpu for xsaveopt */
setup_force_cpu_cap(X86_FEATURE_EAGER_FPU); if (cpu_has_xsaveopt && eagerfpu != DISABLE)
eagerfpu = ENABLE;
pr_info("enabled xstate_bv 0x%llx, cntxt size 0x%x\n", pr_info("enabled xstate_bv 0x%llx, cntxt size 0x%x\n",
pcntxt_mask, xstate_size); pcntxt_mask, xstate_size);
...@@ -598,6 +601,10 @@ void __cpuinit eager_fpu_init(void) ...@@ -598,6 +601,10 @@ void __cpuinit eager_fpu_init(void)
clear_used_math(); clear_used_math();
current_thread_info()->status = 0; current_thread_info()->status = 0;
if (eagerfpu == ENABLE)
setup_force_cpu_cap(X86_FEATURE_EAGER_FPU);
if (!cpu_has_eager_fpu) { if (!cpu_has_eager_fpu) {
stts(); stts();
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment