Skip to content

Commit 02fb601

Browse files
committed
x86/cpu: Move phys_proc_id into topology info
Rename it to pkg_id which is the terminology used in the kernel. 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 b9655e7 commit 02fb601

File tree

15 files changed

+30
-34
lines changed

15 files changed

+30
-34
lines changed

Documentation/arch/x86/topology.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Package-related topology information in the kernel:
5959

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

62-
- cpuinfo_x86.phys_proc_id:
62+
- cpuinfo_x86.topo.pkg_id:
6363

6464
The physical ID of the package. This information is retrieved via CPUID
6565
and deduced from the APIC IDs of the cores in the package.

arch/x86/include/asm/processor.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ struct cpuinfo_topology {
8383
u32 apicid;
8484
// The initial APIC ID provided by CPUID
8585
u32 initial_apicid;
86+
87+
// Physical package ID
88+
u32 pkg_id;
8689
};
8790

8891
struct cpuinfo_x86 {
@@ -134,8 +137,6 @@ struct cpuinfo_x86 {
134137
u16 x86_clflush_size;
135138
/* number of cores as seen by the OS: */
136139
u16 booted_cores;
137-
/* Physical processor id: */
138-
u16 phys_proc_id;
139140
/* Logical processor id: */
140141
u16 logical_proc_id;
141142
/* Core id: */

arch/x86/include/asm/topology.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
106106
extern const struct cpumask *cpu_clustergroup_mask(int cpu);
107107

108108
#define topology_logical_package_id(cpu) (cpu_data(cpu).logical_proc_id)
109-
#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
109+
#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).cpu_die_id)
112112
#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)

arch/x86/include/asm/x86_init.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ struct x86_init_ops {
177177
* struct x86_cpuinit_ops - platform specific cpu hotplug setups
178178
* @setup_percpu_clockev: set up the per cpu clock event device
179179
* @early_percpu_clock_init: early init of the per cpu clock event device
180-
* @fixup_cpu_id: fixup function for cpuinfo_x86::phys_proc_id
180+
* @fixup_cpu_id: fixup function for cpuinfo_x86::topo.pkg_id
181181
* @parallel_bringup: Parallel bringup control
182182
*/
183183
struct x86_cpuinit_ops {

arch/x86/kernel/apic/apic_numachip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static void fixup_cpu_id(struct cpuinfo_x86 *c, int node)
169169
nodes = ((val >> 3) & 7) + 1;
170170
}
171171

172-
c->phys_proc_id = node / nodes;
172+
c->topo.pkg_id = node / nodes;
173173
}
174174

175175
static int __init numachip_system_init(void)

arch/x86/kernel/cpu/amd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c)
461461
/* Low order bits define the core id (index of core in socket) */
462462
c->cpu_core_id = c->topo.initial_apicid & ((1 << bits)-1);
463463
/* Convert the initial APIC ID into the socket ID */
464-
c->phys_proc_id = c->topo.initial_apicid >> bits;
464+
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->phys_proc_id;
466+
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->topo.pkg_id;
467467
}
468468

469469
u32 amd_get_nodes_per_socket(void)

arch/x86/kernel/cpu/cacheinfo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,10 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
875875
* turns means that the only possibility is SMT (as indicated in
876876
* cpuid1). Since cpuid2 doesn't specify shared caches, and we know
877877
* that SMT shares all caches, we can unconditionally set cpu_llc_id to
878-
* c->phys_proc_id.
878+
* c->topo.pkg_id.
879879
*/
880880
if (per_cpu(cpu_llc_id, cpu) == BAD_APICID)
881-
per_cpu(cpu_llc_id, cpu) = c->phys_proc_id;
881+
per_cpu(cpu_llc_id, cpu) = c->topo.pkg_id;
882882
#endif
883883

884884
c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d));

arch/x86/kernel/cpu/common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ void detect_ht(struct cpuinfo_x86 *c)
914914
return;
915915

916916
index_msb = get_count_order(smp_num_siblings);
917-
c->phys_proc_id = apic->phys_pkg_id(c->topo.initial_apicid, index_msb);
917+
c->topo.pkg_id = apic->phys_pkg_id(c->topo.initial_apicid, index_msb);
918918

919919
smp_num_siblings = smp_num_siblings / c->x86_max_cores;
920920

@@ -1769,7 +1769,7 @@ static void generic_identify(struct cpuinfo_x86 *c)
17691769
c->topo.apicid = c->topo.initial_apicid;
17701770
# endif
17711771
#endif
1772-
c->phys_proc_id = c->topo.initial_apicid;
1772+
c->topo.pkg_id = c->topo.initial_apicid;
17731773
}
17741774

17751775
get_model_name(c); /* Default name */
@@ -1807,7 +1807,7 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
18071807
pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x APIC: %x\n",
18081808
cpu, apicid, c->topo.initial_apicid);
18091809
}
1810-
BUG_ON(topology_update_package_map(c->phys_proc_id, cpu));
1810+
BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu));
18111811
BUG_ON(topology_update_die_map(c->cpu_die_id, cpu));
18121812
#else
18131813
c->logical_proc_id = 0;

arch/x86/kernel/cpu/hygon.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static void hygon_get_topology(struct cpuinfo_x86 *c)
9292
* when running on host.
9393
*/
9494
if (!boot_cpu_has(X86_FEATURE_HYPERVISOR) && c->x86_model <= 0x3)
95-
c->phys_proc_id = c->topo.apicid >> APICID_SOCKET_ID_BIT;
95+
c->topo.pkg_id = c->topo.apicid >> APICID_SOCKET_ID_BIT;
9696

9797
cacheinfo_hygon_init_llc_id(c, cpu);
9898
} else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {
@@ -122,9 +122,9 @@ static void hygon_detect_cmp(struct cpuinfo_x86 *c)
122122
/* Low order bits define the core id (index of core in socket) */
123123
c->cpu_core_id = c->topo.initial_apicid & ((1 << bits)-1);
124124
/* Convert the initial APIC ID into the socket ID */
125-
c->phys_proc_id = c->topo.initial_apicid >> bits;
125+
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->phys_proc_id;
127+
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->topo.pkg_id;
128128
}
129129

130130
static void srat_detect_node(struct cpuinfo_x86 *c)

arch/x86/kernel/cpu/mce/apei.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int apei_smca_report_x86_error(struct cper_ia_proc_ctx *ctx_info, u64 lapic_id)
105105
for_each_possible_cpu(cpu) {
106106
if (cpu_data(cpu).topo.initial_apicid == lapic_id) {
107107
m.extcpu = cpu;
108-
m.socketid = cpu_data(m.extcpu).phys_proc_id;
108+
m.socketid = cpu_data(m.extcpu).topo.pkg_id;
109109
break;
110110
}
111111
}

0 commit comments

Comments
 (0)