Skip to content

Commit 94da90b

Browse files
philmdMichael Tokarev
authored andcommitted
hw/core: Get default_cpu_type calling machine_class_default_cpu_type()
Since commit 62b4a22 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. Cc: [email protected] Fixes: 62b4a22 ("hw/core: Add machine_class_default_cpu_type()") Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Reviewed-by: Pierrick Bouvier <[email protected]> Reviewed-by: Zhao Liu <[email protected]> Message-Id: <[email protected]> (cherry picked from commit d5f2418) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 2da497f commit 94da90b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

hw/core/machine-qmp-cmds.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props,
7272

7373
for (el = machines; el; el = el->next) {
7474
MachineClass *mc = el->data;
75+
const char *default_cpu_type = machine_class_default_cpu_type(mc);
7576
MachineInfo *info;
7677

7778
info = g_malloc0(sizeof(*info));
@@ -90,8 +91,8 @@ MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props,
9091
info->numa_mem_supported = mc->numa_mem_supported;
9192
info->deprecated = !!mc->deprecation_reason;
9293
info->acpi = !!object_class_property_find(OBJECT_CLASS(mc), "acpi");
93-
if (mc->default_cpu_type) {
94-
info->default_cpu_type = g_strdup(mc->default_cpu_type);
94+
if (default_cpu_type) {
95+
info->default_cpu_type = g_strdup(default_cpu_type);
9596
}
9697
if (mc->default_ram_id) {
9798
info->default_ram_id = g_strdup(mc->default_ram_id);

target/ppc/cpu_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7082,7 +7082,7 @@ ObjectClass *ppc_cpu_class_by_name(const char *name)
70827082
if (strcmp(name, "max") == 0) {
70837083
MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
70847084
if (mc) {
7085-
return object_class_by_name(mc->default_cpu_type);
7085+
return object_class_by_name(machine_class_default_cpu_type(mc));
70867086
}
70877087
}
70887088
#endif

0 commit comments

Comments
 (0)