Commit 769ce531 authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

Merge branch 'pci/controller/msi-parent'

- Use dev_fwnode() instead of of_fwnode_handle() to remove OF dependency
  in altera (fixes an unused variable), designware-host, mediatek,
  mediatek-gen3, mobiveil, plda, xilinx, xilinx-dma, xilinx-nwl (Jiri
  Slaby, Arnd Bergmann)

- Convert aardvark, altera, brcmstb, designware-host, iproc, mediatek,
  mediatek-gen3, mobiveil, plda, rcar-host, vmd, xilinx, xilinx-dma,
  xilinx-nwl from using pci_msi_create_irq_domain() to using
  msi_create_parent_irq_domain() instead; this makes the interrupt
  controller per-PCI device, allows dynamic allocation of vectors after
  initialization, and allows support of IMS (Nam Cao)

- Convert vmd to using lock guards to tidy the code (Nam Cao)

* pci/controller/msi-parent:
  PCI: vmd: Switch to msi_create_parent_irq_domain()
  PCI: vmd: Convert to lock guards
  PCI: plda: Switch to msi_create_parent_irq_domain()
  PCI: xilinx: Switch to msi_create_parent_irq_domain()
  PCI: xilinx-nwl: Switch to msi_create_parent_irq_domain()
  PCI: xilinx-xdma: Switch to msi_create_parent_irq_domain()
  PCI: rcar-host: Switch to msi_create_parent_irq_domain()
  PCI: mediatek: Switch to msi_create_parent_irq_domain()
  PCI: mediatek-gen3: Switch to msi_create_parent_irq_domain()
  PCI: iproc: Switch to msi_create_parent_irq_domain()
  PCI: brcmstb: Switch to msi_create_parent_irq_domain()
  PCI: altera-msi: Switch to msi_create_parent_irq_domain()
  PCI: aardvark: Switch to msi_create_parent_irq_domain()
  PCI: mobiveil: Switch to msi_create_parent_irq_domain()
  PCI: dwc: Switch to msi_create_parent_irq_domain()
  PCI: controller: Use dev_fwnode() instead of of_fwnode_handle()
parents 7f837a26 d7d8ab87
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ config PCI_AARDVARK
	depends on OF
	depends on PCI_MSI
	select PCI_BRIDGE_EMUL
	select IRQ_MSI_LIB
	help
	 Add support for Aardvark 64bit PCIe Host Controller. This
	 controller is part of the South Bridge of the Marvel Armada
@@ -29,6 +30,7 @@ config PCIE_ALTERA_MSI
	tristate "Altera PCIe MSI feature"
	depends on PCIE_ALTERA
	depends on PCI_MSI
	select IRQ_MSI_LIB
	help
	  Say Y here if you want PCIe MSI support for the Altera FPGA.
	  This MSI driver supports Altera MSI to GIC controller IP.
@@ -62,6 +64,7 @@ config PCIE_BRCMSTB
		   BMIPS_GENERIC || COMPILE_TEST
	depends on OF
	depends on PCI_MSI
	select IRQ_MSI_LIB
	default ARCH_BRCMSTB || BMIPS_GENERIC
	help
	  Say Y here to enable PCIe host controller support for
@@ -98,6 +101,7 @@ config PCIE_IPROC_MSI
	bool "Broadcom iProc PCIe MSI support"
	depends on PCIE_IPROC_PLATFORM || PCIE_IPROC_BCMA
	depends on PCI_MSI
	select IRQ_MSI_LIB
	default ARCH_BCM_IPROC
	help
	  Say Y here if you want to enable MSI support for Broadcom's iProc
@@ -152,6 +156,7 @@ config PCI_IXP4XX
config VMD
	depends on PCI_MSI && X86_64 && !UML
	tristate "Intel Volume Management Device Driver"
	select IRQ_MSI_LIB
	help
	  Adds support for the Intel Volume Management Device (VMD). VMD is a
	  secondary PCI host bridge that allows PCI Express root ports,
@@ -191,6 +196,7 @@ config PCIE_MEDIATEK
	depends on ARCH_AIROHA || ARCH_MEDIATEK || COMPILE_TEST
	depends on OF
	depends on PCI_MSI
	select IRQ_MSI_LIB
	help
	  Say Y here if you want to enable PCIe controller support on
	  MediaTek SoCs.
@@ -199,6 +205,7 @@ config PCIE_MEDIATEK_GEN3
	tristate "MediaTek Gen3 PCIe controller"
	depends on ARCH_AIROHA || ARCH_MEDIATEK || COMPILE_TEST
	depends on PCI_MSI
	select IRQ_MSI_LIB
	help
	  Adds support for PCIe Gen3 MAC controller for MediaTek SoCs.
	  This PCIe controller is compatible with Gen3, Gen2 and Gen1 speed,
@@ -237,6 +244,7 @@ config PCIE_RCAR_HOST
	bool "Renesas R-Car PCIe controller (host mode)"
	depends on ARCH_RENESAS || COMPILE_TEST
	depends on PCI_MSI
	select IRQ_MSI_LIB
	help
	  Say Y here if you want PCIe controller support on R-Car SoCs in host
	  mode.
