qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] target: RFC: display deprecation flag for '-cpu help'
@ 2022-07-22 12:02 Daniel P. Berrangé
  2022-07-22 12:02 ` [PATCH v2 1/3] target/i386: display deprecation status in " Daniel P. Berrangé
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Daniel P. Berrangé @ 2022-07-22 12:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, Richard Henderson, Peter Maydell, Thomas Huth,
	David Hildenbrand, qemu-arm, Cornelia Huck,
	Daniel P. Berrangé

When querying '-cpu help' there is no presentation of fact that a
CPU may be deprecated. The user just has to try it and see if they
get a depecation message at runtime.  The QMP command for querying
CPUs report a deprecation bool flagreason.

The Icelake-Client CPU (removed in 6df39f5e583ca0f67bd934d1327f9ead2e3bd49c)
handled this by modifying the '.notes' section to add the word
'deprecated':

            {
                .version = 2,
                .note = "no TSX, deprecated",
                .alias = "Icelake-Client-noTSX",
                .props = (PropValue[]) {
                    { "hle", "off" },
                    { "rtm", "off" },
                    { /* end of list */ }
                },
            },

This relies on the person deprecating the CPU to remember to do this,
and is redundant when this info is already expressed in the
'.deprecation_note' field.

This short series suggests just modifying the '-cpu help'
formatter so that it displays '(deprecated)' next to any
CPUs

eg

$ qemu-system-x86_64 -cpu help:
Available CPUs:
x86 486                   (alias configured by machine type) (deprecated)

This series touched x86_64, s390x, and aarch64 because that's all I
personally needed from a downstream POV, but any & all of the targets
would benefit from this. They have each implemented the '-cpu help'
logic independantly though, and unifying that code is not entirely
straightforward.

Changed in v2:

  - Just include "deprecated" as a flag, not full description
    which made the output too verbose and long lines.

Daniel P. Berrangé (3):
  target/i386: display deprecation status in '-cpu help'
  target/s390x: display deprecation status in '-cpu help'
  target/arm: display deprecation status in '-cpu help'

 target/arm/helper.c       |  7 ++++++-
 target/i386/cpu.c         |  5 +++++
 target/s390x/cpu_models.c | 23 ++++++++++++++++++-----
 3 files changed, 29 insertions(+), 6 deletions(-)

-- 
2.36.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/3] target/i386: display deprecation status in '-cpu help'
  2022-07-22 12:02 [PATCH v2 0/3] target: RFC: display deprecation flag for '-cpu help' Daniel P. Berrangé
@ 2022-07-22 12:02 ` Daniel P. Berrangé
  2022-07-22 15:36   ` Cornelia Huck
  2022-07-22 12:02 ` [PATCH v2 2/3] target/s390x: " Daniel P. Berrangé
  2022-07-22 12:02 ` [PATCH v2 3/3] target/arm: " Daniel P. Berrangé
  2 siblings, 1 reply; 7+ messages in thread
From: Daniel P. Berrangé @ 2022-07-22 12:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, Richard Henderson, Peter Maydell, Thomas Huth,
	David Hildenbrand, qemu-arm, Cornelia Huck,
	Daniel P. Berrangé

When the user queries CPU models via QMP there is a 'deprecated' flag
present, however, this is not done for the CLI '-cpu help' command.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 target/i386/cpu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 6a57ef13af..70f78340e1 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4837,6 +4837,11 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data)
         desc = g_strdup_printf("%s", model_id);
     }
 
+    if (cc->model && cc->model->cpudef->deprecation_note) {
+        g_autofree char *olddesc = desc;
+        desc = g_strdup_printf("%s (deprecated)", olddesc);
+    }
+
     qemu_printf("x86 %-20s  %s\n", name, desc);
 }
 
-- 
2.36.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/3] target/s390x: display deprecation status in '-cpu help'
  2022-07-22 12:02 [PATCH v2 0/3] target: RFC: display deprecation flag for '-cpu help' Daniel P. Berrangé
  2022-07-22 12:02 ` [PATCH v2 1/3] target/i386: display deprecation status in " Daniel P. Berrangé
