[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 12/32] target/ppc: Use generic helper to show CPU model names
From: |
Gavin Shan |
Subject: |
[PATCH v3 12/32] target/ppc: Use generic helper to show CPU model names |
Date: |
Thu, 7 Sep 2023 10:35:33 +1000 |
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 <gshan@redhat.com>
---
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)
--
2.41.0
- [PATCH v3 02/32] target/alpha: Use generic helper to show CPU model names, (continued)
- [PATCH v3 02/32] target/alpha: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 03/32] target/arm: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 04/32] target/avr: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 05/32] target/cris: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 06/32] target/hexagon: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 07/32] target/i386: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 08/32] target/loongarch: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 09/32] target/m68k: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 10/32] target/mips: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 11/32] target/openrisc: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 12/32] target/ppc: Use generic helper to show CPU model names,
Gavin Shan <=
- [PATCH v3 13/32] target/riscv: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 14/32] target/rx: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 15/32] target/s390x: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06