* [Qemu-devel] [PATCH v2] pci: Return PCI_INTX_DISABLED when no bus INTx routing support
@ 2012-10-17 22:13 Alex Williamson
2012-10-18 6:17 ` Jan Kiszka
2012-10-18 6:31 ` Michael S. Tsirkin
0 siblings, 2 replies; 3+ messages in thread
From: Alex Williamson @ 2012-10-17 22:13 UTC (permalink / raw)
To: mst; +Cc: jan.kiszka, alex.williamson, qemu-devel
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 <alex.williamson@redhat.com>
---
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);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pci: Return PCI_INTX_DISABLED when no bus INTx routing support
2012-10-17 22:13 [Qemu-devel] [PATCH v2] pci: Return PCI_INTX_DISABLED when no bus INTx routing support Alex Williamson
@ 2012-10-18 6:17 ` Jan Kiszka
2012-10-18 6:31 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2012-10-18 6:17 UTC (permalink / raw)
To: Alex Williamson; +Cc: qemu-devel@nongnu.org, mst@redhat.com
On 2012-10-18 00:13, 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 <alex.williamson@redhat.com>
> ---
>
> 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);
> }
>
>
I'm fine with this. I also see this as dead code in x86 (any x86 chipset
will support this API, for sure), but maybe it helps on other archs. So:
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pci: Return PCI_INTX_DISABLED when no bus INTx routing support
2012-10-17 22:13 [Qemu-devel] [PATCH v2] pci: Return PCI_INTX_DISABLED when no bus INTx routing support Alex Williamson
2012-10-18 6:17 ` Jan Kiszka
@ 2012-10-18 6:31 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2012-10-18 6:31 UTC (permalink / raw)
To: Alex Williamson; +Cc: jan.kiszka, qemu-devel
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 <alex.williamson@redhat.com>
> ---
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);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-18 6:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17 22:13 [Qemu-devel] [PATCH v2] pci: Return PCI_INTX_DISABLED when no bus INTx routing support Alex Williamson
2012-10-18 6:17 ` Jan Kiszka
2012-10-18 6:31 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).