Skip to content

Commit d91cab7

Browse files
hansendcIngo Molnar
authored andcommitted
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>
1 parent 7593343 commit d91cab7

23 files changed

+103
-82
lines changed

arch/x86/crypto/camellia_aesni_avx2_glue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,8 @@ static int __init camellia_aesni_init(void)
567567
return -ENODEV;
568568
}
569569

570-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
570+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
571+
&feature_name)) {
571572
pr_info("CPU feature '%s' is not supported.\n", feature_name);
572573
return -ENODEV;
573574
}

arch/x86/crypto/camellia_aesni_avx_glue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ static int __init camellia_aesni_init(void)
554554
{
555555
const char *feature_name;
556556

557-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
557+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
558+
&feature_name)) {
558559
pr_info("CPU feature '%s' is not supported.\n", feature_name);
559560
return -ENODEV;
560561
}

arch/x86/crypto/cast5_avx_glue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@ static int __init cast5_init(void)
469469
{
470470
const char *feature_name;
471471

472-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
472+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
473+
&feature_name)) {
473474
pr_info("CPU feature '%s' is not supported.\n", feature_name);
474475
return -ENODEV;
475476
}

arch/x86/crypto/cast6_avx_glue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,8 @@ static int __init cast6_init(void)
591591
{
592592
const char *feature_name;
593593

594-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
594+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
595+
&feature_name)) {
595596
pr_info("CPU feature '%s' is not supported.\n", feature_name);
596597
return -ENODEV;
597598
}

arch/x86/crypto/chacha20_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static int __init chacha20_simd_mod_init(void)
130130

131131
#ifdef CONFIG_AS_AVX2
132132
chacha20_use_avx2 = cpu_has_avx && cpu_has_avx2 &&
133-
cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, NULL);
133+
cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL);
134134
#endif
135135
return crypto_register_alg(&alg);
136136
}

arch/x86/crypto/poly1305_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static int __init poly1305_simd_mod_init(void)
184184

185185
#ifdef CONFIG_AS_AVX2
186186
poly1305_use_avx2 = cpu_has_avx && cpu_has_avx2 &&
187-
cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, NULL);
187+
cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL);
188188
alg.descsize = sizeof(struct poly1305_simd_desc_ctx);
189189
if (poly1305_use_avx2)
190190
alg.descsize += 10 * sizeof(u32);

arch/x86/crypto/serpent_avx2_glue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ static int __init init(void)
542542
pr_info("AVX2 instructions are not detected.\n");
543543
return -ENODEV;
544544
}
545-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
545+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
546+
&feature_name)) {
546547
pr_info("CPU feature '%s' is not supported.\n", feature_name);
547548
return -ENODEV;
548549
}

arch/x86/crypto/serpent_avx_glue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ static int __init serpent_init(void)
597597
{
598598
const char *feature_name;
599599

600-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
600+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM,
601+
&feature_name)) {
601602
pr_info("CPU feature '%s' is not supported.\n", feature_name);
602603
return -ENODEV;
603604
}

