[PATCH] target/ppc: Remove "compat" property of server class POWER CPUs

Greg Kurz posted 1 patch 3 years, 4 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
docs/system/deprecated.rst      |  7 ----
target/ppc/translate_init.c.inc | 59 ---------------------------------
2 files changed, 66 deletions(-)
[PATCH] target/ppc: Remove "compat" property of server class POWER CPUs
Posted by Greg Kurz 3 years, 4 months ago
This property has been deprecated since QEMU 5.0 by commit 22062e54bb68.
We only kept a legacy hack that internally converts "compat" into the
official "max-cpu-compat" property of the pseries machine type.

According to our deprecation policy, we could have removed it for QEMU 5.2
already. Do it now ; since ppc_cpu_parse_featurestr() now just calls the
generic parent_parse_features handler, drop it as well.

Users are supposed to use the "max-cpu-compat" property of the pseries
machine type instead.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 docs/system/deprecated.rst      |  7 ----
 target/ppc/translate_init.c.inc | 59 ---------------------------------
 2 files changed, 66 deletions(-)

diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index 565389697e84..09c8f380bc82 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -281,13 +281,6 @@ a future version of QEMU. It's unclear whether anybody is still using
 CPU emulation in QEMU, and there are no test images available to make
 sure that the code is still working.
 
