Received: from eggs.gnu.org ([2001:4830:134:3::10]:45621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyOTj-0008Fj-7W for qemu-devel@nongnu.org; Mon, 16 Nov 2015 13:26:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyOTf-0000Zn-8q for qemu-devel@nongnu.org; Mon, 16 Nov 2015 13:26:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyOTf-0000Zd-3k for qemu-devel@nongnu.org; Mon, 16 Nov 2015 13:26:07 -0500 Date: Mon, 16 Nov 2015 16:26:03 -0200 From: Eduardo Habkost Message-ID: <20151116182603.GA4180@thinpad.lan.raisama.net> References: <1447601946-31248-1-git-send-email-marcel@redhat.com> <1447601946-31248-4-git-send-email-marcel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447601946-31248-4-git-send-email-marcel@redhat.com> Subject: Re: [Qemu-devel] [PATCH V2 3/4] hw/pc: query both q35 and i440fx bus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: mst@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com, pbonzini@redhat.com, imammedo@redhat.com, rth@twiddle.net On Sun, Nov 15, 2015 at 05:39:05PM +0200, Marcel Apfelbaum wrote: > Look for pxb devices on both i386 machines. > > Signed-off-by: Marcel Apfelbaum [...] > diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c > index c81507d..2fbbcd3 100644 > --- a/hw/pci-host/q35.c > +++ b/hw/pci-host/q35.c > @@ -511,6 +511,14 @@ static void mch_realize(PCIDevice *d, Error **errp) > } > } > > +PCIBus *find_q35(void) > +{ > + PCIHostState *s = OBJECT_CHECK(PCIHostState, > + object_resolve_path("/machine/q35", NULL), > + TYPE_PCI_HOST_BRIDGE); Why not use the PCI_HOST_BRIDGE macro? > + return s ? s->bus : NULL; > +} > + > uint64_t mch_mcfg_base(void) > { > bool ambiguous; > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index 4bbc0ff..95d7610 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -242,6 +242,15 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type, > MemoryRegion *ram_memory); > > PCIBus *find_i440fx(void); > +PCIBus *find_q35(void); > + > +static inline PCIBus *find_pc(void) > +{ > + PCIBus *bus = find_i440fx(); > + > + return bus ? bus : find_q35(); Have you considered a /machine/pci link, or (in case you don't want to add something new to the QOM tree) a simple PCMachineState::pci_bus struct field? -- Eduardo