All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ppc: function to setup latest class options
@ 2020-02-07  6:48 ` Michael S. Tsirkin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2020-02-07  6:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, David Gibson

We are going to add more init for the latest machine, so move the setup
to a function so we don't have to change the DEFINE_SPAPR_MACHINE macro
each time.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/ppc/spapr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 02cf53fc5b..4cf2a992a5 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4428,6 +4428,12 @@ static const TypeInfo spapr_machine_info = {
     },
 };
 
+static void spapr_machine_latest_class_options(MachineClass *mc)
+{
+    mc->alias = "pseries";
+    mc->is_default = 1;
+}
+
 #define DEFINE_SPAPR_MACHINE(suffix, verstr, latest)                 \
     static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \
                                                     void *data)      \
@@ -4435,8 +4441,7 @@ static const TypeInfo spapr_machine_info = {
         MachineClass *mc = MACHINE_CLASS(oc);                        \
         spapr_machine_##suffix##_class_options(mc);                  \
         if (latest) {                                                \
-            mc->alias = "pseries";                                   \
-            mc->is_default = 1;                                      \
+            spapr_machine_latest_class_options(mc);                  \
         }                                                            \
     }                                                                \
     static const TypeInfo spapr_machine_##suffix##_info = {          \
-- 
MST



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

* [PATCH] ppc: function to setup latest class options
@ 2020-02-07  6:48 ` Michael S. Tsirkin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2020-02-07  6:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, David Gibson

We are going to add more init for the latest machine, so move the setup
to a function so we don't have to change the DEFINE_SPAPR_MACHINE macro
each time.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/ppc/spapr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 02cf53fc5b..4cf2a992a5 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4428,6 +4428,12 @@ static const TypeInfo spapr_machine_info = {
     },
 };
 
+static void spapr_machine_latest_class_options(MachineClass *mc)
+{
+    mc->alias = "pseries";
+    mc->is_default = 1;
+}
+
 #define DEFINE_SPAPR_MACHINE(suffix, verstr, latest)                 \
     static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \
                                                     void *data)      \
@@ -4435,8 +4441,7 @@ static const TypeInfo spapr_machine_info = {
         MachineClass *mc = MACHINE_CLASS(oc);                        \
         spapr_machine_##suffix##_class_options(mc);                  \
         if (latest) {                                                \
-            mc->alias = "pseries";                                   \
-            mc->is_default = 1;                                      \
+            spapr_machine_latest_class_options(mc);                  \
         }                                                            \
     }                                                                \
     static const TypeInfo spapr_machine_##suffix##_info = {          \
-- 
MST



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

* Re: [PATCH] ppc: function to setup latest class options
  2020-02-07  6:48 ` Michael S. Tsirkin
  (?)
@ 2020-02-07  8:39 ` Laurent Vivier
  -1 siblings, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2020-02-07  8:39 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: qemu-ppc, David Gibson

On 07/02/2020 07:48, Michael S. Tsirkin wrote:
> We are going to add more init for the latest machine, so move the setup
> to a function so we don't have to change the DEFINE_SPAPR_MACHINE macro
> each time.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/ppc/spapr.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 02cf53fc5b..4cf2a992a5 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4428,6 +4428,12 @@ static const TypeInfo spapr_machine_info = {
>      },
>  };
>  
> +static void spapr_machine_latest_class_options(MachineClass *mc)
> +{
> +    mc->alias = "pseries";
> +    mc->is_default = 1;
> +}
> +
>  #define DEFINE_SPAPR_MACHINE(suffix, verstr, latest)                 \
>      static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \
>                                                      void *data)      \
> @@ -4435,8 +4441,7 @@ static const TypeInfo spapr_machine_info = {
>          MachineClass *mc = MACHINE_CLASS(oc);                        \
>          spapr_machine_##suffix##_class_options(mc);                  \
>          if (latest) {                                                \
> -            mc->alias = "pseries";                                   \
> -            mc->is_default = 1;                                      \
> +            spapr_machine_latest_class_options(mc);                  \
>          }                                                            \
>      }                                                                \
>      static const TypeInfo spapr_machine_##suffix##_info = {          \
> 

Reviewed-by: Laurent Vivier <lvivier@redhat.com>



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

* Re: [PATCH] ppc: function to setup latest class options
  2020-02-07  6:48 ` Michael S. Tsirkin
  (?)
  (?)
@ 2020-02-07 10:14 ` Greg Kurz
  -1 siblings, 0 replies; 8+ messages in thread
From: Greg Kurz @ 2020-02-07 10:14 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-ppc, qemu-devel, David Gibson

On Fri, 7 Feb 2020 01:48:02 -0500
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> We are going to add more init for the latest machine, so move the setup
> to a function so we don't have to change the DEFINE_SPAPR_MACHINE macro
> each time.
> 

Not sure about the meaning of "change the DEFINE_SPAPR_MACHINE macro" but
yes, if we don't put the additional init there, we would be forced to
move it around each time to the new default machine init.

> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/ppc/spapr.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 02cf53fc5b..4cf2a992a5 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4428,6 +4428,12 @@ static const TypeInfo spapr_machine_info = {
>      },
>  };
>  
> +static void spapr_machine_latest_class_options(MachineClass *mc)
> +{
> +    mc->alias = "pseries";
> +    mc->is_default = 1;
> +}
> +
>  #define DEFINE_SPAPR_MACHINE(suffix, verstr, latest)                 \
>      static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \
>                                                      void *data)      \
> @@ -4435,8 +4441,7 @@ static const TypeInfo spapr_machine_info = {
>          MachineClass *mc = MACHINE_CLASS(oc);                        \
>          spapr_machine_##suffix##_class_options(mc);                  \
>          if (latest) {                                                \
> -            mc->alias = "pseries";                                   \
> -            mc->is_default = 1;                                      \
> +            spapr_machine_latest_class_options(mc);                  \
>          }                                                            \
>      }                                                                \
>      static const TypeInfo spapr_machine_##suffix##_info = {          \



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

* Re: [PATCH] ppc: function to setup latest class options
  2020-02-07  6:48 ` Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  (?)
@ 2020-02-07 10:35 ` Philippe Mathieu-Daudé
  2020-02-07 11:12   ` Greg Kurz
  -1 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-07 10:35 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: qemu-ppc, David Gibson

On 2/7/20 7:48 AM, Michael S. Tsirkin wrote:
> We are going to add more init for the latest machine, so move the setup
> to a function so we don't have to change the DEFINE_SPAPR_MACHINE macro
> each time.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   hw/ppc/spapr.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 02cf53fc5b..4cf2a992a5 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4428,6 +4428,12 @@ static const TypeInfo spapr_machine_info = {
>       },
>   };
>   
> +static void spapr_machine_latest_class_options(MachineClass *mc)
> +{
> +    mc->alias = "pseries";
> +    mc->is_default = 1;

But we can have only 1 default per QEMU binary... How PPC manage having 
multiple defaults? The first or last listed is choosen as default?

> +}
> +
>   #define DEFINE_SPAPR_MACHINE(suffix, verstr, latest)                 \
>       static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \
>                                                       void *data)      \
> @@ -4435,8 +4441,7 @@ static const TypeInfo spapr_machine_info = {
>           MachineClass *mc = MACHINE_CLASS(oc);                        \
>           spapr_machine_##suffix##_class_options(mc);                  \
>           if (latest) {                                                \
> -            mc->alias = "pseries";                                   \
> -            mc->is_default = 1;                                      \
> +            spapr_machine_latest_class_options(mc);                  \
>           }                                                            \
>       }                                                                \
>       static const TypeInfo spapr_machine_##suffix##_info = {          \
> 



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

* Re: [PATCH] ppc: function to setup latest class options
  2020-02-07 10:35 ` Philippe Mathieu-Daudé
@ 2020-02-07 11:12   ` Greg Kurz
  2020-02-07 14:27     ` Michael S. Tsirkin
  0 siblings, 1 reply; 8+ messages in thread
From: Greg Kurz @ 2020-02-07 11:12 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: David Gibson, qemu-ppc, qemu-devel, Michael S. Tsirkin

On Fri, 7 Feb 2020 11:35:47 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> On 2/7/20 7:48 AM, Michael S. Tsirkin wrote:
> > We are going to add more init for the latest machine, so move the setup
> > to a function so we don't have to change the DEFINE_SPAPR_MACHINE macro
> > each time.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >   hw/ppc/spapr.c | 9 +++++++--
> >   1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index 02cf53fc5b..4cf2a992a5 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -4428,6 +4428,12 @@ static const TypeInfo spapr_machine_info = {
> >       },
> >   };
> >   
> > +static void spapr_machine_latest_class_options(MachineClass *mc)
> > +{
> > +    mc->alias = "pseries";
> > +    mc->is_default = 1;
> 
> But we can have only 1 default per QEMU binary... How PPC manage having 
> multiple defaults? The first or last listed is choosen as default?
> 

IIUC it isn't about putting multiple defaults here. It is about putting
any additional init for the default machine type that we cannot put in
spapr_machine_class_init(), instead of putting it in the versioned
init function, eg. spapr_machine_5_0_class_options(). Otherwise this
would force us to carry the change when we add a new machine version.

> > +}
> > +
> >   #define DEFINE_SPAPR_MACHINE(suffix, verstr, latest)                 \
> >       static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \
> >                                                       void *data)      \
> > @@ -4435,8 +4441,7 @@ static const TypeInfo spapr_machine_info = {
> >           MachineClass *mc = MACHINE_CLASS(oc);                        \
> >           spapr_machine_##suffix##_class_options(mc);                  \
> >           if (latest) {                                                \
> > -            mc->alias = "pseries";                                   \
> > -            mc->is_default = 1;                                      \
> > +            spapr_machine_latest_class_options(mc);                  \
> >           }                                                            \
> >       }                                                                \
> >       static const TypeInfo spapr_machine_##suffix##_info = {          \
> > 
> 
> 



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

