hw/core: Get default_cpu_type calling machine_class_default_cpu_type()
PATCH 1/1 hw/core: Get default_cpu_type calling machine_class_default_cpu_type()
Since commit 62b4a227a33 the default cpu type can come from the valid_cpu_types[] array. Call the machine_class_default_cpu_type() instead of accessing MachineClass::default_cpu_type field.
Fixes 62b4a227a33 ("hw/core: Add machine_class_default_cpu_type()")
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
---
Cc: Gavin Shan <[email protected]>
--- hw/core/machine-qmp-cmds.c | 5 +++-- target/ppc/cpu_init.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
hw/core/machine-qmp-cmds.c +3 -2
@@ -72,6 +72,7 @@ MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props,for (el = machines; el; el = el->next) {MachineClass *mc = el->data; +const char *default_cpu_type =machine_class_default_cpu_type (mc);MachineInfo *info; info =g_malloc0 (sizeof (*info));
@@ -90,8 +91,8 @@ MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props, info->numa_mem_supported = mc->numa_mem_supported; info->deprecated = !!mc->deprecation_reason; info->acpi = !!object_class_property_find (OBJECT_CLASS (mc),"acpi" ); -if (mc->default_cpu_type) { - info->default_cpu_type =g_strdup (mc->default_cpu_type); +if (default_cpu_type) { + info->default_cpu_type =g_strdup (default_cpu_type); }if (mc->default_ram_id) { info->default_ram_id =g_strdup (mc->default_ram_id);
target/ppc/cpu_init.c +1 -1
@@ -7082,7 +7082,7 @@ ObjectClass *ppc_cpu_class_by_name(const char *name)if (strcmp (name,"max" ) ==0 ) {MachineClass *mc =MACHINE_GET_CLASS (qdev_get_machine ());if (mc) { -return object_class_by_name (mc->default_cpu_type); +return object_class_by_name (machine_class_default_cpu_type (mc)); } }#endif
Signature · 1 line
2.47.1
Quoted 13 lines · Philippe Mathieu-Daudé
Date: Tue, 22 Apr 2025 10:41:14 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH] hw/core: Getdefault_cpu_typecalling
machine_class_default_cpu_type()
X-Mailer: git-send-email 2.47.1Since commit
62b4a227a33the default cpu type can come from the valid_cpu_types[] array. Call themachine_class_default_cpu_type()instead of accessingMachineClass::default_cpu_typefield.Fixes 62b4a227a33 ("hw/core: Add machine_class_default_cpu_type()")Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 6 lines
---
Cc: Gavin Shan <[email protected]>--- hw/core/machine-qmp-cmds.c | 5 +++-- target/ppc/cpu_init.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
Reviewed-by Zhao Liu <[email protected]>