xref: /linux/arch/x86/kernel/fpu/internal.h (revision 40d269c000bda9fcd276a0412a9cebd3f6e344c5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __X86_KERNEL_FPU_INTERNAL_H
3 #define __X86_KERNEL_FPU_INTERNAL_H
4 
5 extern struct fpstate init_fpstate;
6 
7 /* CPU feature check wrappers */
8 static __always_inline __pure bool use_xsave(void)
9 {
10 	return cpu_feature_enabled(X86_FEATURE_XSAVE);
11 }
12 
13 static __always_inline __pure bool use_fxsr(void)
14 {
15 	return cpu_feature_enabled(X86_FEATURE_FXSR);
16 }
17 
18 #ifdef CONFIG_X86_DEBUG_FPU
19 # define WARN_ON_FPU(x) WARN_ON_ONCE(x)
20 #else
21 # define WARN_ON_FPU(x) ({ (void)(x); 0; })
22 #endif
23 
24 /* Used in init.c */
25 extern void fpstate_init_user(struct fpstate *fpstate);
26 extern void fpstate_reset(struct fpu *fpu);
27 
28 #endif
29