x86/fpu: Introduce cpu_has_xfeatures(xfeatures_mask, feature_name)
authorIngo Molnar <mingo@kernel.org>
Tue, 28 Apr 2015 06:51:17 +0000 (08:51 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 19 May 2015 13:47:55 +0000 (15:47 +0200)
commit5b07343034ec9ebb0d443743c7381b25875d0067
treefabe0f5a8c60c36a206fb3aa2135ed10bc4140a7
parent62784854502895321d100b1004b486131b9dd286
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>
arch/x86/include/asm/fpu/api.h
arch/x86/kernel/fpu/xstate.c