From patchwork Wed Oct 17 22:13:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 192149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A00DE2C0097 for ; Thu, 18 Oct 2012 09:13:25 +1100 (EST) Received: from localhost ([::1]:47784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TObrf-0007qM-7u for incoming@patchwork.ozlabs.org; Wed, 17 Oct 2012 18:13:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TObrY-0007q9-34 for qemu-devel@nongnu.org; Wed, 17 Oct 2012 18:13:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TObrW-0006Ki-Ux for qemu-devel@nongnu.org; Wed, 17 Oct 2012 18:13:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TObrW-0006Kd-Mh for qemu-devel@nongnu.org; Wed, 17 Oct 2012 18:13:14 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9HMDDcB028914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 17 Oct 2012 18:13:13 -0400 Received: from bling.home (ovpn-113-170.phx2.redhat.com [10.3.113.170]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9HMDCJc008135; Wed, 17 Oct 2012 18:13:13 -0400 From: Alex Williamson To: mst@redhat.com Date: Wed, 17 Oct 2012 16:13:12 -0600 Message-ID: <20121017221215.1997.24717.stgit@bling.home> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: jan.kiszka@siemens.com, alex.williamson@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v2] pci: Return PCI_INTX_DISABLED when no bus INTx routing support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Acked-by: Jan Kiszka --- 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); }