From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2FkK-0001aK-7b for qemu-devel@nongnu.org; Fri, 27 Nov 2015 04:55:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2FkF-0004Yg-7D for qemu-devel@nongnu.org; Fri, 27 Nov 2015 04:55:16 -0500 References: <1448616740-27332-1-git-send-email-thuth@redhat.com> <1448616740-27332-2-git-send-email-thuth@redhat.com> From: Alexander Graf Message-ID: <5658287A.1040209@suse.de> Date: Fri, 27 Nov 2015 10:55:06 +0100 MIME-Version: 1.0 In-Reply-To: <1448616740-27332-2-git-send-email-thuth@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] hw/ppc/spapr: Create pseries-2.6 machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , qemu-ppc@nongnu.org, David Gibson Cc: Alexey Kardashevskiy , qemu-devel@nongnu.org, Nikunj A Dadhania On 27.11.15 10:32, Thomas Huth wrote: > Add a new pseries-2.6 machine class version to make sure we can > keep the old types compatible to previous versions of QEMU in > later patches. > > Signed-off-by: Thomas Huth > --- > hw/ppc/spapr.c | 21 +++++++++++++++++++-- > 1 file changed, 19 insertions(+), 2 deletions(-) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 6bfb908..10b7c35 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2439,8 +2439,6 @@ static void spapr_machine_2_5_class_init(ObjectClass *oc, void *data) > > mc->name = "pseries-2.5"; > mc->desc = "pSeries Logical Partition (PAPR compliant) v2.5"; > - mc->alias = "pseries"; > - mc->is_default = 1; > smc->dr_lmb_enabled = true; > } > > @@ -2450,6 +2448,24 @@ static const TypeInfo spapr_machine_2_5_info = { > .class_init = spapr_machine_2_5_class_init, > }; > > +static void spapr_machine_2_6_class_init(ObjectClass *oc, void *data) > +{ > + MachineClass *mc = MACHINE_CLASS(oc); > + sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(oc); > + > + mc->name = "pseries-2.6"; > + mc->desc = "pSeries Logical Partition (PAPR compliant) v2.6"; > + mc->alias = "pseries"; > + mc->is_default = 1; > + smc->dr_lmb_enabled = true; We should probably start to follow a scheme similar to x86 where the new machine initialization calls its predecessor (2.5 in this case) to ensure we don't forget feature flags and quirks. So you can either directly call spapr_machine_2_5_class_init() from spapr_machine_2_6_class_init() or extract the quirk part (dr_lmb_enabled) into a function that gets marked as "from 2.5 on" in its function name and call it from 2_5_class_init and from a "from 2.6 on" function that gets called from 2_6_class_init. Alex