From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHWVn-0005v7-Vq for qemu-devel@nongnu.org; Wed, 13 Aug 2014 07:14:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHWVj-00064K-N5 for qemu-devel@nongnu.org; Wed, 13 Aug 2014 07:14:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHWVj-00064D-Fb for qemu-devel@nongnu.org; Wed, 13 Aug 2014 07:14:31 -0400 From: Markus Armbruster References: <1407892991-15752-1-git-send-email-david@gibson.dropbear.id.au> Date: Wed, 13 Aug 2014 13:14:23 +0200 In-Reply-To: <1407892991-15752-1-git-send-email-david@gibson.dropbear.id.au> (David Gibson's message of "Wed, 13 Aug 2014 11:23:11 +1000") Message-ID: <87tx5g3als.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] spapr: Make machine naming conventions closer to those for PC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: aik@ozlabs.ru, agraf@suse.de, qemu-devel@nongnu.org David Gibson writes: > As of qemu-2.1, spapr/pseries, has a set of versioned machine classes to > represent the machine type as it appeared to the guest in different qemu > versions. This allows for safe migration of guests between current and > future qemu versions. > > In PC, however, the default plain "pc" machine type is just an alias for > the most recent versioned machine type. In sPAPR at the moment, it names > the base machine class from which the versioned types are derived. > > The PC approach is preferable; it makes it clearer which explicit version > is the current one. Additionally updating the "current" machine as the > base class makes it even more likely than otherwise to incorrectly alter > the versioned machines' behaviour when updating the current machine. > > Therefore this patch changes sPAPR to the PC approach - the base class > becomes abstract, and plain "pseries" becomes an alias for the most > recent versioned machine class. > > Signed-off-by: David Gibson > --- > hw/ppc/spapr.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index d01978f..2785dbc 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1583,7 +1583,6 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) > > mc->name = "pseries"; > mc->desc = "pSeries Logical Partition (PAPR compliant)"; > - mc->is_default = 1; > mc->init = ppc_spapr_init; > mc->reset = ppc_spapr_reset; > mc->block_default_type = IF_SCSI; I suspect many of these assignments are actually overwritten by the derived machine types' class init function. Without that, mc->name = "pseries" would clash with the mc->alias = "pseries" below, wouldn't i? Care to trim the redundant assignments? > @@ -1598,6 +1597,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) > static const TypeInfo spapr_machine_info = { > .name = TYPE_SPAPR_MACHINE, > .parent = TYPE_MACHINE, > + .abstract = true, > .instance_size = sizeof(sPAPRMachineState), > .instance_init = spapr_machine_initfn, > .class_init = spapr_machine_class_init, > @@ -1613,7 +1613,8 @@ static void spapr_machine_2_1_class_init(ObjectClass *oc, void *data) > > mc->name = "pseries-2.1"; > mc->desc = "pSeries Logical Partition (PAPR compliant) v2.1"; > - mc->is_default = 0; > + mc->alias = "pseries"; > + mc->is_default = 1; > } > > static const TypeInfo spapr_machine_2_1_info = {