aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
authorDave Hansen <dave.hansen@linux.intel.com>2015-09-02 19:31:26 -0400
committerIngo Molnar <mingo@kernel.org>2015-09-14 06:21:46 -0400
commitd91cab78133d33b1dfd3d3fa7167fcbf74fb5f99 (patch)
tree7c4367804ee4e24bf2ed4aa031ef826a679930a4 /arch/x86/include
parent75933433d666c2ab13a7a93f4ec1e6f000a94ffc (diff)
x86/fpu: Rename XSAVE macros
There are two concepts that have some confusing naming: 1. Extended State Component numbers (currently called XFEATURE_BIT_*) 2. Extended State Component masks (currently called XSTATE_*) The numbers are (currently) from 0-9. State component 3 is the bounds registers for MPX, for instance. But when we want to enable "state component 3", we go set a bit in XCR0. The bit we set is 1<<3. We can check to see if a state component feature is enabled by looking at its bit. The current 'xfeature_bit's are at best xfeature bit _numbers_. Calling them bits is at best inconsistent with ending the enum list with 'XFEATURES_NR_MAX'. This patch renames the enum to be 'xfeature'. These also happen to be what the Intel documentation calls a "state component". We also want to differentiate these from the "XSTATE_*" macros. The "XSTATE_*" macros are a mask, and we rename them to match. These macros are reasonably widely used so this patch is a wee bit big, but this really is just a rename. The only non-mechanical part of this is the s/XSTATE_EXTEND_MASK/XFEATURE_MASK_EXTEND/ We need a better name for it, but that's another patch. Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tim Chen <tim.c.chen@linux.intel.com> Cc: dave@sr71.net Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/r/20150902233126.38653250@viggo.jf.intel.com [ Ported to v4.3-rc1. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/fpu/types.h44
-rw-r--r--arch/x86/include/asm/fpu/xstate.h14
2 files changed, 34 insertions, 24 deletions
diff --git a/arch/x86/include/asm/fpu/types.h b/arch/x86/include/asm/fpu/types.h
index 5dc1a18ef11c..9f20d10af3b1 100644
--- a/arch/x86/include/asm/fpu/types.h
+++ b/arch/x86/include/asm/fpu/types.h
@@ -95,30 +95,36 @@ struct swregs_state {
95/* 95/*
96 * List of XSAVE features Linux knows about: 96 * List of XSAVE features Linux knows about:
97 */ 97 */
98enum xfeature_bit { 98enum xfeature {
99 XSTATE_BIT_FP, 99 XFEATURE_FP,
100 XSTATE_BIT_SSE, 100 XFEATURE_SSE,
101 XSTATE_BIT_YMM, 101 /*
102 XSTATE_BIT_BNDREGS, 102 * Values above here are "legacy states".
103 XSTATE_BIT_BNDCSR, 103 * Those below are "extended states".
104 XSTATE_BIT_OPMASK, 104 */
105 XSTATE_BIT_ZMM_Hi256, 105 XFEATURE_YMM,
106 XSTATE_BIT_Hi16_ZMM, 106 XFEATURE_BNDREGS,
107 XFEATURE_BNDCSR,
108 XFEATURE_OPMASK,
109 XFEATURE_ZMM_Hi256,
110 XFEATURE_Hi16_ZMM,
107 111
108 XFEATURES_NR_MAX, 112 XFEATURES_NR_MAX,
109}; 113};
110 114
111#define XSTATE_FP (1 << XSTATE_BIT_FP) 115#define XFEATURE_MASK_FP (1 << XFEATURE_FP)
112#define XSTATE_SSE (1 << XSTATE_BIT_SSE) 116#define XFEATURE_MASK_SSE (1 << XFEATURE_SSE)
113#define XSTATE_YMM (1 << XSTATE_BIT_YMM) 117#define XFEATURE_MASK_YMM (1 << XFEATURE_YMM)
114#define XSTATE_BNDREGS (1 << XSTATE_BIT_BNDREGS) 118#define XFEATURE_MASK_BNDREGS (1 << XFEATURE_BNDREGS)
115#define XSTATE_BNDCSR (1 << XSTATE_BIT_BNDCSR) 119#define XFEATURE_MASK_BNDCSR (1 << XFEATURE_BNDCSR)
116#define XSTATE_OPMASK (1 << XSTATE_BIT_OPMASK) 120#define XFEATURE_MASK_OPMASK (1 << XFEATURE_OPMASK)
117#define XSTATE_ZMM_Hi256 (1 << XSTATE_BIT_ZMM_Hi256) 121#define XFEATURE_MASK_ZMM_Hi256 (1 << XFEATURE_ZMM_Hi256)
118#define XSTATE_Hi16_ZMM (1 << XSTATE_BIT_Hi16_ZMM) 122#define XFEATURE_MASK_Hi16_ZMM (1 << XFEATURE_Hi16_ZMM)
119 123
120#define XSTATE_FPSSE (XSTATE_FP | XSTATE_SSE) 124#define XFEATURE_MASK_FPSSE (XFEATURE_MASK_FP | XFEATURE_MASK_SSE)
121#define XSTATE_AVX512 (XSTATE_OPMASK | XSTATE_ZMM_Hi256 | XSTATE_Hi16_ZMM) 125#define XFEATURE_MASK_AVX512 (XFEATURE_MASK_OPMASK \
126 | XFEATURE_MASK_ZMM_Hi256 \
127 | XFEATURE_MASK_Hi16_ZMM)
122 128
123/* 129/*
124 * There are 16x 256-bit AVX registers named YMM0-YMM15. 130 * There are 16x 256-bit AVX registers named YMM0-YMM15.
diff --git a/arch/x86/include/asm/fpu/xstate.h b/arch/x86/include/asm/fpu/xstate.h
index d5a9b736553c..3a6c89b70307 100644
--- a/arch/x86/include/asm/fpu/xstate.h
+++ b/arch/x86/include/asm/fpu/xstate.h
@@ -6,7 +6,7 @@
6#include <linux/uaccess.h> 6#include <linux/uaccess.h>
7 7
8/* Bit 63 of XCR0 is reserved for future expansion */ 8/* Bit 63 of XCR0 is reserved for future expansion */
9#define XSTATE_EXTEND_MASK (~(XSTATE_FPSSE | (1ULL << 63))) 9#define XFEATURE_MASK_EXTEND (~(XFEATURE_MASK_FPSSE | (1ULL << 63)))
10 10
11#define XSTATE_CPUID 0x0000000d 11#define XSTATE_CPUID 0x0000000d
12 12
@@ -19,14 +19,18 @@
19#define XSAVE_YMM_OFFSET (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET) 19#define XSAVE_YMM_OFFSET (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET)
20 20
21/* Supported features which support lazy state saving */ 21/* Supported features which support lazy state saving */
22#define XSTATE_LAZY (XSTATE_FP | XSTATE_SSE | XSTATE_YMM \ 22#define XFEATURE_MASK_LAZY (XFEATURE_MASK_FP | \
23 | XSTATE_OPMASK | XSTATE_ZMM_Hi256 | XSTATE_Hi16_ZMM) 23 XFEATURE_MASK_SSE | \
24 XFEATURE_MASK_YMM | \
25 XFEATURE_MASK_OPMASK | \
26 XFEATURE_MASK_ZMM_Hi256 | \
27 XFEATURE_MASK_Hi16_ZMM)
24 28
25/* Supported features which require eager state saving */ 29/* Supported features which require eager state saving */
26#define XSTATE_EAGER (XSTATE_BNDREGS | XSTATE_BNDCSR) 30#define XFEATURE_MASK_EAGER (XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR)
27 31
28/* All currently supported features */ 32/* All currently supported features */
29#define XCNTXT_MASK (XSTATE_LAZY | XSTATE_EAGER) 33#define XCNTXT_MASK (XFEATURE_MASK_LAZY | XFEATURE_MASK_EAGER)
30 34
31#ifdef CONFIG_X86_64 35#ifdef CONFIG_X86_64
32#define REX_PREFIX "0x48, " 36#define REX_PREFIX "0x48, "