Skip to content

Commit 8a169ed

Browse files
committed
x86/cpu: Move cpu_die_id into topology info
Move the next member. 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 02fb601 commit 8a169ed

File tree

9 files changed

+22
-20
lines changed

9 files changed

+22
-20
lines changed

Documentation/arch/x86/topology.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Package-related topology information in the kernel:
5555

5656
The number of dies in a package. This information is retrieved via CPUID.
5757

58-
- cpuinfo_x86.cpu_die_id:
58+
- cpuinfo_x86.topo.die_id:
5959

6060
The physical ID of the die. This information is retrieved via CPUID.
6161

@@ -65,7 +65,7 @@ Package-related topology information in the kernel:
6565
and deduced from the APIC IDs of the cores in the package.
6666

6767
Modern systems use this value for the socket. There may be multiple
68-
packages within a socket. This value may differ from cpu_die_id.
68+
packages within a socket. This value may differ from topo.die_id.
6969

7070
- cpuinfo_x86.logical_proc_id:
7171

arch/x86/include/asm/processor.h

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

8787
// Physical package ID
8888
u32 pkg_id;
89+
90+
// Physical die ID on AMD, Relative on Intel
91+
u32 die_id;
8992
};
9093

9194
struct cpuinfo_x86 {
@@ -141,7 +144,6 @@ struct cpuinfo_x86 {
141144
u16 logical_proc_id;
142145
/* Core id: */
143146
u16 cpu_core_id;
144-
u16 cpu_die_id;
145147
u16 logical_die_id;
146148
/* Index into per_cpu list: */
147149
u16 cpu_index;

arch/x86/include/asm/topology.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ extern const struct cpumask *cpu_clustergroup_mask(int cpu);
108108
#define topology_logical_package_id(cpu) (cpu_data(cpu).logical_proc_id)
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)
111-
#define topology_die_id(cpu) (cpu_data(cpu).cpu_die_id)
111+
#define topology_die_id(cpu) (cpu_data(cpu).topo.die_id)
112112
#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
113113
#define topology_ppin(cpu) (cpu_data(cpu).ppin)
114114

arch/x86/kernel/cpu/amd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
410410

411411
cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
412412

413-
c->cpu_die_id = ecx & 0xff;
413+
c->topo.die_id = ecx & 0xff;
414414

415415
if (c->x86 == 0x15)
416416
c->cu_id = ebx & 0xff;
@@ -436,9 +436,9 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
436436
u64 value;
437437

438438
rdmsrl(MSR_FAM10H_NODE_ID, value);
439-
c->cpu_die_id = value & 7;
439+
c->topo.die_id = value & 7;
440440

441-
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id;
441+
per_cpu(cpu_llc_id, cpu) = c->topo.die_id;
442442
} else
443443
return;
444444

@@ -463,7 +463,7 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c)
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 */
466-
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->topo.pkg_id;
466+
per_cpu(cpu_llc_id, cpu) = c->topo.die_id = c->topo.pkg_id;
467467
}
468468

469469
u32 amd_get_nodes_per_socket(void)

arch/x86/kernel/cpu/cacheinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu)
672672

673673
if (c->x86 < 0x17) {
674674
/* LLC is at the node level. */
675-
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id;
675+
per_cpu(cpu_llc_id, cpu) = c->topo.die_id;
676676
} else if (c->x86 == 0x17 && c->x86_model <= 0x1F) {
677677
/*
678678
* LLC is at the core complex level.

arch/x86/kernel/cpu/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
18081808
cpu, apicid, c->topo.initial_apicid);
18091809
}
18101810
BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu));
1811-
BUG_ON(topology_update_die_map(c->cpu_die_id, cpu));
1811+
BUG_ON(topology_update_die_map(c->topo.die_id, cpu));
18121812
#else
18131813
c->logical_proc_id = 0;
18141814
#endif

arch/x86/kernel/cpu/hygon.c

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

7373
cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
7474

75-
c->cpu_die_id = ecx & 0xff;
75+
c->topo.die_id = ecx & 0xff;
7676

7777
c->cpu_core_id = ebx & 0xff;
7878

@@ -99,9 +99,9 @@ static void hygon_get_topology(struct cpuinfo_x86 *c)
9999
u64 value;
100100

101101
rdmsrl(MSR_FAM10H_NODE_ID, value);
102-
c->cpu_die_id = value & 7;
102+
c->topo.die_id = value & 7;
103103

104-
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id;
104+
per_cpu(cpu_llc_id, cpu) = c->topo.die_id;
105105
} else
106106
return;
107107

@@ -124,7 +124,7 @@ static void hygon_detect_cmp(struct cpuinfo_x86 *c)
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 */
127-
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->topo.pkg_id;
127+
per_cpu(cpu_llc_id, cpu) = c->topo.die_id = c->topo.pkg_id;
128128
}
129129

130130
static void srat_detect_node(struct cpuinfo_x86 *c)

arch/x86/kernel/cpu/topology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int detect_extended_topology(struct cpuinfo_x86 *c)
150150
ht_mask_width) & core_select_mask;
151151

152152
if (die_level_present) {
153-
c->cpu_die_id = apic->phys_pkg_id(c->topo.initial_apicid,
153+
c->topo.die_id = apic->phys_pkg_id(c->topo.initial_apicid,
154154
core_plus_mask_width) & die_select_mask;
155155
}
156156

arch/x86/kernel/smpboot.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static int topology_phys_to_logical_die(unsigned int die_id, unsigned int cur_cp
360360
for_each_possible_cpu(cpu) {
361361
struct cpuinfo_x86 *c = &cpu_data(cpu);
362362

363-
if (c->initialized && c->cpu_die_id == die_id &&
363+
if (c->initialized && c->topo.die_id == die_id &&
364364
c->topo.pkg_id == proc_id)
365365
return c->logical_die_id;
366366
}
@@ -422,7 +422,7 @@ static void __init smp_store_boot_cpu_info(void)
422422
*c = boot_cpu_data;
423423
c->cpu_index = id;
424424
topology_update_package_map(c->topo.pkg_id, id);
425-
topology_update_die_map(c->cpu_die_id, id);
425+
topology_update_die_map(c->topo.die_id, id);
426426
c->initialized = true;
427427
}
428428

@@ -477,7 +477,7 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
477477
int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
478478

479479
if (c->topo.pkg_id == o->topo.pkg_id &&
480-
c->cpu_die_id == o->cpu_die_id &&
480+
c->topo.die_id == o->topo.die_id &&
481481
per_cpu(cpu_llc_id, cpu1) == per_cpu(cpu_llc_id, cpu2)) {
482482
if (c->cpu_core_id == o->cpu_core_id)
483483
return topology_sane(c, o, "smt");
@@ -489,7 +489,7 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
489489
}
490490

491491
} else if (c->topo.pkg_id == o->topo.pkg_id &&
492-
c->cpu_die_id == o->cpu_die_id &&
492+
c->topo.die_id == o->topo.die_id &&
493493
c->cpu_core_id == o->cpu_core_id) {
494494
return topology_sane(c, o, "smt");
495495
}
@@ -500,7 +500,7 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
500500
static bool match_die(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
501501
{
502502
if (c->topo.pkg_id == o->topo.pkg_id &&
503-
c->cpu_die_id == o->cpu_die_id)
503+
c->topo.die_id == o->topo.die_id)
504504
return true;
505505
return false;
506506
}

0 commit comments

Comments
 (0)