From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOjc4-0002lP-OV for qemu-devel@nongnu.org; Thu, 18 Oct 2012 02:29:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOjc3-0000PH-HI for qemu-devel@nongnu.org; Thu, 18 Oct 2012 02:29:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOjc3-0000PA-92 for qemu-devel@nongnu.org; Thu, 18 Oct 2012 02:29:47 -0400 Date: Thu, 18 Oct 2012 08:31:49 +0200 From: "Michael S. Tsirkin" Message-ID: <20121018063149.GB15676@redhat.com> References: <20121017221215.1997.24717.stgit@bling.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121017221215.1997.24717.stgit@bling.home> Subject: Re: [Qemu-devel] [PATCH v2] pci: Return PCI_INTX_DISABLED when no bus INTx routing support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: jan.kiszka@siemens.com, qemu-devel@nongnu.org On Wed, Oct 17, 2012 at 04:13:12PM -0600, Alex Williamson wrote: > Rather than assert, simply return PCI_INTX_DISABLED when we don't > have a pci_route_irq_fn. PIIX already returns DISABLED for an > invalid pin, so users already deal with this state. Users of this > interface should only be acting on an ENABLED or INVERTED return > value (though we really have no support for INVERTED). Also > complain loudly when we hit this so we don't forget it's missing. > > Signed-off-by: Alex Williamson > --- Thanks, applied. > v2: Turn up the annoyance factor for hitting this > > hw/pci.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/hw/pci.c b/hw/pci.c > index 83d262a..6a66b32 100644 > --- a/hw/pci.c > +++ b/hw/pci.c > @@ -1094,7 +1094,13 @@ PCIINTxRoute pci_device_route_intx_to_irq(PCIDevice *dev, int pin) > pin = bus->map_irq(dev, pin); > dev = bus->parent_dev; > } while (dev); > - assert(bus->route_intx_to_irq); > + > + if (!bus->route_intx_to_irq) { > + error_report("PCI: Bug - unimplemented PCI INTx routing (%s)\n", > + object_get_typename(OBJECT(bus->qbus.parent))); > + return (PCIINTxRoute) { PCI_INTX_DISABLED, -1 }; > + } > + > return bus->route_intx_to_irq(bus->irq_opaque, pin); > } >