Skip to content

Commit 8c9e607

Browse files
yyu-intel-comsuryasaimadhu
authored andcommitted
x86/fpu/xstate: Fix small issues
In response to earlier comments, fix small issues before introducing XSAVES supervisor states: - Fix comments of xfeature_is_supervisor(). - Replace ((u64)1 << 63) with XCOMP_BV_COMPACTED_FORMAT. No functional changes. Signed-off-by: Yu-cheng Yu <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Dave Hansen <[email protected]> Reviewed-by: Tony Luck <[email protected]> Acked-by: Sebastian Andrzej Siewior <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: "Ravi V. Shankar" <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: x86-ml <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent c79f46a commit 8c9e607

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

arch/x86/kernel/fpu/xstate.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,9 @@ EXPORT_SYMBOL_GPL(cpu_has_xfeatures);
110110
static int xfeature_is_supervisor(int xfeature_nr)
111111
{
112112
/*
113-
* We currently do not support supervisor states, but if
114-
* we did, we could find out like this.
115-
*
116-
* SDM says: If state component 'i' is a user state component,
117-
* ECX[0] return 0; if state component i is a supervisor
118-
* state component, ECX[0] returns 1.
113+
* Extended State Enumeration Sub-leaves (EAX = 0DH, ECX = n, n > 1)
114+
* returns ECX[0] set to (1) for a supervisor state, and cleared (0)
115+
* for a user state.
119116
*/
120117
u32 eax, ebx, ecx, edx;
121118

@@ -419,7 +416,8 @@ static void __init setup_init_fpu_buf(void)
419416
print_xstate_features();
420417

421418
if (boot_cpu_has(X86_FEATURE_XSAVES))
422-
init_fpstate.xsave.header.xcomp_bv = (u64)1 << 63 | xfeatures_mask;
419+
init_fpstate.xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT |
420+
xfeatures_mask;
423421

424422
/*
425423
* Init all the features state with header.xfeatures being 0x0

0 commit comments

Comments
 (0)