From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv0Ec-00081H-I1 for qemu-devel@nongnu.org; Thu, 12 Jun 2014 04:19:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wv0EX-0006q4-N8 for qemu-devel@nongnu.org; Thu, 12 Jun 2014 04:19:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv0EX-0006po-EM for qemu-devel@nongnu.org; Thu, 12 Jun 2014 04:19:41 -0400 Date: Thu, 12 Jun 2014 11:20:05 +0300 From: "Michael S. Tsirkin" Message-ID: <20140612082005.GB19816@redhat.com> References: <1402554144-17545-1-git-send-email-ehabkost@redhat.com> <20140612100224.7cf8ce4c@nial.usersys.redhat.com> <1402560721.24256.4.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1402560721.24256.4.camel@localhost.localdomain> 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: Marcel Apfelbaum Cc: Eduardo Habkost , Alexander Graf , Don Slutz , qemu-devel@nongnu.org, Anthony Liguori , Igor Mammedov , Andreas =?iso-8859-1?Q?F=E4rber?= On Thu, Jun 12, 2014 at 11:12:01AM +0300, Marcel Apfelbaum wrote: > 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. If we add code as an intermediate step that's fine, but I'd like to see the whole thing before applying. There should be net reduction in amount of boilerplate code at the end of the day. > > > > > > > > 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 >