Skip to content

Commit e5d3a57

Browse files
committed
x86/cpu: Make all all CPUID leaf names consistent
The leaf names are not consistent. Give them all a CPUID_LEAF_ prefix for consistency and vertical alignment. Signed-off-by: Dave Hansen <[email protected]> Acked-by: Dave Jiang <[email protected]> # for ioatdma bits Link: https://lore.kernel.org/all/20241213205040.7B0C3241%40davehans-spike.ostc.intel.com
1 parent 588e148 commit e5d3a57

File tree

14 files changed

+42
-42
lines changed

14 files changed

+42
-42
lines changed

arch/x86/events/intel/pt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ static int __init pt_pmu_hw_init(void)
202202
* otherwise, zero for numerator stands for "not enumerated"
203203
* as per SDM
204204
*/
205-
if (boot_cpu_data.cpuid_level >= CPUID_TSC_LEAF) {
205+
if (boot_cpu_data.cpuid_level >= CPUID_LEAF_TSC) {
206206
u32 eax, ebx, ecx, edx;
207207

208-
cpuid(CPUID_TSC_LEAF, &eax, &ebx, &ecx, &edx);
208+
cpuid(CPUID_LEAF_TSC, &eax, &ebx, &ecx, &edx);
209209

210210
pt_pmu.tsc_art_num = ebx;
211211
pt_pmu.tsc_art_den = eax;

arch/x86/include/asm/cpuid.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ enum cpuid_regs_idx {
2121
CPUID_EDX,
2222
};
2323

24-
#define CPUID_MWAIT_LEAF 0x5
25-
#define CPUID_DCA_LEAF 0x9
26-
#define XSTATE_CPUID 0x0d
27-
#define CPUID_TSC_LEAF 0x15
28-
#define CPUID_FREQ_LEAF 0x16
29-
#define TILE_CPUID 0x1d
24+
#define CPUID_LEAF_MWAIT 0x5
25+
#define CPUID_LEAF_DCA 0x9
26+
#define CPUID_LEAF_XSTATE 0x0d
27+
#define CPUID_LEAF_TSC 0x15
28+
#define CPUID_LEAF_FREQ 0x16
29+
#define CPUID_LEAF_TILE 0x1d
3030

3131
#ifdef CONFIG_X86_32
3232
bool have_cpuid_p(void);

arch/x86/kernel/acpi/cstate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
129129
unsigned int cstate_type; /* C-state type and not ACPI C-state type */
130130
unsigned int num_cstate_subtype;
131131

132-
cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
132+
cpuid(CPUID_LEAF_MWAIT, &eax, &ebx, &ecx, &edx);
133133

134134
/* Check whether this particular cx_type (in CST) is supported or not */
135135
cstate_type = (((cx->address >> MWAIT_SUBSTATE_SIZE) &
@@ -173,7 +173,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
173173
struct cpuinfo_x86 *c = &cpu_data(cpu);
174174
long retval;
175175

176-
if (!cpu_cstate_entry || c->cpuid_level < CPUID_MWAIT_LEAF)
176+
if (!cpu_cstate_entry || c->cpuid_level < CPUID_LEAF_MWAIT)
177177
return -1;
178178

179179
if (reg->bit_offset != NATIVE_CSTATE_BEYOND_HALT)

arch/x86/kernel/cpu/common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,9 @@ struct cpuid_dependent_feature {
637637

638638
static const struct cpuid_dependent_feature
639639
cpuid_dependent_features[] = {
640-
{ X86_FEATURE_MWAIT, CPUID_MWAIT_LEAF },
641-
{ X86_FEATURE_DCA, CPUID_DCA_LEAF },
642-
{ X86_FEATURE_XSAVE, XSTATE_CPUID },
640+
{ X86_FEATURE_MWAIT, CPUID_LEAF_MWAIT },
641+
{ X86_FEATURE_DCA, CPUID_LEAF_DCA },
642+
{ X86_FEATURE_XSAVE, CPUID_LEAF_XSTATE },
643643
{ 0, 0 }
644644
};
645645

arch/x86/kernel/fpu/xstate.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static void __init setup_xstate_cache(void)
233233
xmm_space);
234234

235235
for_each_extended_xfeature(i, fpu_kernel_cfg.max_features) {
236-
cpuid_count(XSTATE_CPUID, i, &eax, &ebx, &ecx, &edx);
236+
cpuid_count(CPUID_LEAF_XSTATE, i, &eax, &ebx, &ecx, &edx);
237237

238238
xstate_sizes[i] = eax;
239239
xstate_flags[i] = ecx;
@@ -399,7 +399,7 @@ int xfeature_size(int xfeature_nr)
399399
u32 eax, ebx, ecx, edx;
400400

401401
CHECK_XFEATURE(xfeature_nr);
402-
cpuid_count(XSTATE_CPUID, xfeature_nr, &eax, &ebx, &ecx, &edx);
402+
cpuid_count(CPUID_LEAF_XSTATE, xfeature_nr, &eax, &ebx, &ecx, &edx);
403403
return eax;
404404
}
405405

@@ -442,9 +442,9 @@ static void __init __xstate_dump_leaves(void)
442442
* just in case there are some goodies up there
443443
*/
444444
for (i = 0; i < XFEATURE_MAX + 10; i++) {
445-
cpuid_count(XSTATE_CPUID, i, &eax, &ebx, &ecx, &edx);
445+
cpuid_count(CPUID_LEAF_XSTATE, i, &eax, &ebx, &ecx, &edx);
446446
pr_warn("CPUID[%02x, %02x]: eax=%08x ebx=%08x ecx=%08x edx=%08x\n",
447-
XSTATE_CPUID, i, eax, ebx, ecx, edx);
447+
CPUID_LEAF_XSTATE, i, eax, ebx, ecx, edx);
448448
}
449449
}
450450

@@ -485,7 +485,7 @@ static int __init check_xtile_data_against_struct(int size)
485485
* Check the maximum palette id:
486486
* eax: the highest numbered palette subleaf.
487487
*/
488-
cpuid_count(TILE_CPUID, 0, &max_palid, &ebx, &ecx, &edx);
488+
cpuid_count(CPUID_LEAF_TILE, 0, &max_palid, &ebx, &ecx, &edx);
489489

490490
/*
491491
* Cross-check each tile size and find the maximum number of
@@ -499,7 +499,7 @@ static int __init check_xtile_data_against_struct(int size)
499499
* eax[31:16]: bytes per title
500500
* ebx[31:16]: the max names (or max number of tiles)
501501
*/
502-
cpuid_count(TILE_CPUID, palid, &eax, &ebx, &edx, &edx);
502+
cpuid_count(CPUID_LEAF_TILE, palid, &eax, &ebx, &edx, &edx);
503503
tile_size = eax >> 16;
504504
max = ebx >> 16;
505505

@@ -634,7 +634,7 @@ static unsigned int __init get_compacted_size(void)
634634
* are no supervisor states, but XSAVEC still uses compacted
635635
* format.
636636
*/
637-
cpuid_count(XSTATE_CPUID, 1, &eax, &ebx, &ecx, &edx);
637+
cpuid_count(CPUID_LEAF_XSTATE, 1, &eax, &ebx, &ecx, &edx);
638638
return ebx;
639639
}
640640

@@ -675,7 +675,7 @@ static unsigned int __init get_xsave_size_user(void)
675675
* containing all the *user* state components
676676
* corresponding to bits currently set in XCR0.
677677
*/
678-
cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
678+
cpuid_count(CPUID_LEAF_XSTATE, 0, &eax, &ebx, &ecx, &edx);
679679
return ebx;
680680
}
681681

