Received: from eggs.gnu.org ([2001:4830:134:3::10]:46857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv07F-0004d3-Br for qemu-devel@nongnu.org; Thu, 12 Jun 2014 04:12:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wv07A-0003vR-Fv for qemu-devel@nongnu.org; Thu, 12 Jun 2014 04:12:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv07A-0003vI-74 for qemu-devel@nongnu.org; Thu, 12 Jun 2014 04:12:04 -0400 Message-ID: <1402560721.24256.4.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Thu, 12 Jun 2014 11:12:01 +0300 In-Reply-To: <20140612100224.7cf8ce4c@nial.usersys.redhat.com> References: <1402554144-17545-1-git-send-email-ehabkost@redhat.com> <20140612100224.7cf8ce4c@nial.usersys.redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] pc: Register machine classes directly instead of using QEMUMachine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Eduardo Habkost , "Michael S. Tsirkin" , Alexander Graf , Don Slutz , qemu-devel@nongnu.org, Anthony Liguori , Andreas =?ISO-8859-1?Q?F=E4rber?= On Thu, 2014-06-12 at 10:02 +0200, Igor Mammedov wrote: > On Thu, 12 Jun 2014 03:22:24 -0300 > Eduardo Habkost wrote: > > > This is a (mostly) blind and mechanical conversion of the PC QEMUMachine > > definitions to corresponding class registration code. > > > > Having the PC code converted to pure QOM registration code will help us > > move PC-specific machine state that is currently held in static > > variables inside PC machine objects, and reduce duplication between > > pc_piix.c and pc_q35.c. > > Getting rid of *_machine_options() functions and doing nested > inheritance with necessary overrides in respective *_class_init() > functions, would make code more readable/understandable. While I agree with you that this is the right direction, Eduardo's patch is a good step forward getting rid of QEMUMachine and those defines. I say we implement the hierarchy on top of this patch. > > > > > Signed-off-by: Eduardo Habkost > > --- > > hw/i386/pc.c | 13 ++ > > hw/i386/pc_piix.c | 473 +++++++++++++++++++++++++++++++++++---------------- > > hw/i386/pc_q35.c | 171 +++++++++++++------ > > include/hw/i386/pc.h | 20 ++- > > 4 files changed, 465 insertions(+), 212 deletions(-) > > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > > index 32d1632..56720cd 100644 > > --- a/hw/i386/pc.c > > +++ b/hw/i386/pc.c > > @@ -1456,3 +1456,16 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) > > gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i); > > } > > } > > + > > +static TypeInfo pc_machine_type_info = { > > + .name = TYPE_PC_MACHINE, > > + .parent = TYPE_MACHINE, > > + .abstract = true, > > +}; Igor's series already introduces TYPE_PC_MACHINE, you may want to rebase on it: http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg00133.html Thanks, Marcel