[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: |
Thomas Huth |
Subject: |
Re: [Qemu-ppc] [RFC 8/9] spapr: Improve setting of default machine version |
Date: |
Mon, 30 Nov 2015 18:05:01 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
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?
Thomas
- Re: [Qemu-ppc] [RFC 1/9] pseries: Remove redundant setting of mc->name for pseries-2.5 machine, (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