@@ -767,13 +767,13 @@ void __init fpu__init_system_xstate(unsigned int legacy_size)
767767
/*
768768
* Find user xstates supported by the processor.
769769
*/
770-
cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
770+
cpuid_count(CPUID_LEAF_XSTATE, 0, &eax, &ebx, &ecx, &edx);
771771
fpu_kernel_cfg.max_features = eax + ((u64)edx << 32);
772772

773773
/*
774774
* Find supervisor xstates supported by the processor.
775775
*/
776-
cpuid_count(XSTATE_CPUID, 1, &eax, &ebx, &ecx, &edx);
776+
cpuid_count(CPUID_LEAF_XSTATE, 1, &eax, &ebx, &ecx, &edx);
777777
fpu_kernel_cfg.max_features |= ecx + ((u64)edx << 32);
778778

779779
if ((fpu_kernel_cfg.max_features & XFEATURE_MASK_FPSSE) != XFEATURE_MASK_FPSSE) {

arch/x86/kernel/hpet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ static bool __init mwait_pc10_supported(void)
928928
if (!cpu_feature_enabled(X86_FEATURE_MWAIT))
929929
return false;
930930

931-
cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates);
931+
cpuid(CPUID_LEAF_MWAIT, &eax, &ebx, &ecx, &mwait_substates);
932932

933933
return (ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) &&
934934
(ecx & CPUID5_ECX_INTERRUPT_BREAK) &&

arch/x86/kernel/process.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ static __init bool prefer_mwait_c1_over_halt(void)
878878
if (boot_cpu_has_bug(X86_BUG_MONITOR) || boot_cpu_has_bug(X86_BUG_AMD_APIC_C1E))
879879
return false;
880880

881-
cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
881+
cpuid(CPUID_LEAF_MWAIT, &eax, &ebx, &ecx, &edx);
882882