@@ -315,6 +323,7 @@ config PCIE_XILINX
	bool "Xilinx AXI PCIe controller"
	depends on OF
	depends on PCI_MSI
	select IRQ_MSI_LIB
	help
	  Say 'Y' here if you want kernel to support the Xilinx AXI PCIe
	  Host Bridge driver.
@@ -324,6 +333,7 @@ config PCIE_XILINX_DMA_PL
	depends on ARCH_ZYNQMP || COMPILE_TEST
	depends on PCI_MSI
	select PCI_HOST_COMMON
	select IRQ_MSI_LIB
	help
	  Say 'Y' here if you want kernel support for the Xilinx PL DMA
	  PCIe host bridge. The controller is a Soft IP which can act as
@@ -334,6 +344,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
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ config PCIE_DW_DEBUGFS
config PCIE_DW_HOST
	bool
	select PCIE_DW
	select IRQ_MSI_LIB

config PCIE_DW_EP
	bool
+24 −45
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@

#include <linux/iopoll.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/irqchip/irq-msi-lib.h>
#include <linux/irqdomain.h>
#include <linux/msi.h>
#include <linux/of_address.h>
@@ -23,35 +24,21 @@
static struct pci_ops dw_pcie_ops;
static struct pci_ops dw_child_pcie_ops;

static void dw_msi_ack_irq(struct irq_data *d)
{
	irq_chip_ack_parent(d);
}

static void dw_msi_mask_irq(struct irq_data *d)
{
	pci_msi_mask_irq(d);
	irq_chip_mask_parent(d);
}

static void dw_msi_unmask_irq(struct irq_data *d)
{
	pci_msi_unmask_irq(d);
	irq_chip_unmask_parent(d);
}

static struct irq_chip dw_pcie_msi_irq_chip = {
	.name = "PCI-MSI",
	.irq_ack = dw_msi_ack_irq,
	.irq_mask = dw_msi_mask_irq,
	.irq_unmask = dw_msi_unmask_irq,
};

static struct msi_domain_info dw_pcie_msi_domain_info = {
	.flags	= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
		  MSI_FLAG_NO_AFFINITY | MSI_FLAG_PCI_MSIX |
		  MSI_FLAG_MULTI_PCI_MSI,
	.chip	= &dw_pcie_msi_irq_chip,
#define DW_PCIE_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS		| \
				    MSI_FLAG_USE_DEF_CHIP_OPS		| \
				    MSI_FLAG_NO_AFFINITY		| \
				    MSI_FLAG_PCI_MSI_MASK_PARENT)
#define DW_PCIE_MSI_FLAGS_SUPPORTED (MSI_FLAG_MULTI_PCI_MSI		| \
				     MSI_FLAG_PCI_MSIX			| \
				     MSI_GENERIC_FLAGS_MASK)

static const struct msi_parent_ops dw_pcie_msi_parent_ops = {
	.required_flags		= DW_PCIE_MSI_FLAGS_REQUIRED,
	.supported_flags	= DW_PCIE_MSI_FLAGS_SUPPORTED,
	.bus_select_token	= DOMAIN_BUS_PCI_MSI,
	.chip_flags		= MSI_CHIP_FLAG_SET_ACK,
	.prefix			= "DW-",
	.init_dev_msi_info	= msi_lib_init_dev_msi_info,
};

/* MSI int handler */
@@ -227,26 +214,19 @@ static const struct irq_domain_ops dw_pcie_msi_domain_ops = {
int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)
{
	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
	struct fwnode_handle *fwnode = of_fwnode_handle(pci->dev->of_node);
	struct irq_domain_info info = {
		.fwnode		= dev_fwnode(pci->dev),
		.ops		= &dw_pcie_msi_domain_ops,
		.size		= pp->num_vectors,
		.host_data	= pp,
	};

	pp->irq_domain = irq_domain_create_linear(fwnode, pp->num_vectors,
					       &dw_pcie_msi_domain_ops, pp);
	pp->irq_domain = msi_create_parent_irq_domain(&info, &dw_pcie_msi_parent_ops);
	if (!pp->irq_domain) {
		dev_err(pci->dev, "Failed to create IRQ domain\n");
		return -ENOMEM;
	}

	irq_domain_update_bus_token(pp->irq_domain, DOMAIN_BUS_NEXUS);

	pp->msi_domain = pci_msi_create_irq_domain(fwnode,
						   &dw_pcie_msi_domain_info,
						   pp->irq_domain);
	if (!pp->msi_domain) {
		dev_err(pci->dev, "Failed to create MSI domain\n");
		irq_domain_remove(pp->irq_domain);
		return -ENOMEM;
	}

	return 0;
}

@@ -260,7 +240,6 @@ static void dw_pcie_free_msi(struct dw_pcie_rp *pp)
							 NULL, NULL);
	}

	irq_domain_remove(pp->msi_domain);
	irq_domain_remove(pp->irq_domain);
}

+0 −1
Original line number Diff line number Diff line
@@ -417,7 +417,6 @@ struct dw_pcie_rp {
	const struct dw_pcie_host_ops *ops;
	int			msi_irq[MAX_MSI_CTRLS];
	struct irq_domain	*irq_domain;
	struct irq_domain	*msi_domain;
	dma_addr_t		msi_data;
	struct irq_chip		*msi_irq_chip;
	u32			num_vectors;
+1 −0
Original line number Diff line number Diff line
@@ -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
Loading