Skip to content

Commit e952563

Browse files
committed
x86/cpu: Move cpu_core_id into topology info
Rename it to core_id and stick it to the other ID fields. No functional change. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Juergen Gross <[email protected]> Tested-by: Sohil Mehta <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Zhang Rui <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 94f0b39 commit e952563

File tree

9 files changed

+19
-17
lines changed

9 files changed

+19
-17
lines changed

arch/x86/include/asm/processor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ struct cpuinfo_topology {
8989

9090
// Physical die ID on AMD, Relative on Intel
9191
u32 die_id;
92+
93+
// Core ID relative to the package
94+
u32 core_id;
9295
};
9396

9497
struct cpuinfo_x86 {
@@ -143,7 +146,6 @@ struct cpuinfo_x86 {
143146
/* Logical processor id: */
144147
u16 logical_proc_id;
145148
/* Core id: */
146-
u16 cpu_core_id;
147149
u16 logical_die_id;
148150
/* Index into per_cpu list: */
149151
u16 cpu_index;

arch/x86/include/asm/topology.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ extern const struct cpumask *cpu_clustergroup_mask(int cpu);
109109
#define topology_physical_package_id(cpu) (cpu_data(cpu).topo.pkg_id)
110110
#define topology_logical_die_id(cpu) (cpu_data(cpu).logical_die_id)
111111
#define topology_die_id(cpu) (cpu_data(cpu).topo.die_id)
112-
#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
112+
#define topology_core_id(cpu) (cpu_data(cpu).topo.core_id)
113113
#define topology_ppin(cpu) (cpu_data(cpu).ppin)
114114

115115
extern unsigned int __max_die_per_package;

arch/x86/kernel/amd_nb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ int amd_get_subcaches(int cpu)
386386

387387
pci_read_config_dword(link, 0x1d4, &mask);
388388

389-
return (mask >> (4 * cpu_data(cpu).cpu_core_id)) & 0xf;
389+
return (mask >> (4 * cpu_data(cpu).topo.core_id)) & 0xf;
390390
}
391391

392392
int amd_set_subcaches(int cpu, unsigned long mask)
@@ -412,7 +412,7 @@ int amd_set_subcaches(int cpu, unsigned long mask)
412412
pci_write_config_dword(nb->misc, 0x1b8, reg & ~0x180000);
413413
}
414414

415-
cuid = cpu_data(cpu).cpu_core_id;
415+
cuid = cpu_data(cpu).topo.core_id;
416416
mask <<= 4 * cuid;
417417
mask |= (0xf ^ (1 << cuid)) << 26;
418418

arch/x86/kernel/cpu/amd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ static int nearby_node(int apicid)
378378
#endif
379379

380380
/*
381-
* Fix up cpu_core_id for pre-F17h systems to be in the
381+
* Fix up topo::core_id for pre-F17h systems to be in the
382382
* [0 .. cores_per_node - 1] range. Not really needed but
383383
* kept so as not to break existing setups.
384384
*/
@@ -390,7 +390,7 @@ static void legacy_fixup_core_id(struct cpuinfo_x86 *c)
390390
return;
391391

392392
cus_per_node = c->x86_max_cores / nodes_per_socket;
393-
c->cpu_core_id %= cus_per_node;
393+
c->topo.core_id %= cus_per_node;
394394
}
395395

396396
/*
@@ -416,7 +416,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
416416
c->cu_id = ebx & 0xff;
417417

418418
if (c->x86 >= 0x17) {
419-
c->cpu_core_id = ebx & 0xff;
419+
c->topo.core_id = ebx & 0xff;
420420

421421
if (smp_num_siblings > 1)
422422
c->x86_max_cores /= smp_num_siblings;
@@ -459,7 +459,7 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c)
459459

460460
bits = c->x86_coreid_bits;
461461
/* Low order bits define the core id (index of core in socket) */
462-
c->cpu_core_id = c->topo.initial_apicid & ((1 << bits)-1);
462+
c->topo.core_id = c->topo.initial_apicid & ((1 << bits)-1);
463463
/* Convert the initial APIC ID into the socket ID */
464464
c->topo.pkg_id = c->topo.initial_apicid >> bits;
465465
/* use socket ID also for last level cache */

