[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-10.0.1 05/23] hw/core: Get default_cpu_type calling machine_clas
From: |
Michael Tokarev |
Subject: |
[Stable-10.0.1 05/23] hw/core: Get default_cpu_type calling machine_class_default_cpu_type() |
Date: |
Wed, 14 May 2025 22:00:17 +0300 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20250422084114.39499-1-philmd@linaro.org>
(cherry picked from commit d5f241834be1b323ea697a469ff0f1335a1823fe)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 3130c5cd45..1bc21b84a4 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -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);
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index f81cb680fc..21a76e904a 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -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
--
2.39.5
- [Stable-10.0.1 00/23] Patch Round-up for stable 10.0.1, freeze on 2025-05-24, Michael Tokarev, 2025/05/14
- [Stable-10.0.1 05/23] hw/core: Get default_cpu_type calling machine_class_default_cpu_type(),
Michael Tokarev <=
- [Stable-10.0.1 02/23] target/i386: Reset parked vCPUs together with the online ones, Michael Tokarev, 2025/05/14
- [Stable-10.0.1 03/23] target/i386/hvf: fix lflags_to_rflags, Michael Tokarev, 2025/05/14
- [Stable-10.0.1 01/23] target/i386: Fix model number of Zhaoxin YongFeng vCPU template, Michael Tokarev, 2025/05/14
- [Stable-10.0.1 07/23] target/mips: Fix MIPS16e translation, Michael Tokarev, 2025/05/14
- [Stable-10.0.1 04/23] target/avr: Improve decode of LDS, STS, Michael Tokarev, 2025/05/14
- [Stable-10.0.1 06/23] hw/core/cpu: gdb_arch_name string should not be freed, Michael Tokarev, 2025/05/14
- [Stable-10.0.1 09/23] meson: Remove CONFIG_STATX and CONFIG_STATX_MNT_ID, Michael Tokarev, 2025/05/14
- [Stable-10.0.1 11/23] meson: Use osdep_prefix for strchrnul(), Michael Tokarev, 2025/05/14
- [Stable-10.0.1 08/23] meson: Use has_header_symbol() to check getcpu(), Michael Tokarev, 2025/05/14
- [Stable-10.0.1 10/23] meson: Share common C source prefixes, Michael Tokarev, 2025/05/14