[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 15/33] target/ppc: Use generic helper to show CPU model names
From: |
Gavin Shan |
Subject: |
[PATCH v4 15/33] target/ppc: Use generic helper to show CPU model names |
Date: |
Thu, 2 Nov 2023 10:24:42 +1000 |
For target/ppc, the registered CPU type name is always the
combination of the CPU model name and suffix. Use cpu_model_from_type()
to show the CPU model names.
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
---
target/ppc/cpu_init.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 40fe14a6c2..a8ab698700 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -7029,16 +7029,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);
@@ -7055,10 +7054,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)
@@ -7067,6 +7066,7 @@ void ppc_cpu_list(void)
list = object_class_get_list(TYPE_POWERPC_CPU, false);
list = g_slist_sort(list, ppc_cpu_list_compare);
+ qemu_printf("Available CPUs:\n");
g_slist_foreach(list, ppc_cpu_list_entry, NULL);
g_slist_free(list);
--
2.41.0
- Re: [PATCH v4 06/33] target/arm: Use generic helper to show CPU model names, (continued)
[PATCH v4 07/33] target/avr: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 08/33] target/cris: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 09/33] target/hexagon: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 10/33] target/i386: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 11/33] target/loongarch: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 12/33] target/m68k: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 13/33] target/mips: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 14/33] target/openrisc: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 15/33] target/ppc: Use generic helper to show CPU model names,
Gavin Shan <=
[PATCH v4 16/33] target/riscv: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 17/33] target/rx: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 18/33] target/s390x: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 19/33] target/sh4: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 20/33] target/tricore: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
[PATCH v4 21/33] target/hppa: Implement hppa_cpu_list(), Gavin Shan, 2023/11/01
[PATCH v4 22/33] target/microblaze: Implement microblaze_cpu_list(), Gavin Shan, 2023/11/01
[PATCH v4 23/33] target/nios2: Implement nios2_cpu_list(), Gavin Shan, 2023/11/01
[PATCH v4 24/33] cpu: Mark cpu_list() supported on all targets, Gavin Shan, 2023/11/01
[PATCH v4 25/33] machine: Constify MachineClass::valid_cpu_types[i], Gavin Shan, 2023/11/01