* Re: [PATCH] ppc: function to setup latest class options
  2020-02-07 11:12   ` Greg Kurz
@ 2020-02-07 14:27     ` Michael S. Tsirkin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2020-02-07 14:27 UTC (permalink / raw)
  To: Greg Kurz; +Cc: qemu-ppc, Philippe Mathieu-Daudé, qemu-devel, David Gibson

On Fri, Feb 07, 2020 at 12:12:09PM +0100, Greg Kurz wrote:
> On Fri, 7 Feb 2020 11:35:47 +0100
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> 
> > On 2/7/20 7:48 AM, Michael S. Tsirkin wrote:
> > > We are going to add more init for the latest machine, so move the setup
> > > to a function so we don't have to change the DEFINE_SPAPR_MACHINE macro
> > > each time.
> > > 
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > ---
> > >   hw/ppc/spapr.c | 9 +++++++--
> > >   1 file changed, 7 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > > index 02cf53fc5b..4cf2a992a5 100644
> > > --- a/hw/ppc/spapr.c
> > > +++ b/hw/ppc/spapr.c
> > > @@ -4428,6 +4428,12 @@ static const TypeInfo spapr_machine_info = {
> > >       },
> > >   };
> > >   
> > > +static void spapr_machine_latest_class_options(MachineClass *mc)
> > > +{
> > > +    mc->alias = "pseries";
> > > +    mc->is_default = 1;
> > 
> > But we can have only 1 default per QEMU binary... How PPC manage having 
> > multiple defaults? The first or last listed is choosen as default?
> > 
> 
> IIUC it isn't about putting multiple defaults here. It is about putting
> any additional init for the default machine type that we cannot put in
> spapr_machine_class_init(), instead of putting it in the versioned
> init function, eg. spapr_machine_5_0_class_options(). Otherwise this
> would force us to carry the change when we add a new machine version.

Maybe it's cleaner to pass the latest flag to
spapr_machine_latest_class_options? Rename it spapr_machine_default_class_options?
This way we don't need to bother clearing is_default in other
machine types, we'll only set it for the latest one.

> > > +}
> > > +
> > >   #define DEFINE_SPAPR_MACHINE(suffix, verstr, latest)                 \
> > >       static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \
> > >                                                       void *data)      \
> > > @@ -4435,8 +4441,7 @@ static const TypeInfo spapr_machine_info = {
> > >           MachineClass *mc = MACHINE_CLASS(oc);                        \
> > >           spapr_machine_##suffix##_class_options(mc);                  \
> > >           if (latest) {                                                \
> > > -            mc->alias = "pseries";                                   \
> > > -            mc->is_default = 1;                                      \
> > > +            spapr_machine_latest_class_options(mc);                  \
> > >           }                                                            \
> > >       }                                                                \
> > >       static const TypeInfo spapr_machine_##suffix##_info = {          \
> > > 
> > 
> > 



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

* Re: [PATCH] ppc: function to setup latest class options
  2020-02-07  6:48 ` Michael S. Tsirkin
                   ` (3 preceding siblings ...)
  (?)
@ 2020-02-08 11:12 ` David Gibson
  -1 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2020-02-08 11:12 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-ppc, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1956 bytes --]

On Fri, Feb 07, 2020 at 01:46:37AM -0500, Michael S. Tsirkin wrote:
> We are going to add more init for the latest machine, so move the setup
> to a function so we don't have to change the DEFINE_SPAPR_MACHINE macro
> each time.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Applied to ppc-for-5.0.

> ---
>  hw/ppc/spapr.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 02cf53fc5b..4cf2a992a5 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4428,6 +4428,12 @@ static const TypeInfo spapr_machine_info = {
>      },
>  };
>  
> +static void spapr_machine_latest_class_options(MachineClass *mc)
> +{
> +    mc->alias = "pseries";
> +    mc->is_default = 1;
> +}
> +
>  #define DEFINE_SPAPR_MACHINE(suffix, verstr, latest)                 \
>      static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \
>                                                      void *data)      \
> @@ -4435,8 +4441,7 @@ static const TypeInfo spapr_machine_info = {
>          MachineClass *mc = MACHINE_CLASS(oc);                        \
>          spapr_machine_##suffix##_class_options(mc);                  \
>          if (latest) {                                                \
> -            mc->alias = "pseries";                                   \
> -            mc->is_default = 1;                                      \
> +            spapr_machine_latest_class_options(mc);                  \
>          }                                                            \
>      }                                                                \
>      static const TypeInfo spapr_machine_##suffix##_info = {          \

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2020-02-08 11:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07  6:46 [PATCH] ppc: function to setup latest class options Michael S. Tsirkin
2020-02-07  6:48 ` Michael S. Tsirkin
2020-02-07  8:39 ` Laurent Vivier
2020-02-07 10:14 ` Greg Kurz
2020-02-07 10:35 ` Philippe Mathieu-Daudé
2020-02-07 11:12   ` Greg Kurz
2020-02-07 14:27     ` Michael S. Tsirkin
2020-02-08 11:12 ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.