[V2,12/40] irqchip/gic-msi-lib: Prepare for PCI MSI/MSIX

Message ID 20221121140049.038269899@linutronix.de
State New
Headers
Series genirq, irqchip: Convert ARM MSI handling to per device MSI domains |

Commit Message

Thomas Gleixner Nov. 21, 2022, 2:39 p.m. UTC
  Add the bus tokens for DOMAIN_BUS_PCI_DEVICE_MSI and
DOMAIN_BUS_PCI_DEVICE_MSIX to the common child init
function and enable the parent mask/unmask static key
in the PCI/MSI core.

Provide the match mask which can be used by parent domain
implementation so the bitmask based child bus token match
works.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/irqchip/irq-gic-msi-lib.c |    7 +++++++
 drivers/irqchip/irq-gic-msi-lib.h |    6 ++++++
 2 files changed, 13 insertions(+)
  

Patch

--- a/drivers/irqchip/irq-gic-msi-lib.c
+++ b/drivers/irqchip/irq-gic-msi-lib.c
@@ -48,6 +48,13 @@  bool gic_msi_lib_init_dev_msi_info(struc
 
 	/* Is the target domain bus token supported ? */
 	switch(info->bus_token) {
+	case DOMAIN_BUS_PCI_DEVICE_MSI:
+	case DOMAIN_BUS_PCI_DEVICE_MSIX:
+		if (WARN_ON_ONCE(!IS_ENABLED(CONFIG_PCI_MSI)))
+			return false;
+
+		pci_device_msi_mask_unmask_parent_enable();
+		break;
 	default:
 		/*
 		 * This should never be reached. See
--- a/drivers/irqchip/irq-gic-msi-lib.h
+++ b/drivers/irqchip/irq-gic-msi-lib.h
@@ -9,6 +9,12 @@ 
 #include <linux/irqdomain.h>
 #include <linux/msi.h>
 
+#ifdef CONFIG_PCI_MSI
+#define MATCH_PCI_MSI		BIT(DOMAIN_BUS_PCI_MSI)
+#else
+#define MATCH_PCI_MSI		(0)
+#endif
+
 int gic_msi_lib_irq_domain_select(struct irq_domain *d, struct irq_fwspec *fwspec,
 				  enum irq_domain_bus_token bus_token);