arch/x86/crypto/sha1_ssse3_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static struct shash_alg alg = {
121121
#ifdef CONFIG_AS_AVX
122122
static bool __init avx_usable(void)
123123
{
124-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, NULL)) {
124+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
125125
if (cpu_has_avx)
126126
pr_info("AVX detected but unusable.\n");
127127
return false;

arch/x86/crypto/sha256_ssse3_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static struct shash_alg algs[] = { {
130130
#ifdef CONFIG_AS_AVX
131131
static bool __init avx_usable(void)
132132
{
133-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, NULL)) {
133+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
134134
if (cpu_has_avx)
135135
pr_info("AVX detected but unusable.\n");
136136
return false;

arch/x86/crypto/sha512_ssse3_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static struct shash_alg algs[] = { {
129129
#ifdef CONFIG_AS_AVX
130130
static bool __init avx_usable(void)
131131
{
132-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, NULL)) {
132+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
133133
if (cpu_has_avx)
134134
pr_info("AVX detected but unusable.\n");
135135
return false;

arch/x86/crypto/twofish_avx_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static int __init twofish_init(void)
558558
{
559559
const char *feature_name;
560560

561-
if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
561+
if (!cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
562562
pr_info("CPU feature '%s' is not supported.\n", feature_name);
563563
return -ENODEV;
564564
}

arch/x86/include/asm/fpu/types.h

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,30 +95,36 @@ struct swregs_state {
9595
/*
9696
* List of XSAVE features Linux knows about:
9797
*/
98-
enum xfeature_bit {
99-
XSTATE_BIT_FP,
100-
XSTATE_BIT_SSE,
101-
XSTATE_BIT_YMM,
102-
XSTATE_BIT_BNDREGS,
103-
XSTATE_BIT_BNDCSR,
104-
XSTATE_BIT_OPMASK,
105-
XSTATE_BIT_ZMM_Hi256,
106-
XSTATE_BIT_Hi16_ZMM,
98+
enum xfeature {
99+
XFEATURE_FP,
100+
XFEATURE_SSE,
101+
/*
102+
* Values above here are "legacy states".
103+
* Those below are "extended states".
104+
*/
105+
XFEATURE_YMM,
106+
XFEATURE_BNDREGS,
107+
XFEATURE_BNDCSR,
108+
XFEATURE_OPMASK,
109+
XFEATURE_ZMM_Hi256,
110+
XFEATURE_Hi16_ZMM,
107111

108112
XFEATURES_NR_MAX,
109113
};
110114

111-
#define XSTATE_FP (1 << XSTATE_BIT_FP)
112-
#define XSTATE_SSE (1 << XSTATE_BIT_SSE)
113-
#define XSTATE_YMM (1 << XSTATE_BIT_YMM)
114-
#define XSTATE_BNDREGS (1 << XSTATE_BIT_BNDREGS)
115-
#define XSTATE_BNDCSR (1 << XSTATE_BIT_BNDCSR)
116-
#define XSTATE_OPMASK (1 << XSTATE_BIT_OPMASK)
117-
#define XSTATE_ZMM_Hi256 (1 << XSTATE_BIT_ZMM_Hi256)
118-
#define XSTATE_Hi16_ZMM (1 << XSTATE_BIT_Hi16_ZMM)
115+
#define XFEATURE_MASK_FP (1 << XFEATURE_FP)
116+
#define XFEATURE_MASK_SSE (1 << XFEATURE_SSE)
117+
#define XFEATURE_MASK_YMM (1 << XFEATURE_YMM)
118+
#define XFEATURE_MASK_BNDREGS (1 << XFEATURE_BNDREGS)
119+
#define XFEATURE_MASK_BNDCSR (1 << XFEATURE_BNDCSR)
120+
#define XFEATURE_MASK_OPMASK (1 << XFEATURE_OPMASK)
121+
#define XFEATURE_MASK_ZMM_Hi256 (1 << XFEATURE_ZMM_Hi256)
122+
#define XFEATURE_MASK_Hi16_ZMM (1 << XFEATURE_Hi16_ZMM)
119123

120-
#define XSTATE_FPSSE (XSTATE_FP | XSTATE_SSE)
121-
#define XSTATE_AVX512 (XSTATE_OPMASK | XSTATE_ZMM_Hi256 | XSTATE_Hi16_ZMM)
124+
#define XFEATURE_MASK_FPSSE (XFEATURE_MASK_FP | XFEATURE_MASK_SSE)
125+
#define XFEATURE_MASK_AVX512 (XFEATURE_MASK_OPMASK \
126+
| XFEATURE_MASK_ZMM_Hi256 \
127+
| XFEATURE_MASK_Hi16_ZMM)
122128

123129
/*
124130
* There are 16x 256-bit AVX registers named YMM0-YMM15.

arch/x86/include/asm/fpu/xstate.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <linux/uaccess.h>
77

88
/* 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)))
1010

1111
#define XSTATE_CPUID 0x0000000d
1212

@@ -19,14 +19,18 @@
1919
#define XSAVE_YMM_OFFSET (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET)
2020

2121
/* Supported features which support lazy state saving */
22-
#define XSTATE_LAZY (XSTATE_FP | XSTATE_SSE | XSTATE_YMM \
23-
| XSTATE_OPMASK | XSTATE_ZMM_Hi256 | XSTATE_Hi16_ZMM)
22+
#define XFEATURE_MASK_LAZY (XFEATURE_MASK_FP | \
23+
XFEATURE_MASK_SSE | \
24+
XFEATURE_MASK_YMM | \
25+
XFEATURE_MASK_OPMASK | \
26+
XFEATURE_MASK_ZMM_Hi256 | \
27+
XFEATURE_MASK_Hi16_ZMM)
2428

2529
/* 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)
2731

2832
/* All currently supported features */
29-
#define XCNTXT_MASK (XSTATE_LAZY | XSTATE_EAGER)
33+
#define XCNTXT_MASK (XFEATURE_MASK_LAZY | XFEATURE_MASK_EAGER)
3034

3135
#ifdef CONFIG_X86_64
3236
#define REX_PREFIX "0x48, "

arch/x86/kernel/fpu/init.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,11 @@ static void __init fpu__init_system_ctx_switch(void)
290290
if (cpu_has_xsaveopt && eagerfpu != DISABLE)
291291
eagerfpu = ENABLE;
292292

293-
if (xfeatures_mask & XSTATE_EAGER) {
293+
if (xfeatures_mask & XFEATURE_MASK_EAGER) {
294294
if (eagerfpu == DISABLE) {
295295
pr_err("x86/fpu: eagerfpu switching disabled, disabling the following xstate features: 0x%llx.\n",
296-
xfeatures_mask & XSTATE_EAGER);
297-
xfeatures_mask &= ~XSTATE_EAGER;
296+
xfeatures_mask & XFEATURE_MASK_EAGER);
297+
xfeatures_mask &= ~XFEATURE_MASK_EAGER;
298298
} else {
299299
eagerfpu = ENABLE;
300300
}

arch/x86/kernel/fpu/regset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,
6666
* presence of FP and SSE state.
6767
*/
6868
if (cpu_has_xsave)
69-
fpu->state.xsave.header.xfeatures |= XSTATE_FPSSE;
69+
fpu->state.xsave.header.xfeatures |= XFEATURE_MASK_FPSSE;
7070

7171
return ret;
7272
}
@@ -326,7 +326,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
326326
* presence of FP.
327327
*/
328328
if (cpu_has_xsave)
329-
fpu->state.xsave.header.xfeatures |= XSTATE_FP;
329+
fpu->state.xsave.header.xfeatures |= XFEATURE_MASK_FP;
330330
return ret;
331331
}
332332

arch/x86/kernel/fpu/signal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static inline int save_xstate_epilog(void __user *buf, int ia32_frame)
107107
* header as well as change any contents in the memory layout.
108108
* xrestore as part of sigreturn will capture all the changes.
109109
*/
110-
xfeatures |= XSTATE_FPSSE;
110+
xfeatures |= XFEATURE_MASK_FPSSE;
111111

112112
err |= __put_user(xfeatures, (__u32 *)&x->header.xfeatures);
113113

@@ -207,7 +207,7 @@ sanitize_restored_xstate(struct task_struct *tsk,
207207
* layout and not enabled by the OS.
208208
*/
209209
if (fx_only)
210-
header->xfeatures = XSTATE_FPSSE;
210+
header->xfeatures = XFEATURE_MASK_FPSSE;
211211
else
212212
header->xfeatures &= (xfeatures_mask & xfeatures);
213213
}
@@ -230,7 +230,7 @@ static inline int copy_user_to_fpregs_zeroing(void __user *buf, u64 xbv, int fx_
230230
{
231231
if (use_xsave()) {
232232
if ((unsigned long)buf % 64 || fx_only) {
233-
u64 init_bv = xfeatures_mask & ~XSTATE_FPSSE;
233+
u64 init_bv = xfeatures_mask & ~XFEATURE_MASK_FPSSE;
234234
copy_kernel_to_xregs(&init_fpstate.xsave, init_bv);
235235
return copy_user_to_fxregs(buf);
236236
} else {

arch/x86/kernel/fpu/xstate.c

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int cpu_has_xfeatures(u64 xfeatures_needed, const char **feature_name)
7272
/*
7373
* So we use FLS here to be able to print the most advanced
7474
* feature that was requested but is missing. So if a driver
75-
* asks about "XSTATE_SSE | XSTATE_YMM" we'll print the
75+
* asks about "XFEATURE_MASK_SSE | XFEATURE_MASK_YMM" we'll print the
7676
* missing AVX feature - this is the most informative message
7777
* to users:
7878
*/
@@ -131,7 +131,7 @@ void fpstate_sanitize_xstate(struct fpu *fpu)
131131
/*
132132
* FP is in init state
133133
*/
134-
if (!(xfeatures & XSTATE_FP)) {
134+
if (!(xfeatures & XFEATURE_MASK_FP)) {
135135
fx->cwd = 0x37f;
136136
fx->swd = 0;
137137
fx->twd = 0;
@@ -144,7 +144,7 @@ void fpstate_sanitize_xstate(struct fpu *fpu)
144144
/*
145145
* SSE is in init state
146146
*/
147-
if (!(xfeatures & XSTATE_SSE))
147+
if (!(xfeatures & XFEATURE_MASK_SSE))
148148
memset(&fx->xmm_space[0], 0, 256);
149149

150150
/*
@@ -223,14 +223,14 @@ static void __init print_xstate_feature(u64 xstate_mask)
223223
*/
224224
static void __init print_xstate_features(void)
225225
{
226-
print_xstate_feature(XSTATE_FP);
227-
print_xstate_feature(XSTATE_SSE);
228-
print_xstate_feature(XSTATE_YMM);
229-
print_xstate_feature(XSTATE_BNDREGS);
230-
print_xstate_feature(XSTATE_BNDCSR);
231-
print_xstate_feature(XSTATE_OPMASK);
232-
print_xstate_feature(XSTATE_ZMM_Hi256);
233-
print_xstate_feature(XSTATE_Hi16_ZMM);
226+
print_xstate_feature(XFEATURE_MASK_FP);
227+
print_xstate_feature(XFEATURE_MASK_SSE);
228+
print_xstate_feature(XFEATURE_MASK_YMM);
229+
print_xstate_feature(XFEATURE_MASK_BNDREGS);
230+
print_xstate_feature(XFEATURE_MASK_BNDCSR);
231+
print_xstate_feature(XFEATURE_MASK_OPMASK);
232+
print_xstate_feature(XFEATURE_MASK_ZMM_Hi256);
233+
print_xstate_feature(XFEATURE_MASK_Hi16_ZMM);
234234
}
235235

236236
/*
@@ -365,7 +365,11 @@ static int init_xstate_size(void)
365365
return 0;
366366
}
367367

368-
void fpu__init_disable_system_xstate(void)
368+
/*
369+
* We enabled the XSAVE hardware, but something went wrong and
370+
* we can not use it. Disable it.
371+
*/
372+
static void fpu__init_disable_system_xstate(void)
369373
{
370374
xfeatures_mask = 0;
371375
cr4_clear_bits(X86_CR4_OSXSAVE);
@@ -398,7 +402,7 @@ void __init fpu__init_system_xstate(void)
398402
cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
399403
xfeatures_mask = eax + ((u64)edx << 32);
400404

401-
if ((xfeatures_mask & XSTATE_FPSSE) != XSTATE_FPSSE) {
405+
if ((xfeatures_mask & XFEATURE_MASK_FPSSE) != XFEATURE_MASK_FPSSE) {
402406
pr_err("x86/fpu: FP/SSE not present amongst the CPU's xstate features: 0x%llx.\n", xfeatures_mask);
403407
BUG();
404408
}
@@ -451,7 +455,7 @@ void fpu__resume_cpu(void)
451455
* Inputs:
452456
* xstate: the thread's storage area for all FPU data
453457
* xstate_feature: state which is defined in xsave.h (e.g.
454-
* XSTATE_FP, XSTATE_SSE, etc...)
458+
* XFEATURE_MASK_FP, XFEATURE_MASK_SSE, etc...)
455459
* Output:
456460
* address of the state in the xsave area, or NULL if the
457461
* field is not present in the xsave buffer.
@@ -502,8 +506,8 @@ EXPORT_SYMBOL_GPL(get_xsave_addr);
502506
* Note that this only works on the current task.
503507
*
504508
* Inputs:
505-
* @xsave_state: state which is defined in xsave.h (e.g. XSTATE_FP,
506-
* XSTATE_SSE, etc...)
509+
* @xsave_state: state which is defined in xsave.h (e.g. XFEATURE_MASK_FP,
510+
* XFEATURE_MASK_SSE, etc...)
507511
* Output:
508512
* address of the state in the xsave area or NULL if the state
509513
* is not present or is in its 'init state'.

arch/x86/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
384384
* which is all zeros which indicates MPX was not
385385
* responsible for the exception.
386386
*/
387-
bndcsr = get_xsave_field_ptr(XSTATE_BNDCSR);
387+
bndcsr = get_xsave_field_ptr(XFEATURE_MASK_BNDCSR);
388388
if (!bndcsr)
389389
goto exit_trap;
390390

arch/x86/kvm/cpuid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static u32 xstate_required_size(u64 xstate_bv, bool compacted)
3030
int feature_bit = 0;
3131
u32 ret = XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET;
3232

33-
xstate_bv &= XSTATE_EXTEND_MASK;
33+
xstate_bv &= XFEATURE_MASK_EXTEND;
3434
while (xstate_bv) {
3535
if (xstate_bv & 0x1) {
3636
u32 eax, ebx, ecx, edx, offset;
@@ -51,7 +51,7 @@ u64 kvm_supported_xcr0(void)
5151
u64 xcr0 = KVM_SUPPORTED_XCR0 & host_xcr0;
5252

5353
if (!kvm_x86_ops->mpx_supported())
54-
xcr0 &= ~(XSTATE_BNDREGS | XSTATE_BNDCSR);
54+
xcr0 &= ~(XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR);
5555

5656
return xcr0;
5757
}

0 commit comments

Comments
 (0)