883883
/*
884884
* If MWAIT extensions are not available, it is safe to use MWAIT

arch/x86/kernel/smpboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ static inline void mwait_play_dead(void)
12931293
if (!this_cpu_has(X86_FEATURE_CLFLUSH))
12941294
return;
12951295

1296-
eax = CPUID_MWAIT_LEAF;
1296+
eax = CPUID_LEAF_MWAIT;
12971297
ecx = 0;
12981298
native_cpuid(&eax, &ebx, &ecx, &edx);
12991299

arch/x86/kernel/tsc.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -666,13 +666,13 @@ unsigned long native_calibrate_tsc(void)
666666
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
667667
return 0;
668668

669-
if (boot_cpu_data.cpuid_level < CPUID_TSC_LEAF)
669+
if (boot_cpu_data.cpuid_level < CPUID_LEAF_TSC)
670670
return 0;
671671

672672
eax_denominator = ebx_numerator = ecx_hz = edx = 0;
673673

674674
/* CPUID 15H TSC/Crystal ratio, plus optionally Crystal Hz */
675-
cpuid(CPUID_TSC_LEAF, &eax_denominator, &ebx_numerator, &ecx_hz, &edx);
675+
cpuid(CPUID_LEAF_TSC, &eax_denominator, &ebx_numerator, &ecx_hz, &edx);
676676

677677
if (ebx_numerator == 0 || eax_denominator == 0)
678678
return 0;
@@ -681,7 +681,7 @@ unsigned long native_calibrate_tsc(void)
681681

682682
/*
683683
* Denverton SoCs don't report crystal clock, and also don't support
684-
* CPUID_FREQ_LEAF for the calculation below, so hardcode the 25MHz
684+
* CPUID_LEAF_FREQ for the calculation below, so hardcode the 25MHz
685685
* crystal clock.
686686
*/
687687
if (crystal_khz == 0 &&
@@ -701,10 +701,10 @@ unsigned long native_calibrate_tsc(void)
701701
* clock, but we can easily calculate it to a high degree of accuracy
702702
* by considering the crystal ratio and the CPU speed.
703703
*/
704-
if (crystal_khz == 0 && boot_cpu_data.cpuid_level >= CPUID_FREQ_LEAF) {
704+
if (crystal_khz == 0 && boot_cpu_data.cpuid_level >= CPUID_LEAF_FREQ) {
705705
unsigned int eax_base_mhz, ebx, ecx, edx;
706706

707-
cpuid(CPUID_FREQ_LEAF, &eax_base_mhz, &ebx, &ecx, &edx);
707+
cpuid(CPUID_LEAF_FREQ, &eax_base_mhz, &ebx, &ecx, &edx);
708708
crystal_khz = eax_base_mhz * 1000 *
709709
eax_denominator / ebx_numerator;
710710
}
@@ -739,12 +739,12 @@ static unsigned long cpu_khz_from_cpuid(void)
739739
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
740740
return 0;
741741

742-
if (boot_cpu_data.cpuid_level < CPUID_FREQ_LEAF)
742+
if (boot_cpu_data.cpuid_level < CPUID_LEAF_FREQ)
743743
return 0;
744744

745745
eax_base_mhz = ebx_max_mhz = ecx_bus_mhz = edx = 0;
746746

747-
cpuid(CPUID_FREQ_LEAF, &eax_base_mhz, &ebx_max_mhz, &ecx_bus_mhz, &edx);
747+
cpuid(CPUID_LEAF_FREQ, &eax_base_mhz, &ebx_max_mhz, &ecx_bus_mhz, &edx);
748748

749749
return eax_base_mhz * 1000;
750750
}
@@ -1077,7 +1077,7 @@ static void __init detect_art(void)
10771077
{
10781078
unsigned int unused;
10791079

1080-
if (boot_cpu_data.cpuid_level < CPUID_TSC_LEAF)
1080+
if (boot_cpu_data.cpuid_level < CPUID_LEAF_TSC)
10811081
return;
10821082

10831083
/*
@@ -1090,7 +1090,7 @@ static void __init detect_art(void)
10901090
tsc_async_resets)
10911091
return;
10921092

1093-
cpuid(CPUID_TSC_LEAF, &art_base_clk.denominator,
1093+
cpuid(CPUID_LEAF_TSC, &art_base_clk.denominator,
10941094
&art_base_clk.numerator, &art_base_clk.freq_khz, &unused);
10951095

10961096
art_base_clk.freq_khz /= KHZ;

arch/x86/xen/enlighten_pv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
231231
or_ebx = smp_processor_id() << 24;
232232
break;
233233

234-
case CPUID_MWAIT_LEAF:
234+
case CPUID_LEAF_MWAIT:
235235
/* Synthesize the values.. */
236236
*ax = 0;
237237
*bx = 0;
@@ -301,7 +301,7 @@ static bool __init xen_check_mwait(void)
301301
* ecx and edx. The hypercall provides only partial information.
302302
*/
303303

304-
ax = CPUID_MWAIT_LEAF;
304+
ax = CPUID_LEAF_MWAIT;
305305
bx = 0;
306306
cx = 0;
307307
dx = 0;

0 commit comments

Comments
 (0)