[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/71] machine: Print CPU model name instead of CPU type
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 27/71] machine: Print CPU model name instead of CPU type |
Date: |
Fri, 5 Jan 2024 16:42:20 +0100 |
From: Gavin Shan <gshan@redhat.com>
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>
Message-ID: <20231204004726.483558-5-gshan@redhat.com>
Signed-off-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 c523ce32eb..fc239101f9 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1421,15 +1421,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.41.0
- [PULL 14/71] target/m68k: Use generic cpu_list(), (continued)
- [PULL 14/71] target/m68k: Use generic cpu_list(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 15/71] target/mips: Use generic cpu_list(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 16/71] target/openrisc: Use generic cpu_list(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 17/71] target/riscv: Use generic cpu_list(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 18/71] target/rx: Use generic cpu_list(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 20/71] target/tricore: Use generic cpu_list(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 19/71] target/sh4: Use generic cpu_list(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 21/71] target/xtensa: Use generic cpu_list(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 24/71] machine: Use error handling when CPU type is checked, Philippe Mathieu-Daudé, 2024/01/05
- [PULL 22/71] target: Use generic cpu_model_from_type(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 27/71] machine: Print CPU model name instead of CPU type,
Philippe Mathieu-Daudé <=
- [PULL 28/71] hw/arm/virt: Hide host CPU model for tcg, Philippe Mathieu-Daudé, 2024/01/05
- [PULL 23/71] hw/core: Add machine_class_default_cpu_type(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 25/71] machine: Introduce helper is_cpu_type_supported(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 26/71] machine: Improve is_cpu_type_supported(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 29/71] hw/arm/virt: Check CPU type in machine_run_board_init(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 30/71] hw/arm/sbsa-ref: Check CPU type in machine_run_board_init(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 32/71] hw/riscv/shakti_c: Check CPU type in machine_run_board_init(), Philippe Mathieu-Daudé, 2024/01/05
- [PULL 34/71] hw/core/cpu: Update description of CPUState::node, Philippe Mathieu-Daudé, 2024/01/05