x86/fpu: Make os_xrstor_booting() private
authorThomas Gleixner <tglx@linutronix.de>
Fri, 15 Oct 2021 01:16:23 +0000 (03:16 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 20 Oct 2021 13:27:28 +0000 (15:27 +0200)
It's only required in the xstate init code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211015011539.455836597@linutronix.de
arch/x86/include/asm/fpu/internal.h
arch/x86/kernel/fpu/xstate.c

index 5da7528..3ad2ae7 100644 (file)
@@ -226,31 +226,6 @@ static inline void fxsave(struct fxregs_state *fx)
                     : "memory")
 
 /*
- * This function is called only during boot time when x86 caps are not set
- * up and alternative can not be used yet.
- */
-static inline void os_xrstor_booting(struct xregs_state *xstate)
-{
-       u64 mask = xfeatures_mask_fpstate();
-       u32 lmask = mask;
-       u32 hmask = mask >> 32;
-       int err;
-
-       WARN_ON(system_state != SYSTEM_BOOTING);
-
-       if (boot_cpu_has(X86_FEATURE_XSAVES))
-               XSTATE_OP(XRSTORS, xstate, lmask, hmask, err);
-       else
-               XSTATE_OP(XRSTOR, xstate, lmask, hmask, err);
-
-       /*
-        * We should never fault when copying from a kernel buffer, and the FPU
-        * state we set at boot time should be valid.
-        */
-       WARN_ON_FPU(err);
-}
-
-/*
  * Save processor xstate to xsave area.
  *
  * Uses either XSAVE or XSAVEOPT or XSAVES depending on the CPU features
index 1f5a66a..b712c06 100644 (file)
@@ -351,6 +351,29 @@ static void __init print_xstate_offset_size(void)
 }
 
 /*
+ * This function is called only during boot time when x86 caps are not set
+ * up and alternative can not be used yet.
+ */
+static __init void os_xrstor_booting(struct xregs_state *xstate)
+{
+       u64 mask = xfeatures_mask_fpstate();
+       u32 lmask = mask;
+       u32 hmask = mask >> 32;
+       int err;
+
+       if (cpu_feature_enabled(X86_FEATURE_XSAVES))
+               XSTATE_OP(XRSTORS, xstate, lmask, hmask, err);
+       else
+               XSTATE_OP(XRSTOR, xstate, lmask, hmask, err);
+
+       /*
+        * We should never fault when copying from a kernel buffer, and the FPU
+        * state we set at boot time should be valid.
+        */
+       WARN_ON_FPU(err);
+}
+
+/*
  * All supported features have either init state all zeros or are
  * handled in setup_init_fpu() individually. This is an explicit
  * feature list and does not use XFEATURE_MASK*SUPPORTED to catch