@@ -299,6 +299,14 @@ void list_cpus(void)
#endif
}
+void list_cpu_props(CPUState *cs)
+{
+ /* XXX: implement xxx_cpu_list_props for targets that still miss it */
+#if defined(cpu_list_props)
+ cpu_list_props(cs);
+#endif
+}
+
#if defined(CONFIG_USER_ONLY)
void tb_invalidate_phys_addr(hwaddr addr)
{
@@ -166,5 +166,6 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
/* vl.c */
void list_cpus(void);
+void list_cpu_props(CPUState *);
#endif /* CPU_COMMON_H */
@@ -2226,6 +2226,20 @@ void riscv_cpu_list(void)
g_slist_free(list);
}
+void riscv_cpu_list_props(CPUState *cs)
+{
+ char *enabled_isa;
+ RISCVCPU *cpu = RISCV_CPU(cs);
+ RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(cpu);
+ ObjectClass *oc = OBJECT_CLASS(mcc);
+
+ enabled_isa = riscv_isa_string(RISCV_CPU(cs));
+ qemu_printf("Enabled extensions:\n");
+ qemu_printf("\t%s\n", enabled_isa);
+ qemu_printf("To get all configuable options for this cpu, use"
+ " -device %s,help\n", object_class_get_name(oc));
+}
+
#define DEFINE_CPU(type_name, initfn) \
{ \
.name = type_name, \
@@ -443,9 +443,11 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
bool probe, uintptr_t retaddr);
char *riscv_isa_string(RISCVCPU *cpu);
void riscv_cpu_list(void);
+void riscv_cpu_list_props(CPUState *cs);
void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp);
#define cpu_list riscv_cpu_list
+#define cpu_list_props riscv_cpu_list_props
#define cpu_mmu_index riscv_cpu_mmu_index
#ifndef CONFIG_USER_ONLY
This API used for output current configuration for one specified CPU. Currently only RISC-V frontend implements this API. Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com> --- cpu.c | 8 ++++++++ include/exec/cpu-common.h | 1 + target/riscv/cpu.c | 14 ++++++++++++++ target/riscv/cpu.h | 2 ++ 4 files changed, 25 insertions(+)