[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 4/9] machine: Print CPU model name instead of CPU type
From: |
Gavin Shan |
Subject: |
[PATCH v9 4/9] machine: Print CPU model name instead of CPU type |
Date: |
Mon, 4 Dec 2023 10:47:21 +1000 |
The names of supported CPU models instead of CPU types should be
printed when the user specified CPU type isn't supported, to be
consistent with the output from '-cpu ?'.
Correct the error messages to print CPU model names instead of CPU
type names.
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/machine.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 4ae9aaee8e..bc9c3e7dcd 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1409,15 +1409,19 @@ static bool is_cpu_type_supported(const MachineState
*machine, Error **errp)
/* The user specified CPU type isn't valid */
if (!mc->valid_cpu_types[i]) {
- error_setg(errp, "Invalid CPU type: %s", machine->cpu_type);
+ g_autofree char *requested =
cpu_model_from_type(machine->cpu_type);
+ error_setg(errp, "Invalid CPU model: %s", requested);
if (!mc->valid_cpu_types[1]) {
- error_append_hint(errp, "The only valid type is: %s\n",
- mc->valid_cpu_types[0]);
+ g_autofree char *model = cpu_model_from_type(
+ mc->valid_cpu_types[0]);
+ error_append_hint(errp, "The only valid type is: %s\n", model);
} else {
- error_append_hint(errp, "The valid types are: ");
+ error_append_hint(errp, "The valid models are: ");
for (i = 0; mc->valid_cpu_types[i]; i++) {
+ g_autofree char *model = cpu_model_from_type(
+ mc->valid_cpu_types[i]);
error_append_hint(errp, "%s%s",
- mc->valid_cpu_types[i],
+ model,
mc->valid_cpu_types[i + 1] ? ", " : "");
}
error_append_hint(errp, "\n");
--
2.42.0
- [PATCH v9 0/9] Unified CPU type check, Gavin Shan, 2023/12/03
- [PATCH v9 1/9] machine: Use error handling when CPU type is checked, Gavin Shan, 2023/12/03
- [PATCH v9 2/9] machine: Introduce helper is_cpu_type_supported(), Gavin Shan, 2023/12/03
- [PATCH v9 3/9] machine: Improve is_cpu_type_supported(), Gavin Shan, 2023/12/03
- [PATCH v9 4/9] machine: Print CPU model name instead of CPU type,
Gavin Shan <=
- [PATCH v9 5/9] hw/arm/virt: Hide host CPU model for tcg, Gavin Shan, 2023/12/03
- [PATCH v9 6/9] hw/arm/virt: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/12/03
- [PATCH v9 7/9] hw/arm/sbsa-ref: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/12/03
- [PATCH v9 8/9] hw/arm: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/12/03
- [PATCH v9 9/9] hw/riscv/shakti_c: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/12/03
- Re: [PATCH v9 0/9] Unified CPU type check, Gavin Shan, 2023/12/11