The Virt machine is restricted to a subset of the CPU provided by QEMU. Instead of having the user run '--cpu help' and try each CPUs until finding a match, display the list from start:
$ qemu-system-aarch64 -M virt -cpu cortex-a8 qemu-system-aarch64: mach-virt: CPU type cortex-a8 not supported qemu-system-aarch64: mach-virt: Please select one of the following CPU types: cortex-a7, cortex-a15, cortex-a53, cortex-a57, cortex-a72, host, max Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- hw/arm/virt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 7802d3a66e8..6ffe091804f 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1830,9 +1830,20 @@ static void machvirt_init(MachineState *machine) if (!cpu_type_valid(machine->cpu_type)) { int len = strlen(machine->cpu_type) - strlen(ARM_CPU_TYPE_SUFFIX); + g_autoptr(GString) s = g_string_new(NULL); error_report("mach-virt: CPU type %.*s not supported", len, machine->cpu_type); + + for (n = 0; n < ARRAY_SIZE(valid_cpus); n++) { + len = strlen(valid_cpus[n]) - strlen(ARM_CPU_TYPE_SUFFIX); + g_string_append_printf(s, " %.*s", len, valid_cpus[n]); + if (n + 1 < ARRAY_SIZE(valid_cpus)) { + g_string_append_c(s, ','); + } + } + error_report("mach-virt: Please select one of the following CPU types: %s", + g_string_free(s, FALSE)); exit(1); } -- 2.26.2