[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/9] hw/arm/virt: Display list of valid CPUs for the Virt machine
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 6/9] hw/arm/virt: Display list of valid CPUs for the Virt machine |
Date: |
Fri, 5 Feb 2021 15:43:42 +0100 |
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é <f4bug@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
- Re: [PATCH 2/9] tests/qtest: Restrict xlnx-can-test to TCG builds, (continued)
- [PATCH 3/9] tests/qtest/boot-serial-test: Test Virt machine with 'max', Philippe Mathieu-Daudé, 2021/02/05
- [PATCH 4/9] tests/qtest/cdrom-test: Only allow the Virt machine under KVM, Philippe Mathieu-Daudé, 2021/02/05
- [PATCH 7/9] hw/arm/virt: Do not include 64-bit CPUs in 32-bit build, Philippe Mathieu-Daudé, 2021/02/05
- [PATCH 6/9] hw/arm/virt: Display list of valid CPUs for the Virt machine,
Philippe Mathieu-Daudé <=
- [PATCH 5/9] hw/arm/virt: Improve CPU name in help message, Philippe Mathieu-Daudé, 2021/02/05
- [PATCH 8/9] hw/arm/virt: Restrict 32-bit CPUs to TCG, Philippe Mathieu-Daudé, 2021/02/05
- [RFC PATCH 9/9] tests/qtest/arm-cpu-features: Restrict TCG-only tests, Philippe Mathieu-Daudé, 2021/02/05