qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [RFC 8/9] spapr: Improve setting of default machine versi


From: David Gibson
Subject: Re: [Qemu-ppc] [RFC 8/9] spapr: Improve setting of default machine version
Date: Tue, 1 Dec 2015 11:31:31 +1100
User-agent: Mutt/1.5.24 (2015-08-30)

On Mon, Nov 30, 2015 at 06:05:01PM +0100, Thomas Huth wrote:
> On 30/11/15 09:51, David Gibson wrote:
> > This tweaks the way the default machine version is controlled, so that
> > there will be a bit less churn when each new version is introduced.
> > 
> > Signed-off-by: David Gibson <address@hidden>
> > ---
> >  hw/ppc/spapr.c | 20 ++++++++++----------
> >  1 file changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index 1a4fe30..3d31fe7 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -2301,12 +2301,16 @@ static const TypeInfo spapr_machine_info = {
> >      },
> >  };
> >  
> > -#define DEFINE_SPAPR_MACHINE(suffix, verstr, instance_compat)        \
> > +#define DEFINE_SPAPR_MACHINE(suffix, verstr, instance_compat, dflt)  \
> >      static void spapr_machine_##suffix##_class_init(ObjectClass *oc, \
> >                                                      void *data)      \
> >      {                                                                \
> >          MachineClass *mc = MACHINE_CLASS(oc);                        \
> >          spapr_machine_##suffix##_class_compat(mc);                   \
> > +        if (dflt) {                                               \
> > +            mc->alias = "pseries";                                   \
> > +            mc->is_default = 1;                                      \
> > +        }                                                            \
> >      }                                                                \
> >      static void spapr_machine_##suffix##_instance_init(Object *obj)  \
> >      {                                                                \
> > @@ -2338,11 +2342,9 @@ static void 
> > spapr_machine_2_5_class_compat(MachineClass *mc)
> >  
> >      smc->dr_lmb_enabled = true;
> >      mc->desc = "pSeries Logical Partition (PAPR compliant)";
> > -    mc->alias = "pseries";
> > -    mc->is_default = 1;
> >  }
> >  
> > -DEFINE_SPAPR_MACHINE(2_5, "2.5", NULL);
> > +DEFINE_SPAPR_MACHINE(2_5, "2.5", NULL, true);
> 
> Good idea ... but I wonder whether we could even do it without the
> additional macro parameter? For example, we could
>  #define SPAPR_DEFAULT_VERSTR "2.5"
> and then in the macro, use a
>  if (!strcmp(verstr, SPAPR_DEFAULT_VERSTR))
> instead of the "if (dflt)".
> ... or is this too much macro magic with side effects already?

I can't decide if I like the idea or if it's a bit to much macro
magic.  I think I'll leave it as is for now.

-- 
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: signature.asc
Description: PGP signature


reply via email to

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