Received: from eggs.gnu.org ([2001:4830:134:3::10]:33369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtxLv-0006WD-Dd for qemu-devel@nongnu.org; Fri, 20 Dec 2013 05:30:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtxLn-0005Iv-Uu for qemu-devel@nongnu.org; Fri, 20 Dec 2013 05:30:43 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) From: Alexander Graf In-Reply-To: <1387532550-13422-3-git-send-email-Bharat.Bhushan@freescale.com> Date: Fri, 20 Dec 2013 11:31:17 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <81D4DD8D-BDF3-40C6-A90D-F86B5DABDB92@suse.de> References: <1387532550-13422-1-git-send-email-Bharat.Bhushan@freescale.com> <1387532550-13422-3-git-send-email-Bharat.Bhushan@freescale.com> Subject: Re: [Qemu-devel] [PATCH 2/2] ppc-e500: implement PCI INTx routing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharat Bhushan Cc: Scott Wood , Bharat Bhushan , qemu-ppc , QEMU Developers , "Michael S. Tsirkin" On 20.12.2013, at 10:42, Bharat Bhushan wrote: > This patch adds pci pin to irq_num routing callback. > This callback is called from pci_device_route_intx_to_irq to find = which pci device > maps to which irq. This is used for pci-device passthrough using vfio. >=20 > Also without this patch we gets below warning >=20 > " > PCI: Bug - unimplemented PCI INTx routing (e500-pcihost) > qemu-system-ppc64: PCI: Bug - unimplemented PCI INTx routing = (e500-pcihost) > " > and Legacy interrupt does not work with pci device passthrough. >=20 > Signed-off-by: Bharat Bhushan > Acked-by: Michael S. Tsirkin > --- > hw/pci-host/ppce500.c | 20 ++++++++++++++++++-- > 1 files changed, 18 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c > index 71e5ca9..ffea782 100644 > --- a/hw/pci-host/ppce500.c > +++ b/hw/pci-host/ppce500.c > @@ -88,6 +88,7 @@ struct PPCE500PCIState { > struct pci_inbound pib[PPCE500_PCI_NR_PIBS]; > uint32_t gasket_time; > qemu_irq irq[PCI_NUM_PINS]; > + uint32_t irq_num[PCI_NUM_PINS]; > uint32_t first_slot; > /* mmio maps */ > MemoryRegion container; > @@ -267,13 +268,26 @@ static int mpc85xx_pci_map_irq(PCIDevice = *pci_dev, int pin) >=20 > static void mpc85xx_pci_set_irq(void *opaque, int pin, int level) > { > - qemu_irq *irq =3D opaque; > + PPCE500PCIState *s =3D opaque; > + qemu_irq *pic =3D s->irq; >=20 > pci_debug("%s: PCI irq %d, level:%d\n", __func__, pin , level); >=20 > qemu_set_irq(irq[pin], level); > } >=20 > +static PCIINTxRoute e500_route_intx_pin_to_irq(void *opaque, int pin) > +{ > + PCIINTxRoute route; > + PPCE500PCIState *s =3D opaque; > + > + route.mode =3D PCI_INTX_ENABLED; > + route.irq =3D s->irq_num[pin]; > + > + pci_debug("%s: PCI irq-pin =3D %d, irq_num=3D %d\n", __func__, = pin, route.irq); > + return route; > +} > + > static const VMStateDescription vmstate_pci_outbound =3D { > .name =3D "pci_outbound", > .version_id =3D 0, > @@ -350,12 +364,13 @@ static int e500_pcihost_initfn(SysBusDevice = *dev) >=20 > for (i =3D 0; i < ARRAY_SIZE(s->irq); i++) { > sysbus_init_irq(dev, &s->irq[i]); > + s->irq_num[i] =3D i + 1; I still don't like how you duplicate the logic which MPIC irq line is = associated with which pci host controller irq line. Please pass this = information into the pcihost object somehow from ppce500_init() so that = it's only at a single spot. If you like, you can just use qom/qdev properties for that, but it needs = to be configured from the outside. Alex