Skip to content

Commit 710a149

Browse files
covanambjorn-helgaas
authored andcommitted
PCI: xilinx-nwl: 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, 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
1 parent d08c7e5 commit 710a149

2 files changed

Lines changed: 24 additions & 23 deletions

File tree

drivers/pci/controller/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ config PCIE_XILINX_NWL
342342
bool "Xilinx NWL PCIe controller"
343343
depends on ARCH_ZYNQMP || COMPILE_TEST
344344
depends on PCI_MSI
345+
select IRQ_MSI_LIB
345346
help
346347
Say 'Y' here if you want kernel support for Xilinx
347348
NWL PCIe controller. The controller can act as Root Port

drivers/pci/controller/pcie-xilinx-nwl.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/delay.h>
1111
#include <linux/interrupt.h>
1212
#include <linux/irq.h>
13+
#include <linux/irqchip/irq-msi-lib.h>
1314
#include <linux/irqdomain.h>
1415
#include <linux/kernel.h>
1516
#include <linux/init.h>
@@ -145,7 +146,6 @@
145146
#define LINK_WAIT_USLEEP_MAX 100000
146147

147148
struct nwl_msi { /* MSI information */
148-
struct irq_domain *msi_domain;
149149
DECLARE_BITMAP(bitmap, INT_PCI_MSI_NR);
150150
struct irq_domain *dev_domain;
151151
struct mutex lock; /* protect bitmap variable */
@@ -418,19 +418,22 @@ static const struct irq_domain_ops intx_domain_ops = {
418418
};
419419

420420
#ifdef CONFIG_PCI_MSI
421-
static struct irq_chip nwl_msi_irq_chip = {
422-
.name = "nwl_pcie:msi",
423-
.irq_enable = pci_msi_unmask_irq,
424-
.irq_disable = pci_msi_mask_irq,
425-
.irq_mask = pci_msi_mask_irq,
426-
.irq_unmask = pci_msi_unmask_irq,
427-
};
428421

429-
static struct msi_domain_info nwl_msi_domain_info = {
430-
.flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
431-
MSI_FLAG_NO_AFFINITY | MSI_FLAG_MULTI_PCI_MSI,
432-
.chip = &nwl_msi_irq_chip,
422+
#define NWL_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
423+
MSI_FLAG_USE_DEF_CHIP_OPS | \
424+
MSI_FLAG_NO_AFFINITY)
425+
426+
#define NWL_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \
427+
MSI_FLAG_MULTI_PCI_MSI)
428+
429+
static const struct msi_parent_ops nwl_msi_parent_ops = {
430+
.required_flags = NWL_MSI_FLAGS_REQUIRED,
431+
.supported_flags = NWL_MSI_FLAGS_SUPPORTED,
432+
.bus_select_token = DOMAIN_BUS_PCI_MSI,
433+
.prefix = "nwl-",
434+
.init_dev_msi_info = msi_lib_init_dev_msi_info,
433435
};
436+
434437
#endif
435438

436439
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)
495498
{
496499
#ifdef CONFIG_PCI_MSI
497500
struct device *dev = pcie->dev;
498-
struct fwnode_handle *fwnode = dev_fwnode(dev);
499501
struct nwl_msi *msi = &pcie->msi;
500-
501-
msi->dev_domain = irq_domain_create_linear(NULL, INT_PCI_MSI_NR, &dev_msi_domain_ops, pcie);
502+
struct irq_domain_info info = {
503+
.fwnode = dev_fwnode(dev),
504+
.ops = &dev_msi_domain_ops,
505+
.host_data = pcie,
506+
.size = INT_PCI_MSI_NR,
507+
};
508+
509+
msi->dev_domain = msi_create_parent_irq_domain(&info, &nwl_msi_parent_ops);
502510
if (!msi->dev_domain) {
503511
dev_err(dev, "failed to create dev IRQ domain\n");
504512
return -ENOMEM;
505513
}
506-
msi->msi_domain = pci_msi_create_irq_domain(fwnode,
507-
&nwl_msi_domain_info,
508-
msi->dev_domain);
509-
if (!msi->msi_domain) {
510-
dev_err(dev, "failed to create msi IRQ domain\n");
511-
irq_domain_remove(msi->dev_domain);
512-
return -ENOMEM;
513-
}
514514
#endif
515515
return 0;
516516
}

0 commit comments

Comments
 (0)