x86/fpu: Set up the legacy FPU init image from fpu__init_system()
authorIngo Molnar <mingo@kernel.org>
Sat, 25 Apr 2015 06:35:53 +0000 (08:35 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 19 May 2015 13:47:41 +0000 (15:47 +0200)
The legacy FPU init image is used on older CPUs who don't run xstate init.
But the init code is called within setup_init_fpu_buf(), an xstate method.

Move this legacy init out of the xstate code and put it into fpu/init.c.

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
arch/x86/kernel/fpu/xsave.c

index c1b2d1cfe745b1ed486217a371002269db8ac6f4..30d2d5d03cb01791529931975551a962e90ea1f1 100644 (file)
@@ -158,6 +158,12 @@ void fpu__init_system(void)
        /* The FPU has to be operational for some of the later FPU init activities: */
        fpu__init_cpu();
 
+       /*
+        * Set up the legacy init FPU context. (xstate init might overwrite this
+        * with a more modern format, if the CPU supports it.)
+        */
+       fx_finit(&init_xstate_ctx.i387);
+
        mxcsr_feature_mask_init();
        fpu__init_system_xstate();
        eager_fpu_init();
index fa9b954eb23a36449a2643af6be09ad0f35e871a..6be0a98238f6363d3f486db8d36213dc3300f78a 100644 (file)
@@ -576,12 +576,6 @@ static void setup_init_fpu_buf(void)
                return;
        on_boot_cpu = 0;
 
-       /*
-        * Setup init_xstate_ctx to represent the init state of
-        * all the features managed by the xsave
-        */
-       fx_finit(&init_xstate_ctx.i387);
-
        if (!cpu_has_xsave)
                return;