extern void fpu__cpu_init(void);
extern void eager_fpu_init(void);
+extern void fpu__init_system_xstate(void);
+extern void fpu__init_cpu_xstate(void);
+
DECLARE_PER_CPU(struct fpu *, fpu_fpregs_owner_ctx);
extern void convert_from_fxsr(struct user_i387_ia32_struct *env,
}
/*
- * Enable the extended processor state save/restore feature
+ * Enable the extended processor state save/restore feature.
+ * Called once per CPU onlining.
*/
-static inline void xstate_enable(void)
+void fpu__init_cpu_xstate(void)
{
+ if (!xfeatures_mask)
+ return;
+
cr4_set_bits(X86_CR4_OSXSAVE);
xsetbv(XCR_XFEATURE_ENABLED_MASK, xfeatures_mask);
}
/*
* Enable and initialize the xsave feature.
+ * Called once per system bootup.
*
* ( Not marked __init because of false positive section warnings
* generated by xsave_init(). )
*/
-static void /* __init */ xstate_enable_boot_cpu(void)
+void fpu__init_system_xstate(void)
{
unsigned int eax, ebx, ecx, edx;
*/
xfeatures_mask = xfeatures_mask & XCNTXT_MASK;
- xstate_enable();
+ /* Enable xstate instructions to be able to continue with initialization: */
+ fpu__init_cpu_xstate();
/*
* Recompute the context size for enabled features
}
/*
- * For the very first instance, this calls xstate_enable_boot_cpu();
- * for all subsequent instances, this calls xstate_enable().
+ * For the very first instance, this calls fpu__init_system_xstate();
+ * for all subsequent instances, this calls fpu__init_cpu_xstate().
*/
void xsave_init(void)
{
if (on_boot_cpu) {
on_boot_cpu = 0;
- xstate_enable_boot_cpu();
+ fpu__init_system_xstate();
} else {
- xstate_enable();
+ fpu__init_cpu_xstate();
}
}