Message ID | 20220714150735.1835166-2-berrange@redhat.com |
---|---|
State | New |
Headers | show |
Series | target: RFC: display deprecation note for '-cpu help' | expand |
On Thu, Jul 14 2022, Daniel P. Berrangé <berrange@redhat.com> wrote: > The deprecation notes are currently only displayed at runtime when the > user activates a CPU. The QMP query displays a simple flag for > deprecation, while '-cpu help' displays nothing unless the deprecation > info is duplicated into the 'notes' field. > > This changes the code so that deprecation notes are explicitly shown > in '-cpu help', to assist the user in deciding what to use. > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> > --- > target/i386/cpu.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) Reviewed-by: Cornelia Huck <cohuck@redhat.com>
diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 6a57ef13af..a2c5dcfc04 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4833,10 +4833,21 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data) if (!desc && cc->model && cc->model->note) { desc = g_strdup_printf("%s [%s]", model_id, cc->model->note); } - if (!desc) { + if (!desc && *model_id) { desc = g_strdup_printf("%s", model_id); } + if (cc->model && cc->model->cpudef->deprecation_note) { + g_autofree char *dep = g_strdup_printf( + "(deprecated: %s)", cc->model->cpudef->deprecation_note); + if (desc) { + g_autofree char *olddesc = desc; + desc = g_strdup_printf("%s %s", olddesc, dep); + } else { + desc = g_steal_pointer(&dep); + } + } + qemu_printf("x86 %-20s %s\n", name, desc); }
The deprecation notes are currently only displayed at runtime when the user activates a CPU. The QMP query displays a simple flag for deprecation, while '-cpu help' displays nothing unless the deprecation info is duplicated into the 'notes' field. This changes the code so that deprecation notes are explicitly shown in '-cpu help', to assist the user in deciding what to use. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- target/i386/cpu.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)