-``compat`` property of server class POWER CPUs (since 5.0)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-The ``compat`` property used to set backwards compatibility modes for
-the processor has been deprecated. The ``max-cpu-compat`` property of
-the ``pseries`` machine type should be used instead.
-
 ``lm32`` CPUs (since 5.2.0)
 '''''''''''''''''''''''''''
 
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
index 78cc8f043b92..e4082cfde746 100644
--- a/target/ppc/translate_init.c.inc
+++ b/target/ppc/translate_init.c.inc
@@ -10470,63 +10470,6 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)
     return oc;
 }
 
-static void ppc_cpu_parse_featurestr(const char *type, char *features,
-                                     Error **errp)
-{
-    Object *machine = qdev_get_machine();
-    const PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(object_class_by_name(type));
-
-    if (!features) {
-        return;
-    }
-
-    if (object_property_find(machine, "max-cpu-compat")) {
-        int i;
-        char **inpieces;
-        char *s = features;
-        Error *local_err = NULL;
-        char *compat_str = NULL;
-
-        /*
-         * Backwards compatibility hack:
-         *
-         *   CPUs had a "compat=" property which didn't make sense for
-         *   anything except pseries.  It was replaced by "max-cpu-compat"
-         *   machine option.  This supports old command lines like
-         *       -cpu POWER8,compat=power7
-         *   By stripping the compat option and applying it to the machine
-         *   before passing it on to the cpu level parser.
-         */
-        inpieces = g_strsplit(features, ",", 0);
-        *s = '\0';
-        for (i = 0; inpieces[i]; i++) {
-            if (g_str_has_prefix(inpieces[i], "compat=")) {
-                warn_report_once("CPU 'compat' property is deprecated; "
-                    "use max-cpu-compat machine property instead");
-                compat_str = inpieces[i];
-                continue;
-            }
-            if ((i != 0) && (s != features)) {
-                s = g_stpcpy(s, ",");
-            }
-            s = g_stpcpy(s, inpieces[i]);
-        }
-
-        if (compat_str) {
-            char *v = compat_str + strlen("compat=");
-            object_property_set_str(machine, "max-cpu-compat", v, &local_err);
-        }
-        g_strfreev(inpieces);
-        if (local_err) {
-            error_propagate(errp, local_err);
-            return;
-        }
-    }
-
-    /* do property processing with generic handler */
-    pcc->parent_parse_features(type, features, errp);
-}
-
 PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)
 {
     ObjectClass *oc = OBJECT_CLASS(pcc);
@@ -10905,8 +10848,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
     device_class_set_parent_reset(dc, ppc_cpu_reset, &pcc->parent_reset);
 
     cc->class_by_name = ppc_cpu_class_by_name;
-    pcc->parent_parse_features = cc->parse_features;
-    cc->parse_features = ppc_cpu_parse_featurestr;
     cc->has_work = ppc_cpu_has_work;
     cc->do_interrupt = ppc_cpu_do_interrupt;
     cc->cpu_exec_interrupt = ppc_cpu_exec_interrupt;
-- 
2.26.2

Re: [PATCH] target/ppc: Remove "compat" property of server class POWER CPUs
Posted by Greg Kurz 3 years, 4 months ago
Just to clarify, this is for 6.0.

On Tue, 1 Dec 2020 14:11:03 +0100
Greg Kurz <groug@kaod.org> wrote:

> This property has been deprecated since QEMU 5.0 by commit 22062e54bb68.
> We only kept a legacy hack that internally converts "compat" into the
> official "max-cpu-compat" property of the pseries machine type.
> 
> According to our deprecation policy, we could have removed it for QEMU 5.2
> already. Do it now ; since ppc_cpu_parse_featurestr() now just calls the
> generic parent_parse_features handler, drop it as well.
> 
> Users are supposed to use the "max-cpu-compat" property of the pseries
> machine type instead.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  docs/system/deprecated.rst      |  7 ----
>  target/ppc/translate_init.c.inc | 59 ---------------------------------
>  2 files changed, 66 deletions(-)
> 
> diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
> index 565389697e84..09c8f380bc82 100644
> --- a/docs/system/deprecated.rst
> +++ b/docs/system/deprecated.rst
> @@ -281,13 +281,6 @@ a future version of QEMU. It's unclear whether anybody is still using
>  CPU emulation in QEMU, and there are no test images available to make
>  sure that the code is still working.
>  
> -``compat`` property of server class POWER CPUs (since 5.0)
> -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> -
> -The ``compat`` property used to set backwards compatibility modes for
> -the processor has been deprecated. The ``max-cpu-compat`` property of
> -the ``pseries`` machine type should be used instead.
> -
>  ``lm32`` CPUs (since 5.2.0)
>  '''''''''''''''''''''''''''
>  
> diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
> index 78cc8f043b92..e4082cfde746 100644
> --- a/target/ppc/translate_init.c.inc
> +++ b/target/ppc/translate_init.c.inc
> @@ -10470,63 +10470,6 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)
>      return oc;
>  }
>  
> -static void ppc_cpu_parse_featurestr(const char *type, char *features,
> -                                     Error **errp)
> -{
> -    Object *machine = qdev_get_machine();
> -    const PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(object_class_by_name(type));
> -
> -    if (!features) {
> -        return;
> -    }
> -
> -    if (object_property_find(machine, "max-cpu-compat")) {
> -        int i;
> -        char **inpieces;
> -        char *s = features;
> -        Error *local_err = NULL;
> -        char *compat_str = NULL;
> -
> -        /*
> -         * Backwards compatibility hack:
> -         *
> -         *   CPUs had a "compat=" property which didn't make sense for
> -         *   anything except pseries.  It was replaced by "max-cpu-compat"
> -         *   machine option.  This supports old command lines like
> -         *       -cpu POWER8,compat=power7
> -         *   By stripping the compat option and applying it to the machine
> -         *   before passing it on to the cpu level parser.
> -         */
> -        inpieces = g_strsplit(features, ",", 0);
> -        *s = '\0';
> -        for (i = 0; inpieces[i]; i++) {
> -            if (g_str_has_prefix(inpieces[i], "compat=")) {
> -                warn_report_once("CPU 'compat' property is deprecated; "
> -                    "use max-cpu-compat machine property instead");
> -                compat_str = inpieces[i];
> -                continue;
> -            }
> -            if ((i != 0) && (s != features)) {
> -                s = g_stpcpy(s, ",");
> -            }
> -            s = g_stpcpy(s, inpieces[i]);
> -        }
> -
> -        if (compat_str) {
> -            char *v = compat_str + strlen("compat=");
> -            object_property_set_str(machine, "max-cpu-compat", v, &local_err);
> -        }
> -        g_strfreev(inpieces);
> -        if (local_err) {
> -            error_propagate(errp, local_err);
> -            return;
> -        }
> -    }
> -
> -    /* do property processing with generic handler */
> -    pcc->parent_parse_features(type, features, errp);
> -}
> -
>  PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)
>  {
>      ObjectClass *oc = OBJECT_CLASS(pcc);
> @@ -10905,8 +10848,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>      device_class_set_parent_reset(dc, ppc_cpu_reset, &pcc->parent_reset);
>  
>      cc->class_by_name = ppc_cpu_class_by_name;
> -    pcc->parent_parse_features = cc->parse_features;
> -    cc->parse_features = ppc_cpu_parse_featurestr;
>      cc->has_work = ppc_cpu_has_work;
>      cc->do_interrupt = ppc_cpu_do_interrupt;
>      cc->cpu_exec_interrupt = ppc_cpu_exec_interrupt;

Re: [PATCH] target/ppc: Remove "compat" property of server class POWER CPUs
Posted by Ján Tomko 3 years, 4 months ago
On a Tuesday in 2020, Greg Kurz wrote:
>This property has been deprecated since QEMU 5.0 by commit 22062e54bb68.
>We only kept a legacy hack that internally converts "compat" into the
>official "max-cpu-compat" property of the pseries machine type.
>
>According to our deprecation policy, we could have removed it for QEMU 5.2
>already. Do it now ; since ppc_cpu_parse_featurestr() now just calls the
>generic parent_parse_features handler, drop it as well.
>
>Users are supposed to use the "max-cpu-compat" property of the pseries
>machine type instead.
>

For libvirt:
Reviewed-by: Ján Tomko <jtomko@redhat.com>

We use the new option as of libvirt commit:

commit 2b041dc8c7b70e762d99b6bd7805daa9961740f6
Author:     Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
AuthorDate: 2018-01-05 19:18:00 +0530
Commit:     Andrea Bolognani <abologna@redhat.com>
CommitDate: 2018-01-05 17:12:14 +0100

     qemu: Add support for pseries machine's max-cpu-compat= parameter

Jano

>Signed-off-by: Greg Kurz <groug@kaod.org>
>---
> docs/system/deprecated.rst      |  7 ----
> target/ppc/translate_init.c.inc | 59 ---------------------------------
> 2 files changed, 66 deletions(-)
>
Re: [PATCH] target/ppc: Remove "compat" property of server class POWER CPUs
Posted by David Gibson 3 years, 4 months ago
On Tue, Dec 01, 2020 at 02:11:03PM +0100, Greg Kurz wrote:
> This property has been deprecated since QEMU 5.0 by commit 22062e54bb68.
> We only kept a legacy hack that internally converts "compat" into the
> official "max-cpu-compat" property of the pseries machine type.
> 
> According to our deprecation policy, we could have removed it for QEMU 5.2
> already. Do it now ; since ppc_cpu_parse_featurestr() now just calls the
> generic parent_parse_features handler, drop it as well.
> 
> Users are supposed to use the "max-cpu-compat" property of the pseries
> machine type instead.

Applied, thanks.

> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  docs/system/deprecated.rst      |  7 ----
>  target/ppc/translate_init.c.inc | 59 ---------------------------------
>  2 files changed, 66 deletions(-)
> 
> diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
> index 565389697e84..09c8f380bc82 100644
> --- a/docs/system/deprecated.rst
> +++ b/docs/system/deprecated.rst
> @@ -281,13 +281,6 @@ a future version of QEMU. It's unclear whether anybody is still using
>  CPU emulation in QEMU, and there are no test images available to make
>  sure that the code is still working.
>  
> -``compat`` property of server class POWER CPUs (since 5.0)
> -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> -
> -The ``compat`` property used to set backwards compatibility modes for
> -the processor has been deprecated. The ``max-cpu-compat`` property of
> -the ``pseries`` machine type should be used instead.
> -
>  ``lm32`` CPUs (since 5.2.0)
>  '''''''''''''''''''''''''''
>  
> diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
> index 78cc8f043b92..e4082cfde746 100644
> --- a/target/ppc/translate_init.c.inc
> +++ b/target/ppc/translate_init.c.inc
> @@ -10470,63 +10470,6 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)
>      return oc;
>  }
>  
> -static void ppc_cpu_parse_featurestr(const char *type, char *features,
> -                                     Error **errp)
> -{
> -    Object *machine = qdev_get_machine();
> -    const PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(object_class_by_name(type));
> -
> -    if (!features) {
> -        return;
> -    }
> -
> -    if (object_property_find(machine, "max-cpu-compat")) {
> -        int i;
> -        char **inpieces;
> -        char *s = features;
> -        Error *local_err = NULL;
> -        char *compat_str = NULL;
> -
> -        /*
> -         * Backwards compatibility hack:
> -         *
> -         *   CPUs had a "compat=" property which didn't make sense for
> -         *   anything except pseries.  It was replaced by "max-cpu-compat"
> -         *   machine option.  This supports old command lines like
> -         *       -cpu POWER8,compat=power7
> -         *   By stripping the compat option and applying it to the machine
> -         *   before passing it on to the cpu level parser.
> -         */
> -        inpieces = g_strsplit(features, ",", 0);
> -        *s = '\0';
> -        for (i = 0; inpieces[i]; i++) {
> -            if (g_str_has_prefix(inpieces[i], "compat=")) {
> -                warn_report_once("CPU 'compat' property is deprecated; "
> -                    "use max-cpu-compat machine property instead");
> -                compat_str = inpieces[i];
> -                continue;
> -            }
> -            if ((i != 0) && (s != features)) {
> -                s = g_stpcpy(s, ",");
> -            }
> -            s = g_stpcpy(s, inpieces[i]);
> -        }
> -
> -        if (compat_str) {
> -            char *v = compat_str + strlen("compat=");
> -            object_property_set_str(machine, "max-cpu-compat", v, &local_err);
> -        }
> -        g_strfreev(inpieces);
> -        if (local_err) {
> -            error_propagate(errp, local_err);
> -            return;
> -        }
> -    }
> -
> -    /* do property processing with generic handler */
> -    pcc->parent_parse_features(type, features, errp);
> -}
> -
>  PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)
>  {
>      ObjectClass *oc = OBJECT_CLASS(pcc);
> @@ -10905,8 +10848,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>      device_class_set_parent_reset(dc, ppc_cpu_reset, &pcc->parent_reset);
>  
>      cc->class_by_name = ppc_cpu_class_by_name;
> -    pcc->parent_parse_features = cc->parse_features;
> -    cc->parse_features = ppc_cpu_parse_featurestr;
>      cc->has_work = ppc_cpu_has_work;
>      cc->do_interrupt = ppc_cpu_do_interrupt;
>      cc->cpu_exec_interrupt = ppc_cpu_exec_interrupt;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson