[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v3 2/4] hw/arm/virt: Add cluster level to device tree
From: |
Yanan Wang |
Subject: |
[RFC PATCH v3 2/4] hw/arm/virt: Add cluster level to device tree |
Date: |
Sun, 16 May 2021 18:32:26 +0800 |
Add a cluster level between core level and socket level to ARM
device tree. This is also consistent with content in Linux Doc
"Documentation/devicetree/bindings/cpu/cpu-topology.txt".
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
---
hw/arm/virt.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 44e990e3be..7de822e491 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -431,14 +431,18 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
if (ms->smp.threads > 1) {
map_path = g_strdup_printf(
- "/cpus/cpu-map/%s%d/%s%d/%s%d",
- "socket", cpu / (ms->smp.cores * ms->smp.threads),
+ "/cpus/cpu-map/%s%d/%s%d/%s%d/%s%d",
+ "socket", cpu / (vms->smp_clusters * ms->smp.cores *
+ ms->smp.threads),
+ "cluster", (cpu / (ms->smp.cores * ms->smp.threads)) %
+ vms->smp_clusters,
"core", (cpu / ms->smp.threads) % ms->smp.cores,
"thread", cpu % ms->smp.threads);
} else {
map_path = g_strdup_printf(
- "/cpus/cpu-map/%s%d/%s%d",
- "socket", cpu / ms->smp.cores,
+ "/cpus/cpu-map/%s%d/%s%d/%s%d",
+ "socket", cpu / (vms->smp_clusters * ms->smp.cores),
+ "cluster", (cpu / ms->smp.cores) % vms->smp_clusters,
"core", cpu % ms->smp.cores);
}
qemu_fdt_add_path(ms->fdt, map_path);
--
2.19.1