diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 3e0fee5bc2e7..d6234adc8ba0 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c @@ -118,13 +118,9 @@ static void fpstate_xstate_init_size(void) } /* - * Called on the boot CPU at bootup to set up the initial FPU state that - * is later cloned into all processes. - * - * Also called on secondary CPUs to set up the FPU state of their - * idle threads. + * Enable all supported FPU features. Called when a CPU is brought online. */ -void fpu__cpu_init(void) +void fpu__init_cpu(void) { unsigned long cr0; unsigned long cr4_mask = 0; @@ -150,12 +146,29 @@ void fpu__cpu_init(void) cr0 |= X86_CR0_EM; write_cr0(cr0); + xsave_init(); +} + +/* + * Called on the boot CPU once per system bootup, to set up the initial FPU state that + * is later cloned into all processes. + */ +void fpu__init_system(void) +{ + /* The FPU has to be operational for some of the later FPU init activities: */ + fpu__init_cpu(); mxcsr_feature_mask_init(); xsave_init(); eager_fpu_init(); } +void fpu__cpu_init(void) +{ + fpu__init_cpu(); + fpu__init_system(); +} + static int __init no_387(char *s) { setup_clear_cpu_cap(X86_FEATURE_FPU);