xref: /linux/arch/x86/include/asm/fpu/api.h (revision e5c86679d5e864947a52fb31e45a425dea3e7fa9)
1 /*
2  * Copyright (C) 1994 Linus Torvalds
3  *
4  * Pentium III FXSR, SSE support
5  * General FPU state handling cleanups
6  *	Gareth Hughes <gareth@valinux.com>, May 2000
7  * x86-64 work by Andi Kleen 2002
8  */
9 
10 #ifndef _ASM_X86_FPU_API_H
11 #define _ASM_X86_FPU_API_H
12 
13 /*
14  * Careful: __kernel_fpu_begin/end() must be called with preempt disabled
15  * and they don't touch the preempt state on their own.
16  * If you enable preemption after __kernel_fpu_begin(), preempt notifier
17  * should call the __kernel_fpu_end() to prevent the kernel/user FPU
18  * state from getting corrupted. KVM for example uses this model.
19  *
20  * All other cases use kernel_fpu_begin/end() which disable preemption
21  * during kernel FPU usage.
22  */
23 extern void __kernel_fpu_begin(void);
24 extern void __kernel_fpu_end(void);
25 extern void kernel_fpu_begin(void);
26 extern void kernel_fpu_end(void);
27 extern bool irq_fpu_usable(void);
28 
29 /*
30  * Query the presence of one or more xfeatures. Works on any legacy CPU as well.
31  *
32  * If 'feature_name' is set then put a human-readable description of
33  * the feature there as well - this can be used to print error (or success)
34  * messages.
35  */
36 extern int cpu_has_xfeatures(u64 xfeatures_mask, const char **feature_name);
37 
38 #endif /* _ASM_X86_FPU_API_H */
39