[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
signature.asc
Description: PGP signature
- [Qemu-ppc] [RFC 9/9] spapr: Add pseries-2.6 machine type, (continued)
- [Qemu-ppc] [RFC 9/9] spapr: Add pseries-2.6 machine type, David Gibson, 2015/11/30
- [Qemu-ppc] [RFC 7/9] spapr: Remove versions from mc->desc, David Gibson, 2015/11/30
- [Qemu-ppc] [RFC 3/9] spapr: DEFINE_SPAPR_MACHINE, David Gibson, 2015/11/30
- [Qemu-ppc] [RFC 8/9] spapr: Improve setting of default machine version, David Gibson, 2015/11/30
- [Qemu-ppc] [RFC 2/9] spapr: Rearrange versioned machine type code, David Gibson, 2015/11/30
- [Qemu-ppc] [RFC 4/9] Move SET_MACHINE_COMPAT macro to boards.h, David Gibson, 2015/11/30
- Re: [Qemu-ppc] [RFC 0/9] Cleanup pseries machine versioning, David Gibson, 2015/11/30