aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Shan <gshan@redhat.com>2023-12-04 10:47:21 +1000
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-01-05 16:20:15 +0100
commit5422d2a8fa88471b49b8d8cd6a13d9ecbb0c6cb7 (patch)
tree215ae00a476aa380ce10010486d6c10d95c30090
parente702cbc19e6bc04685a48f9e07cbf74bf4d53042 (diff)
downloadqemu-5422d2a8fa88471b49b8d8cd6a13d9ecbb0c6cb7.zip
qemu-5422d2a8fa88471b49b8d8cd6a13d9ecbb0c6cb7.tar.gz
qemu-5422d2a8fa88471b49b8d8cd6a13d9ecbb0c6cb7.tar.bz2
machine: Print CPU model name instead of CPU type
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>
-rw-r--r--hw/core/machine.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index c523ce3..fc23910 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");