This series is something I've been playing with for a while, and it came up in
again in a conversation with Phil and Alex when discussing modelling of buses
and IRQs for heterogenerous binaries. The basic premise of the series is that
it converts PCI devices IRQs to use a qdev out gpio so that PCI devices can
potentially be wired up using standard qdev APIs.
In its current form the series adds a qdev out gpio to PCIDevice, adds a set of
input IRQs to PCIBus (once for each devfn) and wires them up at the very end of
pci_qdev_realize() once the device has been realised. This allows pci_set_irq()
to be changed into a simple wrapper over qemu_set_irq(), and the resulting
series passes GitLab CI to help prove the basic concept.
Note that this series is only concerned with providing a standard qdev gpio for
the PCI device IRQ, and not with how the PCI bus itself is modelled - that is
a discussion to be left for another day.
Another advantage of using qdev gpios is that it becomes possible to remove the
pci_allocate_irq() function which has long been a source of memory leaks. For
now I've added a new qdev named input gpio "pci-input-irq" which is used as its
replacement.
If everyone is happy that this series is going in the right direction then I'd
be inclined to add the qemu_irq and qdev gpio out to each individual PCI device
rather than using PCIDevice, and replace calls to pci_set_irq() with the
corresponding qemu_set_irq(). This would allow the "pci-input-irq" input gpio
to be dropped completely, and so PCIDevice IRQs can be treated like those of
any other qdev device (but at the cost of making this a larger series).
Thoughts/suggestions/comments?
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Mark Cave-Ayland (18):
hw/pci: add device IRQ to PCIDevice
hw/pci: introduce PCI bus input IRQs
hw/pci: use PCIDevice gpio for device IRQ
hw/pci: introduce PCI device input gpio
hw/char/serial-pci.c: switch SerialState to use PCI device input gpio
hw/ide/ich.c: switch AHCIState to use PCI device input gpio
hw/net/can/can_mioe3680_pci.c: switch Mioe3680PCIState to use PCI
device input gpio
hw/net/can/can_pcm3680_pci.c: switch SerialState to use PCI device
input gpio
hw/net/can/ctucan_pci.c: switch CtuCanPCIState to use PCI device input
gpio
hw/net/ne2000-pci.c: switch NE2000State to use PCI device input gpio
hw/net/pcnet-pci.c: switch PCIPCNetState to use PCI device input gpio
hw/net/tulip.c: switch TULIPState to use PCI device input gpio
hw/scsi/esp-pci.c: switch ESPState to use PCI device input gpio
hw/sd/sdhci-pci.c: switch SDHCIState to use PCI device input gpio
hw/usb/hcd-ehci-pci.c: switch EHCIState to use PCI device input gpio
hw/usb/hcd-ohci-pci.c: switch OHCIState to use PCI device input gpio
hw/usb/hcd-uhci.c: switch UHCIState to use PCI device input gpio
hw/pci/pci.c: remove pci_allocate_irq()
hw/char/serial-pci.c | 3 +-
hw/ide/ich.c | 3 +-
hw/net/can/can_mioe3680_pci.c | 4 +--
hw/net/can/can_pcm3680_pci.c | 4 +--
hw/net/can/ctucan_pci.c | 4 +--
hw/net/ne2000-pci.c | 3 +-
hw/net/pcnet-pci.c | 3 +-
hw/net/tulip.c | 3 +-
hw/pci/pci.c | 65 +++++++++++++++++++++++++++++++----
hw/scsi/esp-pci.c | 11 +-----
hw/sd/sdhci-pci.c | 2 +-
hw/usb/hcd-ehci-pci.c | 3 +-
hw/usb/hcd-ohci-pci.c | 2 +-
hw/usb/hcd-uhci.c | 2 +-
include/hw/pci/pci.h | 1 -
include/hw/pci/pci_bus.h | 3 ++
include/hw/pci/pci_device.h | 3 ++
17 files changed, 78 insertions(+), 41 deletions(-)
--
2.30.2