CPUID and FPU fixes
v2 cover CPUID and FPU fixes
Our CPUID-less FPU detection code was terminally broken and, as far as I can tell, it's been broken for a long, long time. This series tries to improve the situation.
Changes from v1:
- Whitespace fixes
- Prettify the FPU probing code (Borislav)
- Improve logging (Borislav)
Andy Lutomirski (5):
x86/cpu: Factor out application of forced cpu caps x86/cpu: Re-apply forced caps every time cpu caps are re-read x86/fpu: Fix "x86/fpu: Legacy x87 FPU detected" message x86/fpu: Fix CPUID-less FPU detection
x86/fpu: Fix the "Giving up, no FPU found" test
Borislav Petkov (1):
x86/cpu: Add X86_FEATURE_CPUID
arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/kernel/cpu/common.c | 34 +++++++++++++++++++++++----------- arch/x86/kernel/fpu/init.c | 31 +++++++++++++++++-------------- arch/x86/kernel/fpu/xstate.c | 8 +++++++- 4 files changed, 48 insertions(+), 27 deletions(-)
Signature · 1 line
2.9.3
PATCH v2 1/6 x86/cpu: Add X86_FEATURE_CPUID
From: Borislav Petkov <[email protected]>
Add a synthetic CPUID flag denoting whether the CPU sports the CPUID instruction or not. This will come useful later when accomodating CPUID-less CPUs.
--- arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/kernel/cpu/common.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/include/asm/cpufeatures.h +1 -1
@@ -100,7 +100,7 @@#define X86_FEATURE_XTOPOLOGY ( 3*32+22)/* cpu topology enum extensions */ #define X86_FEATURE_TSC_RELIABLE ( 3*32+23)/* TSC is known to be reliable */ #define X86_FEATURE_NONSTOP_TSC ( 3*32+24)/* TSC does not stop in C states */ -/* free, was #define X86_FEATURE_CLFLUSH_MONITOR ( 3*32+25) * "" clflush reqd with monitor */ +#define X86_FEATURE_CPUID ( 3*32+25)/* CPU has CPUID instruction itself */ #define X86_FEATURE_EXTD_APICID ( 3*32+26)/* has extended APICID (8 bits) */ #define X86_FEATURE_AMD_DCM ( 3*32+27)/* multi-node processor */ #define X86_FEATURE_APERFMPERF ( 3*32+28)/* APERFMPERF */
arch/x86/kernel/cpu/common.c +4 -3
@@ -800,14 +800,12 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)memset (&c->x86_capability,0 ,sizeof c->x86_capability); c->extended_cpuid_level =0 ; -if (!have_cpuid_p ()) -identify_cpu_without_cpuid (c); -/* cyrix could have cpuid enabled via c_identify()*/ if (have_cpuid_p ()) {cpu_detect (c);get_cpu_vendor (c);get_cpu_cap (c); +setup_force_cpu_cap (X86_FEATURE_CPUID );if (this_cpu->c_early_init) this_cpu->c_early_init (c);
@@ -817,6 +815,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)if (this_cpu->c_bsp_init) this_cpu->c_bsp_init (c); + }else { +identify_cpu_without_cpuid (c); +setup_clear_cpu_cap (X86_FEATURE_CPUID ); }setup_force_cpu_cap (X86_FEATURE_ALWAYS );
Signature · 1 line
2.9.3
tip-bot for Borislav Petkov
merge bot[tip:x86/fpu] x86/cpu: Add X86_FEATURE_CPUID
x86/cpu: Add X86_FEATURE_CPUID
Commit-ID: 78d1b296843a719935277b0d24d1358416ed0204 Gitweb: http://git.kernel.org/tip/78d1b296843a719935277b0d24d1358416ed0204 Author: Borislav Petkov <[email protected]> AuthorDate: Wed, 18 Jan 2017 11:15:37 -0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 25 Jan 2017 10:12:39 +0100
x86/cpu: Add X86_FEATURE_CPUID
Add a synthetic CPUID flag denoting whether the CPU sports the CPUID instruction or not. This will come useful later when accomodating CPUID-less CPUs.
--- arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/kernel/cpu/common.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/include/asm/cpufeatures.h +1 -1
@@ -100,7 +100,7 @@#define X86_FEATURE_XTOPOLOGY ( 3*32+22)/* cpu topology enum extensions */ #define X86_FEATURE_TSC_RELIABLE ( 3*32+23)/* TSC is known to be reliable */ #define X86_FEATURE_NONSTOP_TSC ( 3*32+24)/* TSC does not stop in C states */ -/* free, was #define X86_FEATURE_CLFLUSH_MONITOR ( 3*32+25) * "" clflush reqd with monitor */ +#define X86_FEATURE_CPUID ( 3*32+25)/* CPU has CPUID instruction itself */ #define X86_FEATURE_EXTD_APICID ( 3*32+26)/* has extended APICID (8 bits) */ #define X86_FEATURE_AMD_DCM ( 3*32+27)/* multi-node processor */ #define X86_FEATURE_APERFMPERF ( 3*32+28)/* APERFMPERF */
arch/x86/kernel/cpu/common.c +4 -3
@@ -801,14 +801,12 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)memset (&c->x86_capability,0 ,sizeof c->x86_capability); c->extended_cpuid_level =0 ; -if (!have_cpuid_p ()) -identify_cpu_without_cpuid (c); -/* cyrix could have cpuid enabled via c_identify()*/ if (have_cpuid_p ()) {cpu_detect (c);get_cpu_vendor (c);get_cpu_cap (c); +setup_force_cpu_cap (X86_FEATURE_CPUID );if (this_cpu->c_early_init) this_cpu->c_early_init (c);
@@ -818,6 +816,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)if (this_cpu->c_bsp_init) this_cpu->c_bsp_init (c); + }else { +identify_cpu_without_cpuid (c); +setup_clear_cpu_cap (X86_FEATURE_CPUID ); }setup_force_cpu_cap (X86_FEATURE_ALWAYS );
PATCH v2 2/6 x86/cpu: Factor out application of forced cpu caps
In reply to Andy LutomirskiThere are multiple call sites that apply forced CPU caps. Factor them into a helper.
--- arch/x86/kernel/cpu/common.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/common.c +12 -8
@@ -655,6 +655,16 @@ void cpu_detect(struct cpuinfo_x86 *c) } } +static void apply_forced_caps (struct cpuinfo_x86 *c) +{ +int i; + +for (i =0 ; i <NCAPINTS ; i++) { + c->x86_capability[i] &= ~cpu_caps_cleared[i]; + c->x86_capability[i] |= cpu_caps_set[i]; + } +} +void get_cpu_cap (struct cpuinfo_x86 *c) {u32 eax, ebx, ecx, edx;
@@ -1034,10 +1044,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) this_cpu->c_identify (c);/* Clear/Set all flags overridden by options, after probe */ -for (i =0 ; i <NCAPINTS ; i++) { - c->x86_capability[i] &= ~cpu_caps_cleared[i]; - c->x86_capability[i] |= cpu_caps_set[i]; - } +apply_forced_caps (c);#ifdef CONFIG_X86_64 c->apicid = apic->phys_pkg_id (c->initial_apicid,0 );
@@ -1096,10 +1103,7 @@ static void identify_cpu(struct cpuinfo_x86 *c)* Clear/Set all flags overridden by options, need do it * before following smp all cpus cap AND. */ -for (i =0 ; i <NCAPINTS ; i++) { - c->x86_capability[i] &= ~cpu_caps_cleared[i]; - c->x86_capability[i] |= cpu_caps_set[i]; - } +apply_forced_caps (c);/* * On SMP, boot_cpu_data holds the common feature set between
Signature · 1 line
2.9.3
tip-bot for Andy Lutomirski
merge bot[tip:x86/fpu] x86/cpu: Factor out application of forced CPU caps
x86/cpu: Factor out application of forced CPU caps
Commit-ID: 8bf1ebca215c262e48c15a4a15f175991776f57f Gitweb: http://git.kernel.org/tip/8bf1ebca215c262e48c15a4a15f175991776f57f Author: Andy Lutomirski <[email protected]> AuthorDate: Wed, 18 Jan 2017 11:15:38 -0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 25 Jan 2017 10:12:40 +0100
x86/cpu: Factor out application of forced CPU caps
There are multiple call sites that apply forced CPU caps. Factor them into a helper.
--- arch/x86/kernel/cpu/common.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/common.c +12 -8
@@ -655,6 +655,16 @@ void cpu_detect(struct cpuinfo_x86 *c) } } +static void apply_forced_caps (struct cpuinfo_x86 *c) +{ +int i; + +for (i =0 ; i <NCAPINTS ; i++) { + c->x86_capability[i] &= ~cpu_caps_cleared[i]; + c->x86_capability[i] |= cpu_caps_set[i]; + } +} +void get_cpu_cap (struct cpuinfo_x86 *c) {u32 eax, ebx, ecx, edx;
@@ -1035,10 +1045,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) this_cpu->c_identify (c);/* Clear/Set all flags overridden by options, after probe */ -for (i =0 ; i <NCAPINTS ; i++) { - c->x86_capability[i] &= ~cpu_caps_cleared[i]; - c->x86_capability[i] |= cpu_caps_set[i]; - } +apply_forced_caps (c);#ifdef CONFIG_X86_64 c->apicid = apic->phys_pkg_id (c->initial_apicid,0 );
@@ -1097,10 +1104,7 @@ static void identify_cpu(struct cpuinfo_x86 *c)* Clear/Set all flags overridden by options, need do it * before following smp all cpus cap AND. */ -for (i =0 ; i <NCAPINTS ; i++) { - c->x86_capability[i] &= ~cpu_caps_cleared[i]; - c->x86_capability[i] |= cpu_caps_set[i]; - } +apply_forced_caps (c);/* * On SMP, boot_cpu_data holds the common feature set between
PATCH v2 3/6 x86/cpu: Re-apply forced caps every time cpu caps are re-read
In reply to Andy LutomirskiCalling get_cpu_cap() will reset a bunch of CPU features. This will cause the system to lose track of force-set and force-cleared featueres in the words that are reset until the end of CPU initialization. This can cause X86_FEATURE_FPU, for example, to change back and forth during boot and potentially confuse CPU setup.
To minimize the chance of confusion, re-apply forced caps every time get_cpu_cap() is called.
--- arch/x86/kernel/cpu/common.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/kernel/cpu/common.c +7 -0
@@ -757,6 +757,13 @@ void get_cpu_cap(struct cpuinfo_x86 *c) c->x86_capability[CPUID_8000_000A_EDX ] =cpuid_edx (0x8000000a );init_scattered_cpuid_features (c); + +/* +* Clear/Set all flags overridden by options, after probe. +* This needs to happen each time we re-probe, which may happen +* several times during CPU initialization. +*/ +apply_forced_caps (c); }static void identify_cpu_without_cpuid (struct cpuinfo_x86 *c)
Signature · 1 line
2.9.3
Borislav Petkov
maintainerRe: [PATCH v2 3/6] x86/cpu: Re-apply forced caps every time cpu caps are re-read
Quoted 3 lines · Andy Lutomirski
Calling
get_cpu_cap()will reset a bunch of CPU features. This will cause the system to lose track of force-set and force-cleared featueres in the words that are reset until the end of CPU
features
Quoted 7 lines
initialization. This can cause
X86_FEATURE_FPU, for example, to change back and forth during boot and potentially confuse CPU setup.To minimize the chance of confusion, re-apply forced caps every time
get_cpu_cap()is called.Signed-off-by Andy Lutomirski <[email protected]>
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.tip-bot for Andy Lutomirski
merge bot[tip:x86/fpu] x86/cpu: Re-apply forced caps every time CPU caps are re-read
In reply to Andy Lutomirskix86/cpu: Re-apply forced caps every time CPU caps are re-read
Commit-ID: 60d3450167433f2d099ce2869dc52dd9e7dc9b29 Gitweb: http://git.kernel.org/tip/60d3450167433f2d099ce2869dc52dd9e7dc9b29 Author: Andy Lutomirski <[email protected]> AuthorDate: Wed, 18 Jan 2017 11:15:39 -0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 25 Jan 2017 10:12:41 +0100
x86/cpu: Re-apply forced caps every time CPU caps are re-read
Calling get_cpu_cap() will reset a bunch of CPU features. This will cause the system to lose track of force-set and force-cleared features in the words that are reset until the end of CPU initialization. This can cause X86_FEATURE_FPU, for example, to change back and forth during boot and potentially confuse CPU setup.
To minimize the chance of confusion, re-apply forced caps every time get_cpu_cap() is called.
--- arch/x86/kernel/cpu/common.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/kernel/cpu/common.c +7 -0
@@ -758,6 +758,13 @@ void get_cpu_cap(struct cpuinfo_x86 *c) c->x86_capability[CPUID_8000_000A_EDX ] =cpuid_edx (0x8000000a );init_scattered_cpuid_features (c); + +/* +* Clear/Set all flags overridden by options, after probe. +* This needs to happen each time we re-probe, which may happen +* several times during CPU initialization. +*/ +apply_forced_caps (c); }static void identify_cpu_without_cpuid (struct cpuinfo_x86 *c)
PATCH v2 4/6 x86/fpu: Fix "x86/fpu: Legacy x87 FPU detected" message
In reply to Andy LutomirskiThat message isn't at all clear -- what does "Legacy x87" even mean?
Clarify it. If there's no FPU, say "x86/fpu: No FPU detected". If there's an FPU that doesn't have XSAVE, say "x86/fpu: x87 FPU will use FSAVE|FXSAVE".
--- arch/x86/kernel/fpu/xstate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kernel/fpu/xstate.c +7 -1
@@ -705,8 +705,14 @@ void __init fpu__init_system_xstate(void)WARN_ON_FPU (!on_boot_cpu); on_boot_cpu =0 ; +if (!boot_cpu_has (X86_FEATURE_FPU )) { +pr_info ("x86/fpu: No FPU detected.\n" ); +return ; + } +if (!boot_cpu_has (X86_FEATURE_XSAVE )) { -pr_info ("x86/fpu: Legacy x87 FPU detected.\n" ); +pr_info ("x86/fpu: x87 FPU will use %s.\n" , +boot_cpu_has (X86_FEATURE_FXSR ) ?"FXSAVE" :"FSAVE" );return ; }
Signature · 1 line
2.9.3
tip-bot for Andy Lutomirski
merge bot[tip:x86/fpu] x86/fpu: Fix "x86/fpu: Legacy x87 FPU detected" message
x86/fpu: Fix "x86/fpu: Legacy x87 FPU detected" message
Commit-ID: 9170fb409437b246078bcad3f1481d32dfe2ca28 Gitweb: http://git.kernel.org/tip/9170fb409437b246078bcad3f1481d32dfe2ca28 Author: Andy Lutomirski <[email protected]> AuthorDate: Wed, 18 Jan 2017 11:15:40 -0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 25 Jan 2017 10:12:42 +0100
x86/fpu: Fix "x86/fpu: Legacy x87 FPU detected" message
That message isn't at all clear -- what does "Legacy x87" even mean?
Clarify it. If there's no FPU, say:
x86/fpu: No FPU detected
If there's an FPU that doesn't have XSAVE, say:
x86/fpu: x87 FPU will use FSAVE|FXSAVE
--- arch/x86/kernel/fpu/xstate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kernel/fpu/xstate.c +7 -1
@@ -705,8 +705,14 @@ void __init fpu__init_system_xstate(void)WARN_ON_FPU (!on_boot_cpu); on_boot_cpu =0 ; +if (!boot_cpu_has (X86_FEATURE_FPU )) { +pr_info ("x86/fpu: No FPU detected\n" ); +return ; + } +if (!boot_cpu_has (X86_FEATURE_XSAVE )) { -pr_info ("x86/fpu: Legacy x87 FPU detected.\n" ); +pr_info ("x86/fpu: x87 FPU will use %s\n" , +boot_cpu_has (X86_FEATURE_FXSR ) ?"FXSAVE" :"FSAVE" );return ; }
PATCH v2 5/6 x86/fpu: Fix CPUID-less FPU detection
In reply to Andy LutomirskiThe old code didn't work at all because it adjusted the current caps instead of the forced caps. Anything it did would be undone later during cpu identification. Fix that and, while we're at it, improve the logging and don't bother running it if CPUID is available.
--- arch/x86/kernel/fpu/init.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
arch/x86/kernel/fpu/init.c +16 -13
@@ -48,13 +48,7 @@ void fpu__init_cpu(void)fpu__init_cpu_xstate (); } -/* -* The earliest FPU detection code. -* -* Set the X86_FEATURE_FPU CPU-capability bit based on -* trying to execute an actual sequence of FPU instructions: -*/ -static void fpu__init_system_early_generic (struct cpuinfo_x86 *c) +static bool fpu__probe_without_cpuid (void ) {unsigned long cr0;u16 fsw, fcw;
@@ -65,14 +59,23 @@ static void fpu__init_system_early_generic(struct cpuinfo_x86 *c) cr0 &= ~(X86_CR0_TS |X86_CR0_EM );write_cr0 (cr0); -if (!test_bit (X86_FEATURE_FPU , (unsigned long *)cpu_caps_cleared)) { - asmvolatile ("fninit ; fnstsw %0 ; fnstcw %1" - :"+m" (fsw),"+m" (fcw)); + asmvolatile ("fninit ; fnstsw %0 ; fnstcw %1" + :"+m" (fsw),"+m" (fcw)); + +pr_info ("x86/fpu: Probing for FPU: FSW=0x%04hx FCW=0x%04hx\n" , + fsw, fcw); -if (fsw ==0 && (fcw &0x103f ) ==0x003f ) -set_cpu_cap (c,X86_FEATURE_FPU ); +return fsw ==0 && (fcw &0x103f ) ==0x003f ; +} + +static void fpu__init_system_early_generic (struct cpuinfo_x86 *c) +{ +if (!boot_cpu_has (X86_FEATURE_CPUID ) && + !test_bit (X86_FEATURE_FPU , (unsigned long *)cpu_caps_cleared)) { +if (fpu__probe_without_cpuid ()) +setup_force_cpu_cap (X86_FEATURE_FPU );else -clear_cpu_cap (c,X86_FEATURE_FPU ); +setup_clear_cpu_cap (X86_FEATURE_FPU ); }#ifndef CONFIG_MATH_EMULATION
Signature · 1 line
2.9.3
Re: [PATCH v2 5/6] x86/fpu: Fix CPUID-less FPU detection
Quoted 3 lines · Andy Lutomirski
The old code didn't work at all because it adjusted the current caps instead of the forced caps. Anything it did would be undone later during cpu identification. Fix that and, while we're at it, improve
CPU
Quoted 4 lines
the logging and don't bother running it if CPUID is available.
Reported-by Matthew Whitehead <[email protected]>Signed-off-by Andy Lutomirski <[email protected]>
Just two minor typos which can be fixed en-route. Other than that, for all 6:
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.tip-bot for Andy Lutomirski
merge bot[tip:x86/fpu] x86/fpu: Fix CPUID-less FPU detection
In reply to Andy Lutomirskix86/fpu: Fix CPUID-less FPU detection
Commit-ID: 37ac78b67b3384d1ced5424d5a13ee146041bda3 Gitweb: http://git.kernel.org/tip/37ac78b67b3384d1ced5424d5a13ee146041bda3 Author: Andy Lutomirski <[email protected]> AuthorDate: Wed, 18 Jan 2017 11:15:41 -0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 25 Jan 2017 10:12:43 +0100
x86/fpu: Fix CPUID-less FPU detection
The old code didn't work at all because it adjusted the current caps instead of the forced caps. Anything it did would be undone later during CPU identification. Fix that and, while we're at it, improve the logging and don't bother running it if CPUID is available.
--- arch/x86/kernel/fpu/init.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
arch/x86/kernel/fpu/init.c +14 -13
@@ -48,13 +48,7 @@ void fpu__init_cpu(void)fpu__init_cpu_xstate (); } -/* -* The earliest FPU detection code. -* -* Set the X86_FEATURE_FPU CPU-capability bit based on -* trying to execute an actual sequence of FPU instructions: -*/ -static void fpu__init_system_early_generic (struct cpuinfo_x86 *c) +static bool fpu__probe_without_cpuid (void ) {unsigned long cr0;u16 fsw, fcw;
@@ -65,14 +59,21 @@ static void fpu__init_system_early_generic(struct cpuinfo_x86 *c) cr0 &= ~(X86_CR0_TS |X86_CR0_EM );write_cr0 (cr0); -if (!test_bit (X86_FEATURE_FPU , (unsigned long *)cpu_caps_cleared)) { - asmvolatile ("fninit ; fnstsw %0 ; fnstcw %1" - :"+m" (fsw),"+m" (fcw)); + asmvolatile ("fninit ; fnstsw %0 ; fnstcw %1" :"+m" (fsw),"+m" (fcw)); + +pr_info ("x86/fpu: Probing for FPU: FSW=0x%04hx FCW=0x%04hx\n" , fsw, fcw); -if (fsw ==0 && (fcw &0x103f ) ==0x003f ) -set_cpu_cap (c,X86_FEATURE_FPU ); +return fsw ==0 && (fcw &0x103f ) ==0x003f ; +} + +static void fpu__init_system_early_generic (struct cpuinfo_x86 *c) +{ +if (!boot_cpu_has (X86_FEATURE_CPUID ) && + !test_bit (X86_FEATURE_FPU , (unsigned long *)cpu_caps_cleared)) { +if (fpu__probe_without_cpuid ()) +setup_force_cpu_cap (X86_FEATURE_FPU );else -clear_cpu_cap (c,X86_FEATURE_FPU ); +setup_clear_cpu_cap (X86_FEATURE_FPU ); }#ifndef CONFIG_MATH_EMULATION
PATCH v2 6/6 x86/fpu: Fix the "Giving up, no FPU found" test
In reply to Andy LutomirskiWe would never print "Giving up, no FPU found" because X86_FEATURE_FPU was in REQUIRED_MASK on non-FPU-emulating builds, so the boot_cpu_has() test didn't do anything.
--- arch/x86/kernel/fpu/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/fpu/init.c +1 -1
@@ -79,7 +79,7 @@ static void fpu__init_system_early_generic(struct cpuinfo_x86 *c) }#ifndef CONFIG_MATH_EMULATION -if (!boot_cpu_has (X86_FEATURE_FPU )) { +if (!test_cpu_cap (&boot_cpu_data,X86_FEATURE_FPU )) {pr_emerg ("x86/fpu: Giving up, no FPU found and no math emulation present\n" );for (;;) asmvolatile ("hlt" );
Signature · 1 line
2.9.3
tip-bot for Andy Lutomirski
merge bot[tip:x86/fpu] x86/fpu: Fix the "Giving up, no FPU found" test
x86/fpu: Fix the "Giving up, no FPU found" test
Commit-ID: 9729017f844431ab2800519297d8d1b0ecbc420d Gitweb: http://git.kernel.org/tip/9729017f844431ab2800519297d8d1b0ecbc420d Author: Andy Lutomirski <[email protected]> AuthorDate: Wed, 18 Jan 2017 11:15:42 -0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 25 Jan 2017 10:12:44 +0100
x86/fpu: Fix the "Giving up, no FPU found" test
We would never print "Giving up, no FPU found" because X86_FEATURE_FPU was in REQUIRED_MASK on non-FPU-emulating builds, so the boot_cpu_has() test didn't do anything.
--- arch/x86/kernel/fpu/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/fpu/init.c +1 -1
@@ -77,7 +77,7 @@ static void fpu__init_system_early_generic(struct cpuinfo_x86 *c) }#ifndef CONFIG_MATH_EMULATION -if (!boot_cpu_has (X86_FEATURE_FPU )) { +if (!test_cpu_cap (&boot_cpu_data,X86_FEATURE_FPU )) {pr_emerg ("x86/fpu: Giving up, no FPU found and no math emulation present\n" );for (;;) asmvolatile ("hlt" );