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: Eduardo Habkost
Subject: Re: [Qemu-ppc] [RFC 8/9] spapr: Improve setting of default machine version
Date: Mon, 30 Nov 2015 13:16:20 -0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Nov 30, 2015 at 07:51:49PM +1100, 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>

Nice. I don't like macros with too long parameter lists (we
already have 4 parameters in DEFINE_{PC,Q35,I440FX}_MACHINE), but
it looks like we can do something similar in PC, to reduce the
alias/is_default churn in pc_*_machine_options().

> ---
>  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);
>  
>  /*
>   * pseries-2.4
> @@ -2355,13 +2357,11 @@ static void 
> spapr_machine_2_4_class_compat(MachineClass *mc)
>      sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
>  
>      spapr_machine_2_5_class_compat(mc);
> -    mc->alias = NULL;
> -    mc->is_default = 0;
>      smc->dr_lmb_enabled = false;
>      SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_4);
>  }
>  
> -DEFINE_SPAPR_MACHINE(2_4, "2.4", NULL);
> +DEFINE_SPAPR_MACHINE(2_4, "2.4", NULL, false);
>  
>  /*
>   * pseries-2.3
> @@ -2386,7 +2386,7 @@ static void spapr_machine_2_3_class_compat(MachineClass 
> *mc)
>      spapr_machine_2_4_class_compat(mc);
>      SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_3);
>  }
> -DEFINE_SPAPR_MACHINE(2_3, "2.3", spapr_machine_2_3_instance_compat);
> +DEFINE_SPAPR_MACHINE(2_3, "2.3", spapr_machine_2_3_instance_compat, false);
>  
>  /*
>   * pseries-2.2
> @@ -2411,7 +2411,7 @@ static void spapr_machine_2_2_class_compat(MachineClass 
> *mc)
>      spapr_machine_2_3_class_compat(mc);
>      SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_2);
>  }
> -DEFINE_SPAPR_MACHINE(2_2, "2.2", spapr_machine_2_2_instance_compat);
> +DEFINE_SPAPR_MACHINE(2_2, "2.2", spapr_machine_2_2_instance_compat, false);
>  
>  /*
>   * pseries-2.1
> @@ -2430,7 +2430,7 @@ static void spapr_machine_2_1_class_compat(MachineClass 
> *mc)
>      spapr_machine_2_2_class_compat(mc);
>      SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_1);
>  }
> -DEFINE_SPAPR_MACHINE(2_1, "2.1", spapr_machine_2_1_instance_compat);
> +DEFINE_SPAPR_MACHINE(2_1, "2.1", spapr_machine_2_1_instance_compat, false);
>  
>  static void spapr_machine_register_types(void)
>  {
> -- 
> 2.5.0
> 

-- 
Eduardo



reply via email to

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