summary refs log tree commit diff stats
path: root/cpu-target.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-03-23 16:09:06 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-04-25 12:59:09 +0200
commit0a5692fecc76c6fee9a4fc86dbe8faf84ce30ce8 (patch)
treeeb6c818962ebcdafdf74eca06c33a2ea41ff7cff /cpu-target.c
parent9ce6caa0d94a52a0ada77f494e8e23e62198aef0 (diff)
downloadfocaccia-qemu-0a5692fecc76c6fee9a4fc86dbe8faf84ce30ce8.tar.gz
focaccia-qemu-0a5692fecc76c6fee9a4fc86dbe8faf84ce30ce8.zip
cpus: Introduce CPUClass::list_cpus() callback
Some targets define cpu_list to a method listing their
CPUs on stdout. In order to make list_cpus() generic,
introduce the CPUClass::list_cpus() callback.
When no callback is registered, list_cpus() defaults
to the cpu_list definition.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20250324185837.46506-2-philmd@linaro.org>
Diffstat (limited to 'cpu-target.c')
-rw-r--r--cpu-target.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/cpu-target.c b/cpu-target.c
index 14cd623bff..d139a18f5b 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -104,7 +104,13 @@ static void cpu_list(void)
 
 void list_cpus(void)
 {
-    cpu_list();
+    CPUClass *cc = CPU_CLASS(object_class_by_name(CPU_RESOLVING_TYPE));
+
+    if (cc->list_cpus) {
+        cc->list_cpus();
+    } else {
+        cpu_list();
+    }
 }
 
 /* enable or disable single step mode. EXCP_DEBUG is returned by the