@ 2022-07-22 12:02 ` Daniel P. Berrangé
  2022-07-22 15:38   ` Cornelia Huck
  2022-07-22 12:02 ` [PATCH v2 3/3] target/arm: " Daniel P. Berrangé
  2 siblings, 1 reply; 7+ messages in thread
From: Daniel P. Berrangé @ 2022-07-22 12:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, Richard Henderson, Peter Maydell, Thomas Huth,
	David Hildenbrand, qemu-arm, Cornelia Huck,
	Daniel P. Berrangé

When the user queries CPU models via QMP there is a 'deprecated' flag
present, however, this is not done for the CLI '-cpu help' command.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 target/s390x/cpu_models.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 1a562d2801..c3a4f80633 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -334,18 +334,31 @@ const S390CPUDef *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga,
 static void s390_print_cpu_model_list_entry(gpointer data, gpointer user_data)
 {
     const S390CPUClass *scc = S390_CPU_CLASS((ObjectClass *)data);
+    CPUClass *cc = CPU_CLASS(scc);
     char *name = g_strdup(object_class_get_name((ObjectClass *)data));
-    const char *details = "";
+    g_autoptr(GString) details = g_string_new("");
 
     if (scc->is_static) {
-        details = "(static, migration-safe)";
-    } else if (scc->is_migration_safe) {
-        details = "(migration-safe)";
+        g_string_append(details, "static, ");
+    }
+    if (scc->is_migration_safe) {
+        g_string_append(details, "migration-safe, ");
+    }
+    if (cc->deprecation_note) {
+        g_string_append(details, "deprecated, ");
+    }
+    if (details->len) {
+        /* cull trailing ', ' */
+        g_string_truncate(details, details->len - 2);
     }
 
     /* strip off the -s390x-cpu */
     g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
-    qemu_printf("s390 %-15s %-35s %s\n", name, scc->desc, details);
+    if (details->len) {
+        qemu_printf("s390 %-15s %-35s (%s)\n", name, scc->desc, details->str);
+    } else {
+        qemu_printf("s390 %-15s %-35s\n", name, scc->desc);
+    }
     g_free(name);
 }
 
-- 
2.36.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/3] target/arm: display deprecation status in '-cpu help'
  2022-07-22 12:02 [PATCH v2 0/3] target: RFC: display deprecation flag for '-cpu help' Daniel P. Berrangé
  2022-07-22 12:02 ` [PATCH v2 1/3] target/i386: display deprecation status in " Daniel P. Berrangé
  2022-07-22 12:02 ` [PATCH v2 2/3] target/s390x: " Daniel P. Berrangé
@ 2022-07-22 12:02 ` Daniel P. Berrangé
  2022-07-22 15:40   ` Cornelia Huck
  2 siblings, 1 reply; 7+ messages in thread
From: Daniel P. Berrangé @ 2022-07-22 12:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, Richard Henderson, Peter Maydell, Thomas Huth,
	David Hildenbrand, qemu-arm, Cornelia Huck,
	Daniel P. Berrangé

When the user queries CPU models via QMP there is a 'deprecated' flag
present, however, this is not done for the CLI '-cpu help' command.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 target/arm/helper.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 1a8b06410e..ef4e33f309 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -8185,12 +8185,17 @@ static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b)
 static void arm_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
+    CPUClass *cc = CPU_CLASS(oc);
     const char *typename;
     char *name;
 
     typename = object_class_get_name(oc);
     name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_ARM_CPU));
-    qemu_printf("  %s\n", name);
+    if (cc->deprecation_note) {
+        qemu_printf("  %s (deprecated)\n", name);
+    } else {
+        qemu_printf("  %s\n", name);
+    }
     g_free(name);
 }
 
-- 
2.36.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/3] target/i386: display deprecation status in '-cpu help'
  2022-07-22 12:02 ` [PATCH v2 1/3] target/i386: display deprecation status in " Daniel P. Berrangé
@ 2022-07-22 15:36   ` Cornelia Huck
  0 siblings, 0 replies; 7+ messages in thread
From: Cornelia Huck @ 2022-07-22 15:36 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel
  Cc: qemu-s390x, Richard Henderson, Peter Maydell, Thomas Huth,
	David Hildenbrand, qemu-arm, Daniel P. Berrangé

On Fri, Jul 22 2022, Daniel P. Berrangé <berrange@redhat.com> wrote:

> When the user queries CPU models via QMP there is a 'deprecated' flag
> present, however, this is not done for the CLI '-cpu help' command.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  target/i386/cpu.c | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/3] target/s390x: display deprecation status in '-cpu help'
  2022-07-22 12:02 ` [PATCH v2 2/3] target/s390x: " Daniel P. Berrangé
@ 2022-07-22 15:38   ` Cornelia Huck
  0 siblings, 0 replies; 7+ messages in thread
From: Cornelia Huck @ 2022-07-22 15:38 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel
  Cc: qemu-s390x, Richard Henderson, Peter Maydell, Thomas Huth,
	David Hildenbrand, qemu-arm, Daniel P. Berrangé

On Fri, Jul 22 2022, Daniel P. Berrangé <berrange@redhat.com> wrote:

> When the user queries CPU models via QMP there is a 'deprecated' flag
> present, however, this is not done for the CLI '-cpu help' command.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  target/s390x/cpu_models.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/3] target/arm: display deprecation status in '-cpu help'
  2022-07-22 12:02 ` [PATCH v2 3/3] target/arm: " Daniel P. Berrangé
@ 2022-07-22 15:40   ` Cornelia Huck
  0 siblings, 0 replies; 7+ messages in thread
From: Cornelia Huck @ 2022-07-22 15:40 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel
  Cc: qemu-s390x, Richard Henderson, Peter Maydell, Thomas Huth,
	David Hildenbrand, qemu-arm, Daniel P. Berrangé

On Fri, Jul 22 2022, Daniel P. Berrangé <berrange@redhat.com> wrote:

> When the user queries CPU models via QMP there is a 'deprecated' flag
> present, however, this is not done for the CLI '-cpu help' command.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  target/arm/helper.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-22 15:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-22 12:02 [PATCH v2 0/3] target: RFC: display deprecation flag for '-cpu help' Daniel P. Berrangé
2022-07-22 12:02 ` [PATCH v2 1/3] target/i386: display deprecation status in " Daniel P. Berrangé
2022-07-22 15:36   ` Cornelia Huck
2022-07-22 12:02 ` [PATCH v2 2/3] target/s390x: " Daniel P. Berrangé
2022-07-22 15:38   ` Cornelia Huck
2022-07-22 12:02 ` [PATCH v2 3/3] target/arm: " Daniel P. Berrangé
2022-07-22 15:40   ` Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).