On 9/7/23 02:35, Gavin Shan wrote:
For target/ppc, the CPU type name can be: (1) The combination of
the CPU model name and suffix; (2) the type name of the class whose
PVR matches with the specified one; (3) alias of the CPU model, plus
suffix; (4) MachineClass::default_cpu_type when the CPU model name
is "max". All the possible information, the CPU model name, aliases
of the CPU models and PVRs are all shown in ppc_cpu_list_entry().
Use generic helper cpu_model_from_type() in ppc_cpu_list_entry(),
and rename @name to @model since it points to the CPU model name
instead of the CPU type name.
Signed-off-by: Gavin Shan <gs...@redhat.com>
Looks good.
Reviewed-by: Cédric Le Goater <c...@kaod.org>
With a quick hack adding a valid_cpu_types list to the pseries machine,
QEMU reported:
qemu-system-ppc64 -M pseries -cpu 460exb
qemu-system-ppc64: Invalid CPU type: 460exb
The valid types are: 970_v2.2, 970mp_v1.0, 970mp_v1.1, power5+_v2.1,
power7_v2.3, power7+_v2.1, power8_v2.0, power8e_v2.1, power8nvl_v1.0,
power9_v1.0, power9_v2.0, power9_v2.2, power10_v1.0, power10_v2.0
This would be a great improvement for the PPC boards since the CPU
definitions are numerous :
$ install/bin/qemu-system-ppc64 -cpu ? | wc -l
418
and usually, the board only reports that the CPU specified on the
command line is not supported.
Thanks,
C.
---
target/ppc/cpu_init.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 02b7aad9b0..7281402331 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -7019,16 +7019,15 @@ static void ppc_cpu_list_entry(gpointer data, gpointer
user_data)
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
DeviceClass *family = DEVICE_CLASS(ppc_cpu_get_family_class(pcc));
const char *typename = object_class_get_name(oc);
- char *name;
+ char *model;
int i;
if (unlikely(strcmp(typename, TYPE_HOST_POWERPC_CPU) == 0)) {
return;
}
- name = g_strndup(typename,
- strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
- qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr);
+ model = cpu_model_from_type(typename);
+ qemu_printf("PowerPC %-16s PVR %08x\n", model, pcc->pvr);
for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
ObjectClass *alias_oc = ppc_cpu_class_by_name(alias->model);
@@ -7045,10 +7044,10 @@ static void ppc_cpu_list_entry(gpointer data, gpointer
user_data)
alias->alias, family->desc);
} else {
qemu_printf("PowerPC %-16s (alias for %s)\n",
- alias->alias, name);
+ alias->alias, model);
}
}
- g_free(name);
+ g_free(model);
}
void ppc_cpu_list(void)