Merge branch 'x86-xsave-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / arch / x86 / include / asm / fpu-internal.h
index 115e3689cd53de35b5689528351ba758d22bb84d..412ececa00b957014a535e0a36d15ae108a88ffa 100644 (file)
@@ -293,7 +293,7 @@ static inline int restore_fpu_checking(struct task_struct *tsk)
        /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
           is pending.  Clear the x87 state here by setting it to fixed
           values. "m" is a random variable that should be in L1 */
-       if (unlikely(static_cpu_has_safe(X86_FEATURE_FXSAVE_LEAK))) {
+       if (unlikely(static_cpu_has_bug_safe(X86_BUG_FXSAVE_LEAK))) {
                asm volatile(
                        "fnclex\n\t"
                        "emms\n\t"
@@ -508,9 +508,12 @@ static inline void user_fpu_begin(void)
 
 static inline void __save_fpu(struct task_struct *tsk)
 {
-       if (use_xsave())
-               xsave_state(&tsk->thread.fpu.state->xsave, -1);
-       else
+       if (use_xsave()) {
+               if (unlikely(system_state == SYSTEM_BOOTING))
+                       xsave_state_booting(&tsk->thread.fpu.state->xsave, -1);
+               else
+                       xsave_state(&tsk->thread.fpu.state->xsave, -1);
+       } else
                fpu_fxsave(&tsk->thread.fpu);
 }