arch/x86/kernel/cpu/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,8 @@ void detect_ht(struct cpuinfo_x86 *c)
922922

923923
core_bits = get_count_order(c->x86_max_cores);
924924

925-
c->cpu_core_id = apic->phys_pkg_id(c->topo.initial_apicid, index_msb) &
926-
((1 << core_bits) - 1);
925+
c->topo.core_id = apic->phys_pkg_id(c->topo.initial_apicid, index_msb) &
926+
((1 << core_bits) - 1);
927927
#endif
928928
}
929929

arch/x86/kernel/cpu/hygon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static void hygon_get_topology(struct cpuinfo_x86 *c)
7474

7575
c->topo.die_id = ecx & 0xff;
7676

77-
c->cpu_core_id = ebx & 0xff;
77+
c->topo.core_id = ebx & 0xff;
7878

7979
if (smp_num_siblings > 1)
8080
c->x86_max_cores /= smp_num_siblings;
@@ -120,7 +120,7 @@ static void hygon_detect_cmp(struct cpuinfo_x86 *c)
120120

121121
bits = c->x86_coreid_bits;
122122
/* Low order bits define the core id (index of core in socket) */
123-
c->cpu_core_id = c->topo.initial_apicid & ((1 << bits)-1);
123+
c->topo.core_id = c->topo.initial_apicid & ((1 << bits)-1);
124124
/* Convert the initial APIC ID into the socket ID */
125125
c->topo.pkg_id = c->topo.initial_apicid >> bits;
126126
/* use socket ID also for last level cache */

arch/x86/kernel/cpu/proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c,
2323
seq_printf(m, "physical id\t: %d\n", c->topo.pkg_id);
2424
seq_printf(m, "siblings\t: %d\n",
2525
cpumask_weight(topology_core_cpumask(cpu)));
26-
seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
26+
seq_printf(m, "core id\t\t: %d\n", c->topo.core_id);
2727
seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
2828
seq_printf(m, "apicid\t\t: %d\n", c->topo.apicid);
2929
seq_printf(m, "initial apicid\t: %d\n", c->topo.initial_apicid);

arch/x86/kernel/cpu/topology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ int detect_extended_topology(struct cpuinfo_x86 *c)
146146
die_select_mask = (~(-1 << die_plus_mask_width)) >>
147147
core_plus_mask_width;
148148

149-
c->cpu_core_id = apic->phys_pkg_id(c->topo.initial_apicid,
149+
c->topo.core_id = apic->phys_pkg_id(c->topo.initial_apicid,
150150
ht_mask_width) & core_select_mask;
151151

152152
if (die_level_present) {

arch/x86/kernel/smpboot.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
479479
if (c->topo.pkg_id == o->topo.pkg_id &&
480480
c->topo.die_id == o->topo.die_id &&
481481
per_cpu(cpu_llc_id, cpu1) == per_cpu(cpu_llc_id, cpu2)) {
482-
if (c->cpu_core_id == o->cpu_core_id)
482+
if (c->topo.core_id == o->topo.core_id)
483483
return topology_sane(c, o, "smt");
484484

485485
if ((c->cu_id != 0xff) &&
@@ -490,7 +490,7 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
490490

491491
} else if (c->topo.pkg_id == o->topo.pkg_id &&
492492
c->topo.die_id == o->topo.die_id &&
493-
c->cpu_core_id == o->cpu_core_id) {
493+
c->topo.core_id == o->topo.core_id) {
494494
return topology_sane(c, o, "smt");
495495
}
496496

@@ -1426,7 +1426,7 @@ static void remove_siblinginfo(int cpu)
14261426
cpumask_clear(topology_sibling_cpumask(cpu));
14271427
cpumask_clear(topology_core_cpumask(cpu));
14281428
cpumask_clear(topology_die_cpumask(cpu));
1429-
c->cpu_core_id = 0;
1429+
c->topo.core_id = 0;
14301430
c->booted_cores = 0;
14311431
cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
14321432
recompute_smt_state();

0 commit comments

Comments
 (0)