Skip to content

Commit 3b36cea

Browse files
xiongyiningpm215
authored andcommitted
hw/arm/sbsa-ref: Enable CPU cluster on ARM sbsa machine
Enable CPU cluster support on SbsaQemu platform, so that users can specify a 4-level CPU hierarchy sockets/clusters/cores/threads. And this topology can be passed to the firmware through /cpus/topology Device Tree. Signed-off-by: Xiong Yining <[email protected]> Reviewed-by: Marcin Juszkiewicz <[email protected]> Reviewed-by: Leif Lindholm <[email protected]> Message-id: [email protected] Tested-by: Marcin Juszkiewicz <[email protected]> Signed-off-by: Peter Maydell <[email protected]>
1 parent 53aaa88 commit 3b36cea

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

docs/system/arm/sbsa.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ The devicetree reports:
6262
- platform version
6363
- GIC addresses
6464
- NUMA node id for CPUs and memory
65+
- CPU topology information
6566

6667
Platform version
6768
''''''''''''''''
@@ -88,3 +89,6 @@ Platform version changes:
8889

8990
0.3
9091
The USB controller is an XHCI device, not EHCI.
92+
93+
0.4
94+
CPU topology information is present in devicetree.

hw/arm/sbsa-ref.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static void create_fdt(SBSAMachineState *sms)
219219
* fw compatibility.
220220
*/
221221
qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0);
222-
qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 3);
222+
qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 4);
223223

224224
if (ms->numa_state->have_numa_distance) {
225225
int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t);
@@ -276,6 +276,14 @@ static void create_fdt(SBSAMachineState *sms)
276276
g_free(nodename);
277277
}
278278

279+
/* Add CPU topology description through fdt node topology. */
280+
qemu_fdt_add_subnode(sms->fdt, "/cpus/topology");
281+
282+
qemu_fdt_setprop_cell(sms->fdt, "/cpus/topology", "sockets", ms->smp.sockets);
283+
qemu_fdt_setprop_cell(sms->fdt, "/cpus/topology", "clusters", ms->smp.clusters);
284+
qemu_fdt_setprop_cell(sms->fdt, "/cpus/topology", "cores", ms->smp.cores);
285+
qemu_fdt_setprop_cell(sms->fdt, "/cpus/topology", "threads", ms->smp.threads);
286+
279287
sbsa_fdt_add_gic_node(sms);
280288
}
281289

@@ -898,6 +906,7 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *data)
898906
mc->default_ram_size = 1 * GiB;
899907
mc->default_ram_id = "sbsa-ref.ram";
900908
mc->default_cpus = 4;
909+
mc->smp_props.clusters_supported = true;
901910
mc->possible_cpu_arch_ids = sbsa_ref_possible_cpu_arch_ids;
902911
mc->cpu_index_to_instance_props = sbsa_ref_cpu_index_to_props;
903912
mc->get_default_cpu_node_id = sbsa_ref_get_default_cpu_node_id;

0 commit comments

Comments
 (0)