qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ppc: function to setup latest class options


From: Greg Kurz
Subject: Re: [PATCH] ppc: function to setup latest class options
Date: Fri, 7 Feb 2020 12:12:09 +0100

On Fri, 7 Feb 2020 11:35:47 +0100
Philippe Mathieu-Daudé <address@hidden> 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 <address@hidden>
> > ---
> >   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 = {          \
> > 
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]