[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 03/18] hw/pci: use PCIDevice gpio for device IRQ
|
From: |
Mark Cave-Ayland |
|
Subject: |
[RFC PATCH 03/18] hw/pci: use PCIDevice gpio for device IRQ |
|
Date: |
Thu, 11 May 2023 09:57:16 +0100 |
Change pci_set_irq() to call qemu_set_irq() on the PCI device IRQ rather than
calling PCI bus IRQ handler function directly. In order to preserve the
existing behaviour update pci_qdev_realize() so that it automatically connects
the PCI device IRQ to the PCI bus IRQ handler.
Finally add a "QEMU interface" description documenting the new PCI device IRQ
gpio next to the declaration of TYPE_PCI_DEVICE.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/pci/pci.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 9471f996a7..3da1481eb5 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1680,8 +1680,7 @@ qemu_irq pci_allocate_irq(PCIDevice *pci_dev)
void pci_set_irq(PCIDevice *pci_dev, int level)
{
- int intx = pci_intx(pci_dev);
- pci_irq_handler(pci_dev, intx, level);
+ qemu_set_irq(pci_dev->irq, level);
}
/* Special hooks used by device assignment */
@@ -2193,6 +2192,10 @@ static void pci_qdev_realize(DeviceState *qdev, Error
**errp)
pci_set_power(pci_dev, true);
pci_dev->msi_trigger = pci_msi_trigger;
+
+ /* Connect device IRQ to bus */
+ qdev_connect_gpio_out(DEVICE(pci_dev), 0,
+ pci_get_bus(pci_dev)->irq_in[pci_dev->devfn]);
}
static void pci_device_init(Object *obj)
@@ -2850,6 +2853,11 @@ void pci_set_power(PCIDevice *d, bool state)
}
}
+/*
+ * QEMU interface:
+ * + Unnamed GPIO output: set to 1 if the PCI Device has asserted its irq
+ */
+
static const TypeInfo pci_device_type_info = {
.name = TYPE_PCI_DEVICE,
.parent = TYPE_DEVICE,
--
2.30.2
- [RFC PATCH 00/18] PCI: convert IRQs to use qdev gpios, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 02/18] hw/pci: introduce PCI bus input IRQs, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 05/18] hw/char/serial-pci.c: switch SerialState to use PCI device input gpio, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 06/18] hw/ide/ich.c: switch AHCIState to use PCI device input gpio, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 07/18] hw/net/can/can_mioe3680_pci.c: switch Mioe3680PCIState to use PCI device input gpio, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 08/18] hw/net/can/can_pcm3680_pci.c: switch SerialState to use PCI device input gpio, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 09/18] hw/net/can/ctucan_pci.c: switch CtuCanPCIState to use PCI device input gpio, Mark Cave-Ayland, 2023/05/11