]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: mobiveil: Switch to msi_create_parent_irq_domain()
authorNam Cao <namcao@linutronix.de>
Thu, 26 Jun 2025 14:47:52 +0000 (16:47 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 24 Jul 2025 21:24:02 +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/af46c15c47a7716f7e0c50d0f7391509c95b49c2.1750858083.git.namcao@linutronix.de
drivers/pci/controller/mobiveil/Kconfig
drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
drivers/pci/controller/mobiveil/pcie-mobiveil.h

index 58ce034f701ab8f2e7c3025e4eb571cdbe60c432..c50c4625937f81b36ebb6a1db0bfd5bf96e094db 100644 (file)
@@ -9,6 +9,7 @@ config PCIE_MOBIVEIL
 config PCIE_MOBIVEIL_HOST
        bool
        depends on PCI_MSI
+       select IRQ_MSI_LIB
        select PCIE_MOBIVEIL
 
 config PCIE_LAYERSCAPE_GEN4
index 98e90fcbeceb503ebb3a1792f8e56d8928a224fc..dbc72c73fd0aa998acdc6aea5b1960dbec35cfb1 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/irqchip/irq-msi-lib.h>
 #include <linux/irqchip/chained_irq.h>
 #include <linux/irqdomain.h>
 #include <linux/kernel.h>
@@ -353,16 +354,19 @@ static const struct irq_domain_ops intx_domain_ops = {
        .map = mobiveil_pcie_intx_map,
 };
 
-static struct irq_chip mobiveil_msi_irq_chip = {
-       .name = "Mobiveil PCIe MSI",
-       .irq_mask = pci_msi_mask_irq,
-       .irq_unmask = pci_msi_unmask_irq,
-};
+#define MOBIVEIL_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS          | \
+                                    MSI_FLAG_USE_DEF_CHIP_OPS          | \
+                                    MSI_FLAG_NO_AFFINITY)
+
+#define MOBIVEIL_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK           | \
+                                     MSI_FLAG_PCI_MSIX)
 
-static struct msi_domain_info mobiveil_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   = &mobiveil_msi_irq_chip,
+static const struct msi_parent_ops mobiveil_msi_parent_ops = {
+       .required_flags         = MOBIVEIL_MSI_FLAGS_REQUIRED,
+       .supported_flags        = MOBIVEIL_MSI_FLAGS_SUPPORTED,
+       .bus_select_token       = DOMAIN_BUS_PCI_MSI,
+       .prefix                 = "Mobiveil-",
+       .init_dev_msi_info      = msi_lib_init_dev_msi_info,
 };
 
 static void mobiveil_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
@@ -435,23 +439,20 @@ static const struct irq_domain_ops msi_domain_ops = {
 static int mobiveil_allocate_msi_domains(struct mobiveil_pcie *pcie)
 {
        struct device *dev = &pcie->pdev->dev;
-       struct fwnode_handle *fwnode = dev_fwnode(dev);
        struct mobiveil_msi *msi = &pcie->rp.msi;
 
        mutex_init(&msi->lock);
-       msi->dev_domain = irq_domain_create_linear(NULL, msi->num_of_vectors,
-                                                  &msi_domain_ops, pcie);
-       if (!msi->dev_domain) {
-               dev_err(dev, "failed to create IRQ domain\n");
-               return -ENOMEM;
-       }
 
-       msi->msi_domain = pci_msi_create_irq_domain(fwnode,
-                                                   &mobiveil_msi_domain_info,
-                                                   msi->dev_domain);
-       if (!msi->msi_domain) {
+       struct irq_domain_info info = {
+               .fwnode         = dev_fwnode(dev),
+               .ops            = &msi_domain_ops,
+               .host_data      = pcie,
+               .size           = msi->num_of_vectors,
+       };
+
+       msi->dev_domain = msi_create_parent_irq_domain(&info, &mobiveil_msi_parent_ops);
+       if (!msi->dev_domain) {
                dev_err(dev, "failed to create MSI domain\n");
-               irq_domain_remove(msi->dev_domain);
                return -ENOMEM;
        }
 
index 662f17f9bf65c18f5e818fe3724e93dd9df08490..7246de6a717685322d7a952e5c0a6cf9e528a09c 100644 (file)
 
 struct mobiveil_msi {                  /* MSI information */
        struct mutex lock;              /* protect bitmap variable */
-       struct irq_domain *msi_domain;
        struct irq_domain *dev_domain;
        phys_addr_t msi_pages_phys;
        int num_of_vectors;