package_id should represent socket in DT. Free it for possible socket
dts parsing and use the so far unused llc_id / llc_sibling cpumask to
decode 1. level clusters used in pre-DynamIQ big/little systems.
cpu_coregroup_mask() will return llc_sibling isntead of core_mask in
this case.
This will let the cluster_id / cluster_sibling cpumask be available for
2. level clusters (e.g. to map L2 sharing in Armv9 A510 complexes).
The corresponding sched domain CLS is similarly used in ACPI (servers)
to map e.g. Kunpeng920 L3-tags or Ampere Altra's SCU bounderies.
Lighlty tested on qemu-system-aarch64 with 1x8 (cluster-x-core) and
2x4 cpu-map.
Signed-off-by: Dietmar Eggemann <[email protected]>
---
Related to: https://lkml.kernel.org/r/[email protected]
drivers/base/arch_topology.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index f73b836047cf..ac1488990cc8 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -490,7 +490,7 @@ static int __init get_cpu_for_node(struct device_node *node)
return cpu;
}
-static int __init parse_core(struct device_node *core, int package_id,
+static int __init parse_core(struct device_node *core, int llc_id,
int core_id)
{
char name[20];
@@ -506,7 +506,8 @@ static int __init parse_core(struct device_node *core, int package_id,
leaf = false;
cpu = get_cpu_for_node(t);
if (cpu >= 0) {
- cpu_topology[cpu].package_id = package_id;
+ cpu_topology[cpu].package_id = 0;
+ cpu_topology[cpu].llc_id = llc_id;
cpu_topology[cpu].core_id = core_id;
cpu_topology[cpu].thread_id = i;
} else if (cpu != -ENODEV) {
@@ -527,7 +528,8 @@ static int __init parse_core(struct device_node *core, int package_id,
return -EINVAL;
}
- cpu_topology[cpu].package_id = package_id;
+ cpu_topology[cpu].package_id = 0;
+ cpu_topology[cpu].llc_id = llc_id;
cpu_topology[cpu].core_id = core_id;
} else if (leaf && cpu != -ENODEV) {
pr_err("%pOF: Can't get CPU for leaf core\n", core);
@@ -543,7 +545,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
bool leaf = true;
bool has_cores = false;
struct device_node *c;
- static int package_id __initdata;
+ static int llc_id __initdata;
int core_id = 0;
int i, ret;
@@ -582,7 +584,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
}
if (leaf) {
- ret = parse_core(c, package_id, core_id++);
+ ret = parse_core(c, llc_id, core_id++);
} else {
pr_err("%pOF: Non-leaf cluster with core %s\n",
cluster, name);
@@ -600,7 +602,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
pr_warn("%pOF: empty cluster\n", cluster);
if (leaf)
- package_id++;
+ llc_id++;
return 0;
}
@@ -693,14 +695,12 @@ void update_siblings_masks(unsigned int cpuid)
for_each_online_cpu(cpu) {
cpu_topo = &cpu_topology[cpu];
- if (cpu_topo->llc_id != -1 && cpuid_topo->llc_id == cpu_topo->llc_id) {
- cpumask_set_cpu(cpu, &cpuid_topo->llc_sibling);
- cpumask_set_cpu(cpuid, &cpu_topo->llc_sibling);
- }
-
- if (cpuid_topo->package_id != cpu_topo->package_id)
+ if (cpuid_topo->llc_id != cpu_topo->llc_id)
continue;
+ cpumask_set_cpu(cpu, &cpuid_topo->llc_sibling);
+ cpumask_set_cpu(cpuid, &cpu_topo->llc_sibling);
+
if (cpuid_topo->cluster_id == cpu_topo->cluster_id &&
cpuid_topo->cluster_id != -1) {
cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling);
--
2.25.1