Message ID | 20220103084636.2496-3-wangyanan55@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ARM virt: Support CPU cluster topology | expand |
On Mon, Jan 03, 2022 at 04:46:31PM +0800, Yanan Wang wrote: > Support one cluster level between core and physical package in the > cpu-map of Arm/virt devicetree. This is also consistent with Linux > Doc "Documentation/devicetree/bindings/cpu/cpu-topology.txt". > > Signed-off-by: Yanan Wang <wangyanan55@huawei.com> > --- > hw/arm/virt.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index f413e146d9..fc5eea8c8c 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -430,9 +430,8 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) > * can contain several layers of clustering within a single physical > * package and cluster nodes can be contained in parent cluster nodes. > * > - * Given that cluster is not yet supported in the vCPU topology, > - * we currently generate one cluster node within each socket node > - * by default. > + * Note: currently we only support one layer of clustering within > + * each physical package. > */ > qemu_fdt_add_subnode(ms->fdt, "/cpus/cpu-map"); > > @@ -442,14 +441,16 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) > > if (ms->smp.threads > 1) { > map_path = g_strdup_printf( > - "/cpus/cpu-map/socket%d/cluster0/core%d/thread%d", > - cpu / (ms->smp.cores * ms->smp.threads), > + "/cpus/cpu-map/socket%d/cluster%d/core%d/thread%d", > + cpu / (ms->smp.clusters * ms->smp.cores * ms->smp.threads), > + (cpu / (ms->smp.cores * ms->smp.threads)) % ms->smp.clusters, > (cpu / ms->smp.threads) % ms->smp.cores, > cpu % ms->smp.threads); > } else { > map_path = g_strdup_printf( > - "/cpus/cpu-map/socket%d/cluster0/core%d", > - cpu / ms->smp.cores, > + "/cpus/cpu-map/socket%d/cluster%d/core%d", > + cpu / (ms->smp.clusters * ms->smp.cores), > + (cpu / ms->smp.cores) % ms->smp.clusters, > cpu % ms->smp.cores); > } > qemu_fdt_add_path(ms->fdt, map_path); > -- > 2.27.0 > Reviewed-by: Andrew Jones <drjones@redhat.com>
diff --git a/hw/arm/virt.c b/hw/arm/virt.c index f413e146d9..fc5eea8c8c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -430,9 +430,8 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) * can contain several layers of clustering within a single physical * package and cluster nodes can be contained in parent cluster nodes. * - * Given that cluster is not yet supported in the vCPU topology, - * we currently generate one cluster node within each socket node - * by default. + * Note: currently we only support one layer of clustering within + * each physical package. */ qemu_fdt_add_subnode(ms->fdt, "/cpus/cpu-map"); @@ -442,14 +441,16 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) if (ms->smp.threads > 1) { map_path = g_strdup_printf( - "/cpus/cpu-map/socket%d/cluster0/core%d/thread%d", - cpu / (ms->smp.cores * ms->smp.threads), + "/cpus/cpu-map/socket%d/cluster%d/core%d/thread%d", + cpu / (ms->smp.clusters * ms->smp.cores * ms->smp.threads), + (cpu / (ms->smp.cores * ms->smp.threads)) % ms->smp.clusters, (cpu / ms->smp.threads) % ms->smp.cores, cpu % ms->smp.threads); } else { map_path = g_strdup_printf( - "/cpus/cpu-map/socket%d/cluster0/core%d", - cpu / ms->smp.cores, + "/cpus/cpu-map/socket%d/cluster%d/core%d", + cpu / (ms->smp.clusters * ms->smp.cores), + (cpu / ms->smp.cores) % ms->smp.clusters, cpu % ms->smp.cores); } qemu_fdt_add_path(ms->fdt, map_path);
Support one cluster level between core and physical package in the cpu-map of Arm/virt devicetree. This is also consistent with Linux Doc "Documentation/devicetree/bindings/cpu/cpu-topology.txt". Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- hw/arm/virt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)