[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 10/52] machine: Replace MachineState.topo.smp access with topology
From: |
Zhao Liu |
Subject: |
[RFC 10/52] machine: Replace MachineState.topo.smp access with topology helpers |
Date: |
Mon, 13 Feb 2023 17:49:53 +0800 |
From: Zhao Liu <zhao1.liu@intel.com>
In cpu_hierarchy_to_string(), the access to MachineState.topo.smp can
be replaced by topology helpers.
But because machine_parse_smp_config() is used to adjust
MachineState.topo.smp, there's no need to replace with helpers.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
hw/core/machine-topo.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/hw/core/machine-topo.c b/hw/core/machine-topo.c
index e0ec07b53d42..cdbe65ffd9fd 100644
--- a/hw/core/machine-topo.c
+++ b/hw/core/machine-topo.c
@@ -185,18 +185,20 @@ static char *cpu_hierarchy_to_string(MachineState *ms)
MachineClass *mc = MACHINE_GET_CLASS(ms);
GString *s = g_string_new(NULL);
- g_string_append_printf(s, "sockets (%u)", ms->topo.smp.sockets);
+ g_string_append_printf(s, "sockets (%u)", machine_topo_get_sockets(ms));
if (mc->smp_props.dies_supported) {
- g_string_append_printf(s, " * dies (%u)", ms->topo.smp.dies);
+ g_string_append_printf(s, " * dies (%u)", machine_topo_get_dies(ms));
}
if (mc->smp_props.clusters_supported) {
- g_string_append_printf(s, " * clusters (%u)", ms->topo.smp.clusters);
+ g_string_append_printf(s, " * clusters (%u)",
+ machine_topo_get_clusters(ms));
}
- g_string_append_printf(s, " * cores (%u)", ms->topo.smp.cores);
- g_string_append_printf(s, " * threads (%u)", ms->topo.smp.threads);
+ g_string_append_printf(s, " * cores (%u)", machine_topo_get_smp_cores(ms));
+ g_string_append_printf(s, " * threads (%u)",
+ machine_topo_get_smp_threads(ms));
return g_string_free(s, false);
}
--
2.34.1
- RE: [RFC 08/52] machine: Add helpers to get cpu topology info from MachineState.topo, (continued)
[RFC 09/52] hw/machine: Introduce core type for hybrid topology, Zhao Liu, 2023/02/13
[RFC 10/52] machine: Replace MachineState.topo.smp access with topology helpers,
Zhao Liu <=
[RFC 11/52] accel/kvm: Add hybrid info when check cpu num, Zhao Liu, 2023/02/13
[RFC 12/52] hw/acpi: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
[RFC 14/52] hw/smbios: Use generic topology name and helper, Zhao Liu, 2023/02/13
[RFC 13/52] cpu/core: Use generic topology helper for "help" to set nr_threads, Zhao Liu, 2023/02/13
[RFC 15/52] migration/postcopy-ram: Use generic topology name and helper, Zhao Liu, 2023/02/13