[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 21/33] target/hppa: Implement hppa_cpu_list()
From: |
Gavin Shan |
Subject: |
[PATCH v4 21/33] target/hppa: Implement hppa_cpu_list() |
Date: |
Thu, 2 Nov 2023 10:24:48 +1000 |
Implement hppa_cpu_list() to support cpu_list(). With this applied,
the available CPU model names, same to the CPU type names, are shown
as below.
$ ./build/qemu-system-hppa -cpu ?
Available CPUs:
hppa-cpu
Signed-off-by: Gavin Shan <gshan@redhat.com>
---
target/hppa/cpu.c | 19 +++++++++++++++++++
target/hppa/cpu.h | 3 +++
2 files changed, 22 insertions(+)
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 1644297bf8..2b5198d7c8 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -143,6 +143,25 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error
**errp)
#endif
}
+static void hppa_cpu_list_entry(gpointer data, gpointer user_data)
+{
+ const char *typename = object_class_get_name(OBJECT_CLASS(data));
+ char *model = cpu_model_from_type(typename);
+
+ qemu_printf(" %s\n", model);
+ g_free(model);
+}
+
+void hppa_cpu_list(void)
+{
+ GSList *list;
+
+ list = object_class_get_list_sorted(TYPE_HPPA_CPU, false);
+ qemu_printf("Available CPUs:\n");
+ g_slist_foreach(list, hppa_cpu_list_entry, NULL);
+ g_slist_free(list);
+}
+
static void hppa_cpu_initfn(Object *obj)
{
CPUState *cs = CPU(obj);
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index 798d0c26d7..d8106c89dc 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -357,5 +357,8 @@ void hppa_cpu_alarm_timer(void *);
int hppa_artype_for_page(CPUHPPAState *env, target_ulong vaddr);
#endif
G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra);
+void hppa_cpu_list(void);
+
+#define cpu_list hppa_cpu_list
#endif /* HPPA_CPU_H */
--
2.41.0
- [PATCH v4 12/33] target/m68k: Use generic helper to show CPU model names, (continued)
- [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, 2023/11/01
- [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 22/33] target/microblaze: Implement microblaze_cpu_list(), Gavin Shan, 2023/11/01
- [PATCH v4 21/33] target/hppa: Implement hppa_cpu_list(),
Gavin Shan <=
- [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
- [PATCH v4 26/33] machine: Use error handling when CPU type is checked, Gavin Shan, 2023/11/01
- [PATCH v4 27/33] machine: Introduce helper is_cpu_type_supported(), Gavin Shan, 2023/11/01
- [PATCH v4 28/33] machine: Print CPU model name instead of CPU type name, Gavin Shan, 2023/11/01
- [PATCH v4 29/33] hw/arm/virt: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/11/01
- [PATCH v4 30/33] hw/arm/virt: Hide host CPU model for tcg, Gavin Shan, 2023/11/01
- [PATCH v4 31/33] hw/arm/sbsa-ref: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/11/01
- [PATCH v4 32/33] hw/arm: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/11/01