diff options
Diffstat (limited to 'arch/x86/kernel/fpu/init.c')
-rw-r--r-- | arch/x86/kernel/fpu/init.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 6d9f0a7ef4c8..bd08fb77073d 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c | |||
@@ -78,13 +78,15 @@ static void fpu__init_system_early_generic(struct cpuinfo_x86 *c) | |||
78 | cr0 &= ~(X86_CR0_TS | X86_CR0_EM); | 78 | cr0 &= ~(X86_CR0_TS | X86_CR0_EM); |
79 | write_cr0(cr0); | 79 | write_cr0(cr0); |
80 | 80 | ||
81 | asm volatile("fninit ; fnstsw %0 ; fnstcw %1" | 81 | if (!test_bit(X86_FEATURE_FPU, (unsigned long *)cpu_caps_cleared)) { |
82 | : "+m" (fsw), "+m" (fcw)); | 82 | asm volatile("fninit ; fnstsw %0 ; fnstcw %1" |
83 | : "+m" (fsw), "+m" (fcw)); | ||
83 | 84 | ||
84 | if (fsw == 0 && (fcw & 0x103f) == 0x003f) | 85 | if (fsw == 0 && (fcw & 0x103f) == 0x003f) |
85 | set_cpu_cap(c, X86_FEATURE_FPU); | 86 | set_cpu_cap(c, X86_FEATURE_FPU); |
86 | else | 87 | else |
87 | clear_cpu_cap(c, X86_FEATURE_FPU); | 88 | clear_cpu_cap(c, X86_FEATURE_FPU); |
89 | } | ||
88 | 90 | ||
89 | #ifndef CONFIG_MATH_EMULATION | 91 | #ifndef CONFIG_MATH_EMULATION |
90 | if (!cpu_has_fpu) { | 92 | if (!cpu_has_fpu) { |
@@ -132,7 +134,7 @@ static void __init fpu__init_system_generic(void) | |||
132 | * Set up the legacy init FPU context. (xstate init might overwrite this | 134 | * Set up the legacy init FPU context. (xstate init might overwrite this |
133 | * with a more modern format, if the CPU supports it.) | 135 | * with a more modern format, if the CPU supports it.) |
134 | */ | 136 | */ |
135 | fpstate_init_fxstate(&init_fpstate.fxsave); | 137 | fpstate_init(&init_fpstate); |
136 | 138 | ||
137 | fpu__init_system_mxcsr(); | 139 | fpu__init_system_mxcsr(); |
138 | } | 140 | } |
@@ -300,12 +302,6 @@ u64 __init fpu__get_supported_xfeatures_mask(void) | |||
300 | static void __init fpu__clear_eager_fpu_features(void) | 302 | static void __init fpu__clear_eager_fpu_features(void) |
301 | { | 303 | { |
302 | setup_clear_cpu_cap(X86_FEATURE_MPX); | 304 | setup_clear_cpu_cap(X86_FEATURE_MPX); |
303 | setup_clear_cpu_cap(X86_FEATURE_AVX); | ||
304 | setup_clear_cpu_cap(X86_FEATURE_AVX2); | ||
305 | setup_clear_cpu_cap(X86_FEATURE_AVX512F); | ||
306 | setup_clear_cpu_cap(X86_FEATURE_AVX512PF); | ||
307 | setup_clear_cpu_cap(X86_FEATURE_AVX512ER); | ||
308 | setup_clear_cpu_cap(X86_FEATURE_AVX512CD); | ||
309 | } | 305 | } |
310 | 306 | ||
311 | /* | 307 | /* |