Skip to content

Commit 754aaac

Browse files
committed
x86/fpu: Move CPUID leaf definitions to common code
Move the XSAVE-related CPUID leaf definitions to common code. Then, use the new definition to remove the last magic number from the CPUID level dependency table. Signed-off-by: Dave Hansen <[email protected]> Reviewed-by: Zhao Liu <[email protected]> Link: https://lore.kernel.org/all/20241213205037.43C57CDE%40davehans-spike.ostc.intel.com
1 parent e558ead commit 754aaac

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

arch/x86/include/asm/cpuid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ enum cpuid_regs_idx {
2323

2424
#define CPUID_MWAIT_LEAF 0x5
2525
#define CPUID_DCA_LEAF 0x9
26+
#define XSTATE_CPUID 0x0d
2627
#define CPUID_TSC_LEAF 0x15
2728
#define CPUID_FREQ_LEAF 0x16
29+
#define TILE_CPUID 0x1d
2830

2931
#ifdef CONFIG_X86_32
3032
bool have_cpuid_p(void);

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
/* Bit 63 of XCR0 is reserved for future expansion */
1313
#define XFEATURE_MASK_EXTEND (~(XFEATURE_MASK_FPSSE | (1ULL << 63)))
1414

15-
#define XSTATE_CPUID 0x0000000d
16-
17-
#define TILE_CPUID 0x0000001d
18-
1915
#define FXSAVE_SIZE 512
2016

2117
#define XSAVE_HDR_SIZE 64

arch/x86/kernel/cpu/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ static const struct cpuid_dependent_feature
639639
cpuid_dependent_features[] = {
640640
{ X86_FEATURE_MWAIT, CPUID_MWAIT_LEAF },
641641
{ X86_FEATURE_DCA, CPUID_DCA_LEAF },
642-
{ X86_FEATURE_XSAVE, 0x0000000d },
642+
{ X86_FEATURE_XSAVE, XSTATE_CPUID },
643643
{ 0, 0 }
644644
};
645645

arch/x86/kernel/fpu/xstate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <asm/fpu/signal.h>
2121
#include <asm/fpu/xcr.h>
2222

23+
#include <asm/cpuid.h>
2324
#include <asm/tlbflush.h>
2425
#include <asm/prctl.h>
2526
#include <asm/elf.h>

0 commit comments

Comments
 (0)