qemu-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]