]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: xilinx-nwl: Switch to msi_create_parent_irq_domain()
authorNam Cao <namcao@linutronix.de>
Thu, 26 Jun 2025 14:48:01 +0000 (16:48 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 24 Jul 2025 21:24:16 +0000 (16:24 -0500)
Switch to msi_create_parent_irq_domain() from pci_msi_create_irq_domain()
which was using legacy MSI domain setup.

Signed-off-by: Nam Cao <namcao@linutronix.de>
[mani: reworded commit message]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
[bhelgaas: rebase on dev_fwnode() conversion, drop fwnode local var]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/5ac6e216bf2eaa438c8854baf2ff3e5cf0b2284f.1750858083.git.namcao@linutronix.de
drivers/pci/controller/Kconfig
drivers/pci/controller/pcie-xilinx-nwl.c

index c9b6180239732d772cf22b0fad041d05efd06eed..118ff622fa69e50c5ed1e9f0c466eaf3b5f32ad1 100644 (file)
@@ -342,6 +342,7 @@ config PCIE_XILINX_NWL
        bool "Xilinx NWL PCIe controller"
        depends on ARCH_ZYNQMP || COMPILE_TEST
        depends on PCI_MSI
+       select IRQ_MSI_LIB
        help
         Say 'Y' here if you want kernel support for Xilinx
         NWL PCIe controller. The controller can act as Root Port
index eda87e91743063ce059c624e655da6fd76a879c0..05b8c205493cd88f66cc10b6450ac25ef8f6b09c 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/irqchip/irq-msi-lib.h>
 #include <linux/irqdomain.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #define LINK_WAIT_USLEEP_MAX           100000
 
 struct nwl_msi {                       /* MSI information */
-       struct irq_domain *msi_domain;
        DECLARE_BITMAP(bitmap, INT_PCI_MSI_NR);
        struct irq_domain *dev_domain;
        struct mutex lock;              /* protect bitmap variable */
@@ -418,19 +418,22 @@ static const struct irq_domain_ops intx_domain_ops = {
 };
 
 #ifdef CONFIG_PCI_MSI
-static struct irq_chip nwl_msi_irq_chip = {
-       .name = "nwl_pcie:msi",
-       .irq_enable = pci_msi_unmask_irq,
-       .irq_disable = pci_msi_mask_irq,
-       .irq_mask = pci_msi_mask_irq,
-       .irq_unmask = pci_msi_unmask_irq,
-};
 
-static struct msi_domain_info nwl_msi_domain_info = {
-       .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-                MSI_FLAG_NO_AFFINITY | MSI_FLAG_MULTI_PCI_MSI,
-       .chip = &nwl_msi_irq_chip,
+#define NWL_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS       | \
+                               MSI_FLAG_USE_DEF_CHIP_OPS       | \
+                               MSI_FLAG_NO_AFFINITY)
+
+#define NWL_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK                | \
+                                MSI_FLAG_MULTI_PCI_MSI)
+
+static const struct msi_parent_ops nwl_msi_parent_ops = {
+       .required_flags         = NWL_MSI_FLAGS_REQUIRED,
+       .supported_flags        = NWL_MSI_FLAGS_SUPPORTED,
+       .bus_select_token       = DOMAIN_BUS_PCI_MSI,
+       .prefix                 = "nwl-",
+       .init_dev_msi_info      = msi_lib_init_dev_msi_info,
 };
+
 #endif
 
 static void nwl_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
@@ -495,22 +498,19 @@ static int nwl_pcie_init_msi_irq_domain(struct nwl_pcie *pcie)
 {
 #ifdef CONFIG_PCI_MSI
        struct device *dev = pcie->dev;
-       struct fwnode_handle *fwnode = dev_fwnode(dev);
        struct nwl_msi *msi = &pcie->msi;
-
-       msi->dev_domain = irq_domain_create_linear(NULL, INT_PCI_MSI_NR, &dev_msi_domain_ops, pcie);
+       struct irq_domain_info info = {
+               .fwnode         = dev_fwnode(dev),
+               .ops            = &dev_msi_domain_ops,
+               .host_data      = pcie,
+               .size           = INT_PCI_MSI_NR,
+       };
+
+       msi->dev_domain  = msi_create_parent_irq_domain(&info, &nwl_msi_parent_ops);
        if (!msi->dev_domain) {
                dev_err(dev, "failed to create dev IRQ domain\n");
                return -ENOMEM;
        }
-       msi->msi_domain = pci_msi_create_irq_domain(fwnode,
-                                                   &nwl_msi_domain_info,
-                                                   msi->dev_domain);
-       if (!msi->msi_domain) {
-               dev_err(dev, "failed to create msi IRQ domain\n");
-               irq_domain_remove(msi->dev_domain);
-               return -ENOMEM;
-       }
 #endif
        return 0;
 }