]> git.karo-electronics.de Git - linux-beck.git/commitdiff
x86/fpu: Move the fpstate_xstate_init_size() call into fpu__init_system()
authorIngo Molnar <mingo@kernel.org>
Sun, 26 Apr 2015 08:35:57 +0000 (10:35 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 19 May 2015 13:47:43 +0000 (15:47 +0200)
The fpstate_xstate_init_size() function sets up a basic xstate_size, called
during fpu__detect() currently.

Its real dependency is to be called before fpu__init_system_xstate().

So move the function call site into fpu__init_system(), to right before the
fpu__init_system_xstate() call.

Also add a once-per-boot flag to fpstate_xstate_init_size(), we'll remove
this quirk later once we've cleaned up the init dependencies.

This moves the two related functions closer to each other and makes them
both part of the _init_system() functionality.

Currently we do the fpstate_xstate_init_size()
Reviewed-by: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/fpu/init.c

index 567e7e6cdc6b05cb074a69aa26e9019d70b5f0fe..ca3468d8bc315ba3726628646df086bc2ac54d30 100644 (file)
@@ -96,6 +96,12 @@ static void mxcsr_feature_mask_init(void)
 
 static void fpstate_xstate_init_size(void)
 {
+       static bool on_boot_cpu = 1;
+
+       if (!on_boot_cpu)
+               return;
+       on_boot_cpu = 0;
+
        /*
         * Note that xstate_size might be overwriten later during
         * fpu__init_system_xstate().
@@ -227,7 +233,10 @@ void fpu__init_system(void)
        fx_finit(&init_xstate_ctx.i387);
 
        mxcsr_feature_mask_init();
+
+       fpstate_xstate_init_size();
        fpu__init_system_xstate();
+
        fpu__init_system_ctx_switch();
        fpu__init_cpu_ctx_switch();
 }
@@ -270,6 +279,4 @@ void fpu__detect(struct cpuinfo_x86 *c)
                clear_cpu_cap(c, X86_FEATURE_FPU);
 
        /* The final cr0 value is set later, in fpu_init() */
-
-       fpstate_xstate_init_size();
 }