summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/fpu/api.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-04-28 09:51:17 +0300
committerIngo Molnar <mingo@kernel.org>2015-05-19 16:47:55 +0300
commit5b07343034ec9ebb0d443743c7381b25875d0067 (patch)
treefabe0f5a8c60c36a206fb3aa2135ed10bc4140a7 /arch/x86/include/asm/fpu/api.h
parent62784854502895321d100b1004b486131b9dd286 (diff)
downloadlinux-5b07343034ec9ebb0d443743c7381b25875d0067.tar.xz
x86/fpu: Introduce cpu_has_xfeatures(xfeatures_mask, feature_name)
A lot of FPU using driver code is querying complex CPU features to be able to figure out whether a given set of xstate features is supported by the CPU or not. Introduce a simplified API function that can be used on any CPU type to get this information. Also add an error string return pointer, so that the driver can print a meaningful error message with a standardized feature name. Also mark xfeatures_mask as __read_only. Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/fpu/api.h')
-rw-r--r--arch/x86/include/asm/fpu/api.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h
index 62035cc1d961..1429a7c736db 100644
--- a/arch/x86/include/asm/fpu/api.h
+++ b/arch/x86/include/asm/fpu/api.h
@@ -36,4 +36,13 @@ extern bool irq_fpu_usable(void);
extern int irq_ts_save(void);
extern void irq_ts_restore(int TS_state);
+/*
+ * Query the presence of one or more xfeatures. Works on any legacy CPU as well.
+ *
+ * If 'feature_name' is set then put a human-readable description of
+ * the feature there as well - this can be used to print error (or success)
+ * messages.
+ */
+extern int cpu_has_xfeatures(u64 xfeatures_mask, const char **feature_name);
+
#endif /* _ASM_X86_FPU_API_H */