Skip to content

Commit d08c7e5

Browse files
covanambjorn-helgaas
authored andcommitted
PCI: xilinx-xdma: Switch to msi_create_parent_irq_domain()
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] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://patch.msgid.link/b4620dc1808f217a69d0ae50700ffa12ffd657eb.1750858083.git.namcao@linutronix.de
1 parent dd26c1a commit d08c7e5

2 files changed

Lines changed: 22 additions & 28 deletions

File tree

drivers/pci/controller/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ config PCIE_XILINX_DMA_PL
331331
depends on ARCH_ZYNQMP || COMPILE_TEST
332332
depends on PCI_MSI
333333
select PCI_HOST_COMMON
334+
select IRQ_MSI_LIB
334335
help
335336
Say 'Y' here if you want kernel support for the Xilinx PL DMA
336337
PCIe host bridge. The controller is a Soft IP which can act as

drivers/pci/controller/pcie-xilinx-dma-pl.c

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/bitfield.h>
88
#include <linux/interrupt.h>
99
#include <linux/irq.h>
10+
#include <linux/irqchip/irq-msi-lib.h>
1011
#include <linux/irqdomain.h>
1112
#include <linux/kernel.h>
1213
#include <linux/module.h>
@@ -90,7 +91,6 @@ struct xilinx_pl_dma_variant {
9091
};
9192

9293
struct xilinx_msi {
93-
struct irq_domain *msi_domain;
9494
unsigned long *bitmap;
9595
struct irq_domain *dev_domain;
9696
struct mutex lock; /* Protect bitmap variable */
@@ -373,20 +373,20 @@ static irqreturn_t xilinx_pl_dma_pcie_intr_handler(int irq, void *dev_id)
373373
return IRQ_HANDLED;
374374
}
375375

376-
static struct irq_chip xilinx_msi_irq_chip = {
377-
.name = "pl_dma:PCIe MSI",
378-
.irq_enable = pci_msi_unmask_irq,
379-
.irq_disable = pci_msi_mask_irq,
380-
.irq_mask = pci_msi_mask_irq,
381-
.irq_unmask = pci_msi_unmask_irq,
382-
};
376+
#define XILINX_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
377+
MSI_FLAG_USE_DEF_CHIP_OPS | \
378+
MSI_FLAG_NO_AFFINITY)
383379

384-
static struct msi_domain_info xilinx_msi_domain_info = {
385-
.flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
386-
MSI_FLAG_NO_AFFINITY | MSI_FLAG_MULTI_PCI_MSI,
387-
.chip = &xilinx_msi_irq_chip,
388-
};
380+
#define XILINX_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \
381+
MSI_FLAG_MULTI_PCI_MSI)
389382

383+
static const struct msi_parent_ops xilinx_msi_parent_ops = {
384+
.required_flags = XILINX_MSI_FLAGS_REQUIRED,
385+
.supported_flags = XILINX_MSI_FLAGS_SUPPORTED,
386+
.bus_select_token = DOMAIN_BUS_PCI_MSI,
387+
.prefix = "pl_dma-",
388+
.init_dev_msi_info = msi_lib_init_dev_msi_info,
389+
};
390390
static void xilinx_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
391391
{
392392
struct pl_dma_pcie *pcie = irq_data_get_irq_chip_data(data);
@@ -458,31 +458,24 @@ static void xilinx_pl_dma_pcie_free_irq_domains(struct pl_dma_pcie *port)
458458
irq_domain_remove(msi->dev_domain);
459459
msi->dev_domain = NULL;
460460
}
461-
462-
if (msi->msi_domain) {
463-
irq_domain_remove(msi->msi_domain);
464-
msi->msi_domain = NULL;
465-
}
466461
}
467462

468463
static int xilinx_pl_dma_pcie_init_msi_irq_domain(struct pl_dma_pcie *port)
469464
{
470465
struct device *dev = port->dev;
471466
struct xilinx_msi *msi = &port->msi;
472467
int size = BITS_TO_LONGS(XILINX_NUM_MSI_IRQS) * sizeof(long);
473-
struct fwnode_handle *fwnode = dev_fwnode(port->dev);
474-
475-
msi->dev_domain = irq_domain_create_linear(NULL, XILINX_NUM_MSI_IRQS,
476-
&dev_msi_domain_ops, port);
468+
struct irq_domain_info info = {
469+
.fwnode = dev_fwnode(port->dev),
470+
.ops = &dev_msi_domain_ops,
471+
.host_data = port,
472+
.size = XILINX_NUM_MSI_IRQS,
473+
};
474+
475+
msi->dev_domain = msi_create_parent_irq_domain(&info, &xilinx_msi_parent_ops);
477476
if (!msi->dev_domain)
478477
goto out;
479478

480-
msi->msi_domain = pci_msi_create_irq_domain(fwnode,
481-
&xilinx_msi_domain_info,
482-
msi->dev_domain);
483-
if (!msi->msi_domain)
484-
goto out;
485-
486479
mutex_init(&msi->lock);
487480
msi->bitmap = kzalloc(size, GFP_KERNEL);
488481
if (!msi->bitmap)

0 commit comments

Comments
 (0)