]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: plda: Switch to msi_create_parent_irq_domain()
authorNam Cao <namcao@linutronix.de>
Thu, 26 Jun 2025 14:48:03 +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/1279fe6500a1d8135d8f5feb2f055df008746c88.1750858083.git.namcao@linutronix.de
drivers/pci/controller/plda/Kconfig
drivers/pci/controller/plda/pcie-plda-host.c
drivers/pci/controller/plda/pcie-plda.h

index c0e14146d7e45e34533583fd025dffce8ed5d567..62120101139cbeafbfe2061949bcec7e32d46db2 100644 (file)
@@ -5,6 +5,7 @@ menu "PLDA-based PCIe controllers"
 
 config PCIE_PLDA_HOST
        bool
+       select IRQ_MSI_LIB
 
 config PCIE_MICROCHIP_HOST
        tristate "Microchip AXI PCIe controller"
index fdf9ec110e7a73f1d040fd6761f84caadda20861..8e2db2e5b64b96af138454a213f33c588a3b1368 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/align.h>
 #include <linux/bitfield.h>
 #include <linux/irqchip/chained_irq.h>
+#include <linux/irqchip/irq-msi-lib.h>
 #include <linux/irqdomain.h>
 #include <linux/msi.h>
 #include <linux/pci_regs.h>
@@ -134,42 +135,41 @@ static const struct irq_domain_ops msi_domain_ops = {
        .free   = plda_irq_msi_domain_free,
 };
 
-static struct irq_chip plda_msi_irq_chip = {
-       .name = "PLDA PCIe MSI",
-       .irq_ack = irq_chip_ack_parent,
-       .irq_mask = pci_msi_mask_irq,
-       .irq_unmask = pci_msi_unmask_irq,
-};
-
-static struct msi_domain_info plda_msi_domain_info = {
-       .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-                MSI_FLAG_NO_AFFINITY | MSI_FLAG_PCI_MSIX,
-       .chip = &plda_msi_irq_chip,
+#define PLDA_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS      | \
+                                MSI_FLAG_USE_DEF_CHIP_OPS      | \
+                                MSI_FLAG_NO_AFFINITY)
+#define PLDA_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK       | \
+                                 MSI_FLAG_PCI_MSIX)
+
+static const struct msi_parent_ops plda_msi_parent_ops = {
+       .required_flags         = PLDA_MSI_FLAGS_REQUIRED,
+       .supported_flags        = PLDA_MSI_FLAGS_SUPPORTED,
+       .chip_flags             = MSI_CHIP_FLAG_SET_ACK,
+       .bus_select_token       = DOMAIN_BUS_PCI_MSI,
+       .prefix                 = "PLDA-",
+       .init_dev_msi_info      = msi_lib_init_dev_msi_info,
 };
 
 static int plda_allocate_msi_domains(struct plda_pcie_rp *port)
 {
        struct device *dev = port->dev;
-       struct fwnode_handle *fwnode = dev_fwnode(dev);
        struct plda_msi *msi = &port->msi;
 
        mutex_init(&port->msi.lock);
 
-       msi->dev_domain = irq_domain_create_linear(NULL, msi->num_vectors, &msi_domain_ops, port);
+       struct irq_domain_info info = {
+               .fwnode         = dev_fwnode(dev),
+               .ops            = &msi_domain_ops,
+               .host_data      = port,
+               .size           = msi->num_vectors,
+       };
+
+       msi->dev_domain = msi_create_parent_irq_domain(&info, &plda_msi_parent_ops);
        if (!msi->dev_domain) {
                dev_err(dev, "failed to create IRQ domain\n");
                return -ENOMEM;
        }
 
-       msi->msi_domain = pci_msi_create_irq_domain(fwnode,
-                                                   &plda_msi_domain_info,
-                                                   msi->dev_domain);
-       if (!msi->msi_domain) {
-               dev_err(dev, "failed to create MSI domain\n");
-               irq_domain_remove(msi->dev_domain);
-               return -ENOMEM;
-       }
-
        return 0;
 }
 
@@ -563,7 +563,6 @@ static void plda_pcie_irq_domain_deinit(struct plda_pcie_rp *pcie)
        irq_set_chained_handler_and_data(pcie->msi_irq, NULL, NULL);
        irq_set_chained_handler_and_data(pcie->intx_irq, NULL, NULL);
 
-       irq_domain_remove(pcie->msi.msi_domain);
        irq_domain_remove(pcie->msi.dev_domain);
 
        irq_domain_remove(pcie->intx_domain);
index 61ece26065ea09b9cc4985b2a0e1ac632a47ca96..6b8665df7bf0f66fe5bd5a6e0746633b48cbdf66 100644 (file)
@@ -164,7 +164,6 @@ struct plda_pcie_host_ops {
 
 struct plda_msi {
        struct mutex lock;              /* Protect used bitmap */
-       struct irq_domain *msi_domain;
        struct irq_domain *dev_domain;
        u32 num_vectors;
        u64 vector_phy;