Message ID | 20250422145502.70770-18-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | single-binary: Make hw/arm/ common | expand |
On 4/22/25 07:54, Philippe Mathieu-Daudé wrote: > 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. > > Cc: qemu-stable@nongnu.org > Fixes: 62b4a227a33 ("hw/core: Add machine_class_default_cpu_type()") > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > Cc: Gavin Shan <gshan@redhat.com> > --- > hw/core/machine-qmp-cmds.c | 5 +++-- > target/ppc/cpu_init.c | 2 +- > 2 files changed, 4 insertions(+), 3 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
On 4/22/25 07:54, Philippe Mathieu-Daudé wrote: > 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. > > Cc: qemu-stable@nongnu.org > Fixes: 62b4a227a33 ("hw/core: Add machine_class_default_cpu_type()") > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > Cc: Gavin Shan <gshan@redhat.com> > --- > hw/core/machine-qmp-cmds.c | 5 +++-- > target/ppc/cpu_init.c | 2 +- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c > index 529ce8dd9a0..a8f8f8c8138 100644 > --- a/hw/core/machine-qmp-cmds.c > +++ b/hw/core/machine-qmp-cmds.c > @@ -73,6 +73,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)); > @@ -91,8 +92,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); > diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c > index a3dff0814d1..2c0db2a05a9 100644 > --- a/target/ppc/cpu_init.c > +++ b/target/ppc/cpu_init.c > @@ -7081,7 +7081,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 Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 529ce8dd9a0..a8f8f8c8138 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -73,6 +73,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)); @@ -91,8 +92,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); diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index a3dff0814d1..2c0db2a05a9 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7081,7 +7081,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
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. Cc: qemu-stable@nongnu.org Fixes: 62b4a227a33 ("hw/core: Add machine_class_default_cpu_type()") Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- Cc: Gavin Shan <gshan@redhat.com> --- hw/core/machine-qmp-cmds.c | 5 +++-- target/ppc/cpu_init.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)