Received: from eggs.gnu.org ([140.186.70.92]:41101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rl6P2-0007rM-JZ for qemu-devel@nongnu.org; Wed, 11 Jan 2012 17:12:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rl6Oy-0001Qf-Ev for qemu-devel@nongnu.org; Wed, 11 Jan 2012 17:12:16 -0500 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=iso-8859-1 From: Alexander Graf In-Reply-To: <1325894809-17322-3-git-send-email-andreas.faerber@web.de> Date: Wed, 11 Jan 2012 23:12:09 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <4BFAF924-2CB2-45DB-9DB4-1148B5A741E7@suse.de> References: <1325894809-17322-1-git-send-email-andreas.faerber@web.de> <1325894809-17322-3-git-send-email-andreas.faerber@web.de> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 2/3] prep: Add Raven PCI host SysBus device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Andreas_F=E4rber?= Cc: qemu-ppc@nongnu.org, Anthony Liguori , =?iso-8859-1?Q?Herv=E9_Poussineau?= , qemu-devel@nongnu.org, "Michael S. Tsirkin" On 07.01.2012, at 01:06, Andreas F=E4rber wrote: > For now, focus on qdev'ification and leave PIC IRQs unchanged. >=20 > Signed-off-by: Andreas F=E4rber > Cc: Herv=E9 Poussineau > Cc: Michael S. Tsirkin > Cc: Anthony Liguori > --- > hw/prep_pci.c | 41 +++++++++++++++++++++++++++++++---------- > 1 files changed, 31 insertions(+), 10 deletions(-) >=20 > diff --git a/hw/prep_pci.c b/hw/prep_pci.c > index 741b273..2ff6b8c 100644 > --- a/hw/prep_pci.c > +++ b/hw/prep_pci.c > @@ -114,31 +114,43 @@ PCIBus *pci_prep_init(qemu_irq *pic, > MemoryRegion *address_space_mem, > MemoryRegion *address_space_io) > { I'm not sure this is the best way to do this. For e500, we just create = the host bridge explicitly in the board file: /* PCI */ dev =3D sysbus_create_varargs("e500-pcihost", MPC8544_PCI_REGS_BASE, mpic[pci_irq_nrs[0]], = mpic[pci_irq_nrs[1]], mpic[pci_irq_nrs[2]], = mpic[pci_irq_nrs[3]], NULL); pci_bus =3D (PCIBus *)qdev_get_child_bus(dev, "pci.0"); if (!pci_bus) printf("couldn't create PCI controller!\n"); and that's all the interaction there is between the pci host code and = the board code. No calling into functions. The way you're doing it now, = the board still needs to call into prep_pci.c which doesn't sound too = appealing to me :). > + DeviceState *dev; > PREPPCIState *s; >=20 > - s =3D g_malloc0(sizeof(PREPPCIState)); > - s->bus =3D pci_register_bus(NULL, "pci", > + dev =3D qdev_create(NULL, "raven-pcihost"); > + s =3D FROM_SYSBUS(PREPPCIState, sysbus_from_qdev(dev)); > + s->address_space =3D address_space_mem; > + s->bus =3D pci_register_bus(&s->busdev.qdev, "pci", > prep_set_irq, prep_map_irq, pic, > address_space_mem, > address_space_io, > 0, 4); This should be happening in the host bridge init code. Take a look at = e500_pcihost_initfn() in hw/ppce500_pci.c. Alex