qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/18] PCI: convert IRQs to use qdev gpios
@ 2023-05-11  8:57 Mark Cave-Ayland
  2023-05-11  8:57 ` [RFC PATCH 01/18] hw/pci: add device IRQ to PCIDevice Mark Cave-Ayland
                   ` (17 more replies)
  0 siblings, 18 replies; 23+ messages in thread
From: Mark Cave-Ayland @ 2023-05-11  8:57 UTC (permalink / raw)
  To: mst, marcel.apfelbaum, philmd, alex.bennee, qemu-devel

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



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-05-12  8:59 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11  8:57 [RFC PATCH 00/18] PCI: convert IRQs to use qdev gpios Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 01/18] hw/pci: add device IRQ to PCIDevice Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 02/18] hw/pci: introduce PCI bus input IRQs Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 03/18] hw/pci: use PCIDevice gpio for device IRQ Mark Cave-Ayland
2023-05-11 21:44   ` Bernhard Beschow
2023-05-12  5:51     ` Michael S. Tsirkin
2023-05-12  8:58       ` Mark Cave-Ayland
2023-05-12  8:15     ` Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 04/18] hw/pci: introduce PCI device input gpio Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 05/18] hw/char/serial-pci.c: switch SerialState to use " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 06/18] hw/ide/ich.c: switch AHCIState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 07/18] hw/net/can/can_mioe3680_pci.c: switch Mioe3680PCIState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 08/18] hw/net/can/can_pcm3680_pci.c: switch SerialState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 09/18] hw/net/can/ctucan_pci.c: switch CtuCanPCIState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 10/18] hw/net/ne2000-pci.c: switch NE2000State " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 11/18] hw/net/pcnet-pci.c: switch PCIPCNetState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 12/18] hw/net/tulip.c: switch TULIPState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 13/18] hw/scsi/esp-pci.c: switch ESPState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 14/18] hw/sd/sdhci-pci.c: switch SDHCIState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 15/18] hw/usb/hcd-ehci-pci.c: switch EHCIState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 16/18] hw/usb/hcd-ohci-pci.c: switch OHCIState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 17/18] hw/usb/hcd-uhci.c: switch UHCIState " Mark Cave-Ayland
2023-05-11  8:57 ` [RFC PATCH 18/18] hw/pci/pci.c: remove pci_allocate_irq() Mark Cave-Ayland

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).