[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 04/18] hw/pci: introduce PCI device input gpio
|
From: |
Mark Cave-Ayland |
|
Subject: |
[RFC PATCH 04/18] hw/pci: introduce PCI device input gpio |
|
Date: |
Thu, 11 May 2023 09:57:17 +0100 |
This is to allow other devices to drive the PCI device IRQ if required.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/pci/pci.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 3da1481eb5..0dd3b24b62 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1683,6 +1683,13 @@ void pci_set_irq(PCIDevice *pci_dev, int level)
qemu_set_irq(pci_dev->irq, level);
}
+static void pci_device_input_irq_handler(void *opaque, int n, int level)
+{
+ PCIDevice *pci_dev = PCI_DEVICE(opaque);
+
+ pci_set_irq(pci_dev, level);
+}
+
/* Special hooks used by device assignment */
void pci_bus_set_route_irq_fn(PCIBus *bus, pci_route_irq_fn route_intx_to_irq)
{
@@ -2203,6 +2210,8 @@ static void pci_device_init(Object *obj)
PCIDevice *pci_dev = PCI_DEVICE(obj);
qdev_init_gpio_out(DEVICE(obj), &pci_dev->irq, 1);
+ qdev_init_gpio_in_named(DEVICE(obj), pci_device_input_irq_handler,
+ "pci-input-irq", 1);
}
PCIDevice *pci_new_multifunction(int devfn, bool multifunction,
@@ -2856,6 +2865,8 @@ void pci_set_power(PCIDevice *d, bool state)
/*
* QEMU interface:
* + Unnamed GPIO output: set to 1 if the PCI Device has asserted its irq
+ * + Named GPIO input "pci-input-irq": set to 1 if a downstream device
+ * wishes to assert the PCI Device irq directly itself (optional)
*/
static const TypeInfo pci_device_type_info = {
--
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