Skip to contentSkip to conversation

PCI DT header refactoring and compile test improvements

PATCH In review Rob Herring 3 participants 18 messages Mar 7, 2018 – Mar 20, 2018

Subsystems (7)
lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

cover PCI DT header refactoring and compile test improvements

This started with just moving private functions from of_pci.h to drivers/pci/pci.h, but I was annoyed with trying to build all the right configs, so I enabled COMPILE_TEST on a bunch of drivers. Then I fixed the fallout from doing that. I'm sending this as all one series, but really there is no dependency for the header refactoring patch.

Needless to say, this series is *compile tested* only. This is based on Bjorn's for-linus branch (and the of_pci.h fix there).

Rob

Fengguang Wu (2):
PCI: rcar: fix semicolon.cocci warnings
PCI: v3-semi: fix semicolon.cocci warnings

Rob Herring (6):
PCI: kirin: remove unnecessary asm/compiler.h include
PCI: iproc: remove dependency on ARM specific struct pci_sys_data
PCI: kirin: fix missing dependency on PCI_MSI_IRQ_DOMAIN
PCI: improve host drivers compile test coverage
PCI: dw: move CONFIG_PCI depends to menu
PCI: move private DT related functions into private header

kbuild test robot (1):
PCI: kirin_pcie_driver can be static

 drivers/pci/dwc/Kconfig                | 42 +++++++++++++---------------------
 drivers/pci/dwc/pci-dra7xx.c           |  1 +
 drivers/pci/dwc/pcie-designware-host.c |  1 +
 drivers/pci/dwc/pcie-kirin.c           |  3 +--
 drivers/pci/host/Kconfig               | 33 ++++++++++++--------------
 drivers/pci/host/pci-aardvark.c        |  2 ++
 drivers/pci/host/pci-ftpci100.c        |  6 +++--
 drivers/pci/host/pci-mvebu.c           |  2 ++
 drivers/pci/host/pci-rcar-gen2.c       |  2 ++
 drivers/pci/host/pci-tegra.c           |  2 ++
 drivers/pci/host/pci-v3-semi.c         |  4 +++-
 drivers/pci/host/pci-xgene.c           |  2 ++
 drivers/pci/host/pcie-altera.c         |  2 ++
 drivers/pci/host/pcie-iproc-bcma.c     |  3 +--
 drivers/pci/host/pcie-iproc-platform.c |  1 +
 drivers/pci/host/pcie-iproc.c          | 19 ++-------------
 drivers/pci/host/pcie-iproc.h          |  4 ----
 drivers/pci/host/pcie-mediatek.c       |  2 ++
 drivers/pci/host/pcie-rcar.c           |  4 +++-
 drivers/pci/host/pcie-rockchip.c       |  2 ++
 drivers/pci/host/pcie-xilinx-nwl.c     |  2 ++
 drivers/pci/host/pcie-xilinx.c         |  2 ++
 drivers/pci/pci.h                      | 40 ++++++++++++++++++++++++++++++++
 include/linux/of_pci.h                 | 34 ---------------------------
 24 files changed, 108 insertions(+), 107 deletions(-)
Signature · 1 line
2.14.1
author maintainer
#1 lore raw

PATCH 1/9 PCI: kirin: remove unnecessary asm/compiler.h include

compiler.h is unnecessary and doesn't exist on some arches, so remove it.

---
 drivers/pci/dwc/pcie-kirin.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pci/dwc/pcie-kirin.c +0 -1
index 13d839bd6160..dcc8cedf6e17 100644
@@ -8,7 +8,6 @@
  * Author: Xiaowei Song <[email protected]>
  */
 
-#include <asm/compiler.h>
 #include <linux/compiler.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
Signature · 1 line
2.14.1
author maintainer
#2 lore raw

PATCH 2/9 PCI: iproc: remove dependency on ARM specific struct pci_sys_data

In reply to Rob Herring

The iproc driver is using ARM's struct pci_sys_data simply to store a private data pointer. This is completely unnecessary, so store the private data directly in bus->sysdata as is done on arm64.

---
 drivers/pci/host/pcie-iproc-bcma.c |  3 +--
 drivers/pci/host/pcie-iproc.c      | 19 ++-----------------
 drivers/pci/host/pcie-iproc.h      |  4 ----
 3 files changed, 3 insertions(+), 23 deletions(-)
drivers/pci/host/pcie-iproc-bcma.c +1 -2
index 603c83429cb3..aa55b064f64d 100644
@@ -25,8 +25,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8012, bcma_pcie2_fixup_class);
 
 static int iproc_pcie_bcma_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 {
-	struct pci_sys_data *sys = dev->sysdata;
-	struct iproc_pcie *pcie = sys->private_data;
+	struct iproc_pcie *pcie = dev->sysdata;
 	struct bcma_device *bdev = container_of(pcie->dev, struct bcma_device, dev);
 
 	return bcma_core_irq(bdev, 5);
drivers/pci/host/pcie-iproc.c +2 -17
index cbb095481cdc..3c76c5fa4f32 100644
@@ -377,14 +377,7 @@ static const u16 iproc_pcie_reg_paxc_v2[] = {
 
 static inline struct iproc_pcie *iproc_data(struct pci_bus *bus)
 {
-	struct iproc_pcie *pcie;
-#ifdef CONFIG_ARM
-	struct pci_sys_data *sys = bus->sysdata;
-
-	pcie = sys->private_data;
-#else
-	pcie = bus->sysdata;
-#endif
+	struct iproc_pcie *pcie = bus->sysdata;
 	return pcie;
 }
 
@@ -1331,7 +1324,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
 {
 	struct device *dev;
 	int ret;
-	void *sysdata;
 	struct pci_bus *child;
 	struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
 
@@ -1376,13 +1368,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
 			goto err_power_off_phy;
 	}
 
-#ifdef CONFIG_ARM
-	pcie->sysdata.private_data = pcie;
-	sysdata = &pcie->sysdata;
-#else
-	sysdata = pcie;
-#endif
-
 	ret = iproc_pcie_check_link(pcie);
 	if (ret) {
 		dev_err(dev, "no PCIe EP device detected\n");
@@ -1399,7 +1384,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
 	host->busnr = 0;
 	host->dev.parent = dev;
 	host->ops = &iproc_pcie_ops;
-	host->sysdata = sysdata;
+	host->sysdata = pcie;
 	host->map_irq = pcie->map_irq;
 	host->swizzle_irq = pci_common_swizzle;
 
drivers/pci/host/pcie-iproc.h +0 -4
index d55f56a186cd..814b600b383a 100644
@@ -54,7 +54,6 @@ struct iproc_msi;
  * @reg_offsets: register offsets
  * @base: PCIe host controller I/O register base
  * @base_addr: PCIe host controller register base physical address
- * @sysdata: Per PCI controller data (ARM-specific)
  * @root_bus: pointer to root bus
  * @phy: optional PHY device that controls the Serdes
  * @map_irq: function callback to map interrupts
@@ -80,9 +79,6 @@ struct iproc_pcie {
 	u16 *reg_offsets;
 	void __iomem *base;
 	phys_addr_t base_addr;
-#ifdef CONFIG_ARM
-	struct pci_sys_data sysdata;
-#endif
 	struct resource mem;
 	struct pci_bus *root_bus;
 	struct phy *phy;
Signature · 1 line
2.14.1
author maintainer
#4 lore raw

PATCH 3/9 PCI: kirin: fix missing dependency on PCI_MSI_IRQ_DOMAIN

In reply to Rob Herring

PCIE_DW_HOST depends on PCI_MSI_IRQ_DOMAIN and since kirin selects PCIE_DW_HOST, it must also depend on PCI_MSI_IRQ_DOMAIN. This was found by 0-day once building on all arches was enabled.

---
 drivers/pci/dwc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/dwc/Kconfig +1 -0
index 0f666b1ce289..2f3f5c50aa48 100644
@@ -176,6 +176,7 @@ config PCIE_ARTPEC6_EP
 config PCIE_KIRIN
 	depends on OF && ARM64
 	bool "HiSilicon Kirin series SoCs PCIe controllers"
+	depends on PCI_MSI_IRQ_DOMAIN
 	depends on PCI
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
Signature · 1 line
2.14.1
author maintainer
#5 lore raw

PATCH 4/9 PCI: kirin_pcie_driver can be static

In reply to Rob Herring

From: kbuild test robot <[email protected]>

This was generated from 0-day builder.

Fixes c44f2aed62c2 ("PCI: improve compile test coverage")
[robh: add commit msg]
---
 drivers/pci/dwc/pcie-kirin.c    | 2 +-
 drivers/pci/host/pci-ftpci100.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/pci/dwc/pcie-kirin.c +1 -1
index dcc8cedf6e17..a6b88c7f6e3e 100644
@@ -504,7 +504,7 @@ static const struct of_device_id kirin_pcie_match[] = {
 	{},
 };
 
-struct platform_driver kirin_pcie_driver = {
+static struct platform_driver kirin_pcie_driver = {
 	.probe			= kirin_pcie_probe,
 	.driver			= {
 		.name			= "kirin-pcie",
drivers/pci/host/pci-ftpci100.c +2 -2
index b9617d1c1d48..5008fd87956a 100644
@@ -586,11 +586,11 @@ static int faraday_pci_probe(struct platform_device *pdev)
  * We encode bridge variants here, we have at least two so it doesn't
  * hurt to have infrastructure to encompass future variants as well.
  */
-const struct faraday_pci_variant faraday_regular = {
+static const struct faraday_pci_variant faraday_regular = {
 	.cascaded_irq = true,
 };
 
-const struct faraday_pci_variant faraday_dual = {
+static const struct faraday_pci_variant faraday_dual = {
 	.cascaded_irq = false,
 };
 
Signature · 1 line
2.14.1
author maintainer
#7 lore raw

PATCH 5/9 PCI: rcar: fix semicolon.cocci warnings

In reply to Rob Herring

From: Fengguang Wu <[email protected]>

Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

---
 drivers/pci/host/pcie-rcar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-rcar.c +1 -1
index b4c4aad2cf66..6ab28f29ac6a 100644
@@ -435,7 +435,7 @@ static void rcar_pcie_force_speedup(struct rcar_pcie *pcie)
 		}
 
 		msleep(1);
-	};
+	}
 
 	dev_err(dev, "Speed change timed out\n");
 
Signature · 1 line
2.14.1
author maintainer
#8 lore raw

PATCH 6/9 PCI: v3-semi: fix semicolon.cocci warnings

In reply to Rob Herring

From: Fengguang Wu <[email protected]>

drivers/pci/host/pci-v3-semi.c:676:2-3: Unneeded semicolon

Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

Fixes c44f2aed62c2 ("PCI: improve compile test coverage")
---
 drivers/pci/host/pci-v3-semi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pci-v3-semi.c +1 -1
index 7fef64869d19..0a4dea796663 100644
@@ -673,7 +673,7 @@ static int v3_get_dma_range_config(struct v3_pci *v3,
 		dev_err(v3->dev, "illegal dma memory chunk size\n");
 		return -EINVAL;
 		break;
-	};
+	}
 	val |= V3_PCI_MAP_M_REG_EN | V3_PCI_MAP_M_ENABLE;
 	*pci_map = val;
 
Signature · 1 line
2.14.1
author maintainer
#9 lore raw

PATCH 7/9 PCI: improve host drivers compile test coverage

In reply to Rob Herring

Add COMPILE_TEST on driver config options with it. Some ARM drivers still have arch dependencies, so we have to keep those dependent on ARM.

---
 drivers/pci/dwc/Kconfig  | 24 ++++++++++++------------
 drivers/pci/host/Kconfig | 33 +++++++++++++++------------------
 2 files changed, 27 insertions(+), 30 deletions(-)
drivers/pci/dwc/Kconfig +12 -12
index 2f3f5c50aa48..6f2b653146bb 100644
@@ -66,7 +66,7 @@ config PCIE_DW_PLAT
 config PCI_EXYNOS
 	bool "Samsung Exynos PCIe controller"
 	depends on PCI
-	depends on SOC_EXYNOS5440
+	depends on SOC_EXYNOS5440 || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
@@ -74,7 +74,7 @@ config PCI_EXYNOS
 config PCI_IMX6
 	bool "Freescale i.MX6 PCIe controller"
 	depends on PCI
-	depends on SOC_IMX6Q
+	depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
@@ -82,7 +82,7 @@ config PCI_IMX6
 config PCIE_SPEAR13XX
 	bool "STMicroelectronics SPEAr PCIe controller"
 	depends on PCI
-	depends on ARCH_SPEAR13XX
+	depends on ARCH_SPEAR13XX || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
@@ -92,7 +92,7 @@ config PCIE_SPEAR13XX
 config PCI_KEYSTONE
 	bool "TI Keystone PCIe controller"
 	depends on PCI
-	depends on ARCH_KEYSTONE
+	depends on ARCH_KEYSTONE || (ARM && COMPILE_TEST)
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
@@ -105,7 +105,7 @@ config PCI_KEYSTONE
 config PCI_LAYERSCAPE
 	bool "Freescale Layerscape PCIe controller"
 	depends on PCI
-	depends on OF && (ARM || ARCH_LAYERSCAPE)
+	depends on OF && (ARM || ARCH_LAYERSCAPE || COMPILE_TEST)
 	depends on PCI_MSI_IRQ_DOMAIN
 	select MFD_SYSCON
 	select PCIE_DW_HOST
@@ -113,7 +113,7 @@ config PCI_LAYERSCAPE
 	  Say Y here if you want PCIe controller support on Layerscape SoCs.
 
 config PCI_HISI
-	depends on OF && ARM64
+	depends on OF && (ARM64 || COMPILE_TEST)
 	bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers"
 	depends on PCI
 	depends on PCI_MSI_IRQ_DOMAIN
@@ -127,7 +127,7 @@ config PCI_HISI
 config PCIE_QCOM
 	bool "Qualcomm PCIe controller"
 	depends on PCI
-	depends on ARCH_QCOM && OF
+	depends on OF && (ARCH_QCOM || COMPILE_TEST)
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
@@ -139,7 +139,7 @@ config PCIE_QCOM
 config PCIE_ARMADA_8K
 	bool "Marvell Armada-8K PCIe controller"
 	depends on PCI
-	depends on ARCH_MVEBU
+	depends on ARCH_MVEBU || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
@@ -154,7 +154,7 @@ config PCIE_ARTPEC6
 
 config PCIE_ARTPEC6_HOST
 	bool "Axis ARTPEC-6 PCIe controller Host Mode"
-	depends on MACH_ARTPEC6
+	depends on MACH_ARTPEC6 || COMPILE_TEST
 	depends on PCI && PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
@@ -165,7 +165,7 @@ config PCIE_ARTPEC6_HOST
 
 config PCIE_ARTPEC6_EP
 	bool "Axis ARTPEC-6 PCIe controller Endpoint Mode"
-	depends on MACH_ARTPEC6
+	depends on MACH_ARTPEC6 || COMPILE_TEST
 	depends on PCI_ENDPOINT
 	select PCIE_DW_EP
 	select PCIE_ARTPEC6
@@ -174,7 +174,7 @@ config PCIE_ARTPEC6_EP
 	  endpoint mode. This uses the DesignWare core.
 
 config PCIE_KIRIN
-	depends on OF && ARM64
+	depends on OF && (ARM64 || COMPILE_TEST)
 	bool "HiSilicon Kirin series SoCs PCIe controllers"
 	depends on PCI_MSI_IRQ_DOMAIN
 	depends on PCI
@@ -186,7 +186,7 @@ config PCIE_KIRIN
 
 config PCIE_HISI_STB
 	bool "HiSilicon STB SoCs PCIe controllers"
-	depends on ARCH_HISI
+	depends on ARCH_HISI || COMPILE_TEST
 	depends on PCI
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
drivers/pci/host/Kconfig +15 -18
index a4ed7484d127..752d93ce904e 100644
@@ -5,13 +5,13 @@ menu "PCI host controller drivers"
 
 config PCI_MVEBU
 	bool "Marvell EBU PCIe controller"
-	depends on ARCH_MVEBU || ARCH_DOVE
+	depends on ARCH_MVEBU || ARCH_DOVE || COMPILE_TEST
 	depends on ARM
 	depends on OF
 
 config PCI_AARDVARK
 	bool "Aardvark PCIe controller"
-	depends on ARCH_MVEBU && ARM64
+	depends on (ARCH_MVEBU && ARM64) || COMPILE_TEST
 	depends on OF
 	depends on PCI_MSI_IRQ_DOMAIN
 	help
@@ -21,7 +21,7 @@ config PCI_AARDVARK
 
 config PCIE_XILINX_NWL
 	bool "NWL PCIe Core"
-	depends on ARCH_ZYNQMP
+	depends on ARCH_ZYNQMP || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	help
 	 Say 'Y' here if you want kernel support for Xilinx
@@ -32,20 +32,19 @@ config PCIE_XILINX_NWL
 config PCI_FTPCI100
 	bool "Faraday Technology FTPCI100 PCI controller"
 	depends on OF
-	depends on ARM
 	default ARCH_GEMINI
 
 config PCI_TEGRA
 	bool "NVIDIA Tegra PCIe controller"
-	depends on ARCH_TEGRA
+	depends on ARCH_TEGRA || COMPILE_TEST
 	help
 	  Say Y here if you want support for the PCIe host controller found
 	  on NVIDIA Tegra SoCs.
 
 config PCI_RCAR_GEN2
 	bool "Renesas R-Car Gen2 Internal PCI controller"
-	depends on ARM
 	depends on ARCH_RENESAS || COMPILE_TEST
+	depends on ARM
 	help
 	  Say Y here if you want internal PCI support on R-Car Gen2 SoC.
 	  There are 3 internal PCI controllers available with a single
@@ -53,7 +52,7 @@ config PCI_RCAR_GEN2
 
 config PCIE_RCAR
 	bool "Renesas R-Car PCIe controller"
-	depends on ARCH_RENESAS || (ARM && COMPILE_TEST)
+	depends on ARCH_RENESAS || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	help
 	  Say Y here if you want PCIe controller support on R-Car SoCs.
@@ -64,7 +63,7 @@ config PCI_HOST_COMMON
 
 config PCI_HOST_GENERIC
 	bool "Generic PCI host controller"
-	depends on (ARM || ARM64) && OF
+	depends on OF
 	select PCI_HOST_COMMON
 	select IRQ_DOMAIN
 	help
@@ -73,14 +72,14 @@ config PCI_HOST_GENERIC
 
 config PCIE_XILINX
 	bool "Xilinx AXI PCIe host bridge support"
-	depends on ARCH_ZYNQ || MICROBLAZE || (MIPS && PCI_DRIVERS_GENERIC)
+	depends on ARCH_ZYNQ || MICROBLAZE || (MIPS && PCI_DRIVERS_GENERIC) || COMPILE_TEST
 	help
 	  Say 'Y' here if you want kernel to support the Xilinx AXI PCIe
 	  Host Bridge driver.
 
 config PCI_XGENE
 	bool "X-Gene PCIe controller"
-	depends on ARM64
+	depends on ARM64 || COMPILE_TEST
 	depends on OF || (ACPI && PCI_QUIRKS)
 	select PCIEPORTBUS
 	help
@@ -100,7 +99,7 @@ config PCI_XGENE_MSI
 config PCI_V3_SEMI
 	bool "V3 Semiconductor PCI controller"
 	depends on OF
-	depends on ARM
+	depends on ARM || COMPILE_TEST
 	default ARCH_INTEGRATOR_AP
 
 config PCI_VERSATILE
@@ -127,7 +126,7 @@ config PCIE_IPROC_PLATFORM
 
 config PCIE_IPROC_BCMA
 	tristate "Broadcom iProc PCIe BCMA bus driver"
-	depends on ARM && (ARCH_BCM_IPROC || COMPILE_TEST)
+	depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST)
 	select PCIE_IPROC
 	select BCMA
 	default ARCH_BCM_5301X
@@ -146,8 +145,7 @@ config PCIE_IPROC_MSI
 
 config PCIE_ALTERA
 	bool "Altera PCIe controller"
-	depends on ARM || NIOS2
-	depends on OF_PCI
+	depends on ARM || NIOS2 || COMPILE_TEST
 	select PCI_DOMAINS
 	help
 	  Say Y here if you want to enable PCIe controller support on Altera
@@ -163,7 +161,7 @@ config PCIE_ALTERA_MSI
 
 config PCI_HOST_THUNDER_PEM
 	bool "Cavium Thunder PCIe controller to off-chip devices"
-	depends on ARM64
+	depends on ARM64 || COMPILE_TEST
 	depends on OF || (ACPI && PCI_QUIRKS)
 	select PCI_HOST_COMMON
 	help
@@ -171,7 +169,7 @@ config PCI_HOST_THUNDER_PEM
 
 config PCI_HOST_THUNDER_ECAM
 	bool "Cavium Thunder ECAM controller to on-chip devices on pass-1.x silicon"
-	depends on ARM64
+	depends on ARM64 || COMPILE_TEST
 	depends on OF || (ACPI && PCI_QUIRKS)
 	select PCI_HOST_COMMON
 	help
@@ -190,9 +188,8 @@ config PCIE_ROCKCHIP
 
 config PCIE_MEDIATEK
 	bool "MediaTek PCIe controller"
-	depends on (ARM || ARM64) && (ARCH_MEDIATEK || COMPILE_TEST)
+	depends on ARCH_MEDIATEK || COMPILE_TEST
 	depends on OF
-	depends on PCI
 	select PCIEPORTBUS
 	help
 	  Say Y here if you want to enable PCIe controller support on
Signature · 1 line
2.14.1
author maintainer
#14 lore raw

PATCH 8/9 PCI: dw: move CONFIG_PCI depends to menu

In reply to Rob Herring

There's no need for every config option to explicitly depend on CONFIG_PCI, so move it out of individual option to the menu option.

---
 drivers/pci/dwc/Kconfig | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/pci/dwc/Kconfig +3 -14
index 6f2b653146bb..2902544f5834 100644
@@ -1,13 +1,13 @@
 # SPDX-License-Identifier: GPL-2.0
 
 menu "DesignWare PCI Core Support"
+	depends on PCI
 
 config PCIE_DW
 	bool
 
 config PCIE_DW_HOST
         bool
-	depends on PCI
 	depends on PCI_MSI_IRQ_DOMAIN
         select PCIE_DW
 
@@ -22,7 +22,7 @@ config PCI_DRA7XX
 config PCI_DRA7XX_HOST
 	bool "TI DRA7xx PCIe controller Host Mode"
 	depends on SOC_DRA7XX || COMPILE_TEST
-	depends on PCI && PCI_MSI_IRQ_DOMAIN
+	depends on PCI_MSI_IRQ_DOMAIN
 	depends on OF && HAS_IOMEM && TI_PIPE3
 	select PCIE_DW_HOST
 	select PCI_DRA7XX
@@ -52,7 +52,6 @@ config PCI_DRA7XX_EP
 
 config PCIE_DW_PLAT
 	bool "Platform bus based DesignWare PCIe Controller"
-	depends on PCI
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIE_DW_HOST
 	---help---
@@ -65,7 +64,6 @@ config PCIE_DW_PLAT
 
 config PCI_EXYNOS
 	bool "Samsung Exynos PCIe controller"
-	depends on PCI
 	depends on SOC_EXYNOS5440 || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
@@ -73,7 +71,6 @@ config PCI_EXYNOS
 
 config PCI_IMX6
 	bool "Freescale i.MX6 PCIe controller"
-	depends on PCI
 	depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
@@ -81,7 +78,6 @@ config PCI_IMX6
 
 config PCIE_SPEAR13XX
 	bool "STMicroelectronics SPEAr PCIe controller"
-	depends on PCI
 	depends on ARCH_SPEAR13XX || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
@@ -91,7 +87,6 @@ config PCIE_SPEAR13XX
 
 config PCI_KEYSTONE
 	bool "TI Keystone PCIe controller"
-	depends on PCI
 	depends on ARCH_KEYSTONE || (ARM && COMPILE_TEST)
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
@@ -104,7 +99,6 @@ config PCI_KEYSTONE
 
 config PCI_LAYERSCAPE
 	bool "Freescale Layerscape PCIe controller"
-	depends on PCI
 	depends on OF && (ARM || ARCH_LAYERSCAPE || COMPILE_TEST)
 	depends on PCI_MSI_IRQ_DOMAIN
 	select MFD_SYSCON
@@ -115,7 +109,6 @@ config PCI_LAYERSCAPE
 config PCI_HISI
 	depends on OF && (ARM64 || COMPILE_TEST)
 	bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers"
-	depends on PCI
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
@@ -126,7 +119,6 @@ config PCI_HISI
 
 config PCIE_QCOM
 	bool "Qualcomm PCIe controller"
-	depends on PCI
 	depends on OF && (ARCH_QCOM || COMPILE_TEST)
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
@@ -138,7 +130,6 @@ config PCIE_QCOM
 
 config PCIE_ARMADA_8K
 	bool "Marvell Armada-8K PCIe controller"
-	depends on PCI
 	depends on ARCH_MVEBU || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
@@ -155,7 +146,7 @@ config PCIE_ARTPEC6
 config PCIE_ARTPEC6_HOST
 	bool "Axis ARTPEC-6 PCIe controller Host Mode"
 	depends on MACH_ARTPEC6 || COMPILE_TEST
-	depends on PCI && PCI_MSI_IRQ_DOMAIN
+	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
 	select PCIE_ARTPEC6
@@ -177,7 +168,6 @@ config PCIE_KIRIN
 	depends on OF && (ARM64 || COMPILE_TEST)
 	bool "HiSilicon Kirin series SoCs PCIe controllers"
 	depends on PCI_MSI_IRQ_DOMAIN
-	depends on PCI
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
 	help
@@ -187,7 +177,6 @@ config PCIE_KIRIN
 config PCIE_HISI_STB
 	bool "HiSilicon STB SoCs PCIe controllers"
 	depends on ARCH_HISI || COMPILE_TEST
-	depends on PCI
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
Signature · 1 line
2.14.1
author maintainer
#15 lore raw

PATCH 9/9 PCI: move private DT related functions into private header

In reply to Rob Herring

The functions in linux/of_pci.h are primarily used by host bridge drivers, so they can be private to drivers/pci/.

The remaining functions are still used mostly in host bridge drivers that still live in arch specific code. Hopefully someday, those will get moved into drivers/pci as well.

---
 drivers/pci/dwc/pci-dra7xx.c           |  1 +
 drivers/pci/dwc/pcie-designware-host.c |  1 +
 drivers/pci/host/pci-aardvark.c        |  2 ++
 drivers/pci/host/pci-ftpci100.c        |  2 ++
 drivers/pci/host/pci-mvebu.c           |  2 ++
 drivers/pci/host/pci-rcar-gen2.c       |  2 ++
 drivers/pci/host/pci-tegra.c           |  2 ++
 drivers/pci/host/pci-v3-semi.c         |  2 ++
 drivers/pci/host/pci-xgene.c           |  2 ++
 drivers/pci/host/pcie-altera.c         |  2 ++
 drivers/pci/host/pcie-iproc-platform.c |  1 +
 drivers/pci/host/pcie-mediatek.c       |  2 ++
 drivers/pci/host/pcie-rcar.c           |  2 ++
 drivers/pci/host/pcie-rockchip.c       |  2 ++
 drivers/pci/host/pcie-xilinx-nwl.c     |  2 ++
 drivers/pci/host/pcie-xilinx.c         |  2 ++
 drivers/pci/pci.h                      | 40 ++++++++++++++++++++++++++++++++++
 include/linux/of_pci.h                 | 34 -----------------------------
 18 files changed, 69 insertions(+), 34 deletions(-)
drivers/pci/dwc/pci-dra7xx.c +1 -0
index ed8558d638e5..620709d38a64 100644
@@ -27,6 +27,7 @@
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 
+#include "../pci.h"
 #include "pcie-designware.h"
 
 /* PCIe controller wrapper DRA7XX configuration registers */
drivers/pci/dwc/pcie-designware-host.c +1 -0
index 8de2d5c69b1d..17faa4c04dd6 100644
@@ -14,6 +14,7 @@
 #include <linux/pci_regs.h>
 #include <linux/platform_device.h>
 
+#include "../pci.h"
 #include "pcie-designware.h"
 
 static struct pci_ops dw_pcie_ops;
drivers/pci/host/pci-aardvark.c +2 -0
index b04d37b3c5de..55b94911bc9a 100644
@@ -19,6 +19,8 @@
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 
+#include "../pci.h"
+
 /* PCIe core registers */
 #define PCIE_CORE_CMD_STATUS_REG				0x4
 #define     PCIE_CORE_CMD_IO_ACCESS_EN				BIT(0)
drivers/pci/host/pci-ftpci100.c +2 -0
index 5008fd87956a..474faa2e922e 100644
@@ -28,6 +28,8 @@
 #include <linux/irq.h>
 #include <linux/clk.h>
 
+#include "../pci.h"
+
 /*
  * Special configuration registers directly in the first few words
  * in I/O space.
drivers/pci/host/pci-mvebu.c +2 -0
index 5d4dccfc9d81..23e270839e6a 100644
@@ -21,6 +21,8 @@
 #include <linux/of_pci.h>
 #include <linux/of_platform.h>
 
+#include "../pci.h"
+
 /*
  * PCIe unit register offsets.
  */
drivers/pci/host/pci-rcar-gen2.c +2 -0
index a28370bb2b2a..0cb00f2edc89 100644
@@ -21,6 +21,8 @@
 #include <linux/sizes.h>
 #include <linux/slab.h>
 
+#include "../pci.h"
+
 /* AHB-PCI Bridge PCI communication registers */
 #define RCAR_AHBPCI_PCICOM_OFFSET	0x800
 
drivers/pci/host/pci-tegra.c +2 -0
index dd9b3bcc41c3..8292f763a49b 100644
@@ -38,6 +38,8 @@
 #include <soc/tegra/cpuidle.h>
 #include <soc/tegra/pmc.h>
 
+#include "../pci.h"
+
 #define INT_PCI_MSI_NR (8 * 32)
 
 /* register definitions */
drivers/pci/host/pci-v3-semi.c +2 -0
index 0a4dea796663..04bf53d02f23 100644
@@ -33,6 +33,8 @@
 #include <linux/regmap.h>
 #include <linux/clk.h>
 
+#include "../pci.h"
+
 #define V3_PCI_VENDOR			0x00000000
 #define V3_PCI_DEVICE			0x00000002
 #define V3_PCI_CMD			0x00000004
drivers/pci/host/pci-xgene.c +2 -0
index 0a0d7ee6d3c9..648a50243022 100644
@@ -22,6 +22,8 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#include "../pci.h"
+
 #define PCIECORE_CTLANDSTATUS		0x50
 #define PIM1_1L				0x80
 #define IBAR2				0x98
drivers/pci/host/pcie-altera.c +2 -0
index 2235f4760951..3292c20abe40 100644
@@ -17,6 +17,8 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#include "../pci.h"
+
 #define RP_TX_REG0			0x2000
 #define RP_TX_REG1			0x2004
 #define RP_TX_CNTRL			0x2008
drivers/pci/host/pcie-iproc-platform.c +1 -0
index e764a2a2693c..fb23fdf919c8 100644
@@ -16,6 +16,7 @@
 #include <linux/of_platform.h>
 #include <linux/phy/phy.h>
 
+#include "../pci.h"
 #include "pcie-iproc.h"
 
 static const struct of_device_id iproc_pcie_of_match_table[] = {
drivers/pci/host/pcie-mediatek.c +2 -0
index a8b20c5012a9..5b3da5856ca2 100644
@@ -22,6 +22,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
 
+#include "../pci.h"
+
 /* PCIe shared registers */
 #define PCIE_SYS_CFG		0x00
 #define PCIE_INT_ENABLE		0x0c
drivers/pci/host/pcie-rcar.c +2 -0
index 6ab28f29ac6a..9629ec039deb 100644
@@ -28,6 +28,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
 
+#include "../pci.h"
+
 #define PCIECAR			0x000010
 #define PCIECCTLR		0x000018
 #define  CONFIG_SEND_ENABLE	(1 << 31)
drivers/pci/host/pcie-rockchip.c +2 -0
index f1e8f97ea1fb..daf9120a4350 100644
@@ -36,6 +36,8 @@
 #include <linux/reset.h>
 #include <linux/regmap.h>
 
+#include "../pci.h"
+
 /*
  * The upper 16 bits of PCIE_CLIENT_CONFIG are a write mask for the lower 16
  * bits.  This allows atomic updates of the register without locking.
drivers/pci/host/pcie-xilinx-nwl.c +2 -0
index 0acaf483d031..7702d68abbdc 100644
@@ -21,6 +21,8 @@
 #include <linux/platform_device.h>
 #include <linux/irqchip/chained_irq.h>
 
+#include "../pci.h"
+
 /* Bridge core config registers */
 #define BRCFG_PCIE_RX0			0x00000000
 #define BRCFG_INTERRUPT			0x00000010
drivers/pci/host/pcie-xilinx.c +2 -0
index 0ad188effc09..ec193e930caa 100644
@@ -23,6 +23,8 @@
 #include <linux/pci.h>
 #include <linux/platform_device.h>
 
+#include "../pci.h"
+
 /* Register definitions */
 #define XILINX_PCIE_REG_BIR		0x00000130
 #define XILINX_PCIE_REG_IDR		0x00000138
drivers/pci/pci.h +40 -0
index fcd81911b127..d1b91c26b0d4 100644
@@ -396,4 +396,44 @@ static inline u64 pci_rebar_size_to_bytes(int size)
 	return 1ULL << (size + 20);
 }
 
+struct device_node;
+
+#ifdef CONFIG_OF
+int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
+int of_get_pci_domain_nr(struct device_node *node);
+int of_pci_get_max_link_speed(struct device_node *node);
+
+#else
+static inline int
+of_pci_parse_bus_range(struct device_node *node, struct resource *res)
+{
+	return -EINVAL;
+}
+
+static inline int
+of_get_pci_domain_nr(struct device_node *node)
+{
+	return -1;
+}
+
+static inline int
+of_pci_get_max_link_speed(struct device_node *node)
+{
+	return -EINVAL;
+}
+#endif /* CONFIG_OF */
+
+#if defined(CONFIG_OF_ADDRESS)
+int of_pci_get_host_bridge_resources(struct device_node *dev,
+			unsigned char busno, unsigned char bus_max,
+			struct list_head *resources, resource_size_t *io_base);
+#else
+static inline int of_pci_get_host_bridge_resources(struct device_node *dev,
+			unsigned char busno, unsigned char bus_max,
+			struct list_head *resources, resource_size_t *io_base)
+{
+	return -EINVAL;
+}
+#endif
+
 #endif /* DRIVERS_PCI_H */
include/linux/of_pci.h +0 -34
index 091033a6b836..e83d87fc5673 100644
@@ -13,9 +13,6 @@ struct device_node;
 struct device_node *of_pci_find_child_device(struct device_node *parent,
 					     unsigned int devfn);
 int of_pci_get_devfn(struct device_node *np);
-int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
-int of_get_pci_domain_nr(struct device_node *node);
-int of_pci_get_max_link_speed(struct device_node *node);
 void of_pci_check_probe_only(void);
 int of_pci_map_rid(struct device_node *np, u32 rid,
 		   const char *map_name, const char *map_mask_name,
@@ -32,18 +29,6 @@ static inline int of_pci_get_devfn(struct device_node *np)
 	return -EINVAL;
 }
 
-static inline int
-of_pci_parse_bus_range(struct device_node *node, struct resource *res)
-{
-	return -EINVAL;
-}
-
-static inline int
-of_get_pci_domain_nr(struct device_node *node)
-{
-	return -1;
-}
-
 static inline int of_pci_map_rid(struct device_node *np, u32 rid,
 			const char *map_name, const char *map_mask_name,
 			struct device_node **target, u32 *id_out)
@@ -51,12 +36,6 @@ static inline int of_pci_map_rid(struct device_node *np, u32 rid,
 	return -EINVAL;
 }
 
-static inline int
-of_pci_get_max_link_speed(struct device_node *node)
-{
-	return -EINVAL;
-}
-
 static inline void of_pci_check_probe_only(void) { }
 #endif
 
@@ -70,17 +49,4 @@ of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
 }
 #endif
 
-#if defined(CONFIG_OF_ADDRESS)
-int of_pci_get_host_bridge_resources(struct device_node *dev,
-			unsigned char busno, unsigned char bus_max,
-			struct list_head *resources, resource_size_t *io_base);
-#else
-static inline int of_pci_get_host_bridge_resources(struct device_node *dev,
-			unsigned char busno, unsigned char bus_max,
-			struct list_head *resources, resource_size_t *io_base)
-{
-	return -EINVAL;
-}
-#endif
-
 #endif
Signature · 1 line
2.14.1
#10 lore raw

Re: [PATCH 7/9] PCI: improve host drivers compile test coverage

In reply to Rob Herring

Hi Rob,

Change to PCIE_IPROC_BCMA to be made.

Quoted 218 lines · Rob Herring

Add COMPILE_TEST on driver config options with it. Some ARM drivers still have arch dependencies, so we have to keep those dependent on ARM.

---
  drivers/pci/dwc/Kconfig  | 24 ++++++++++++------------
  drivers/pci/host/Kconfig | 33 +++++++++++++++------------------
  2 files changed, 27 insertions(+), 30 deletions(-)
drivers/pci/dwc/Kconfig +12 -12
index 2f3f5c50aa48..6f2b653146bb 100644
@@ -66,7 +66,7 @@ config PCIE_DW_PLAT
  config PCI_EXYNOS
  	bool "Samsung Exynos PCIe controller"
  	depends on PCI
-	depends on SOC_EXYNOS5440
+	depends on SOC_EXYNOS5440 || COMPILE_TEST
  	depends on PCI_MSI_IRQ_DOMAIN
  	select PCIEPORTBUS
  	select PCIE_DW_HOST
@@ -74,7 +74,7 @@ config PCI_EXYNOS
  config PCI_IMX6
  	bool "Freescale i.MX6 PCIe controller"
  	depends on PCI
-	depends on SOC_IMX6Q
+	depends on SOC_IMX6Q || (ARM && COMPILE_TEST)
  	depends on PCI_MSI_IRQ_DOMAIN
  	select PCIEPORTBUS
  	select PCIE_DW_HOST
@@ -82,7 +82,7 @@ config PCI_IMX6
  config PCIE_SPEAR13XX
  	bool "STMicroelectronics SPEAr PCIe controller"
  	depends on PCI
-	depends on ARCH_SPEAR13XX
+	depends on ARCH_SPEAR13XX || COMPILE_TEST
  	depends on PCI_MSI_IRQ_DOMAIN
  	select PCIEPORTBUS
  	select PCIE_DW_HOST
@@ -92,7 +92,7 @@ config PCIE_SPEAR13XX
  config PCI_KEYSTONE
  	bool "TI Keystone PCIe controller"
  	depends on PCI
-	depends on ARCH_KEYSTONE
+	depends on ARCH_KEYSTONE || (ARM && COMPILE_TEST)
  	depends on PCI_MSI_IRQ_DOMAIN
  	select PCIEPORTBUS
  	select PCIE_DW_HOST
@@ -105,7 +105,7 @@ config PCI_KEYSTONE
  config PCI_LAYERSCAPE
  	bool "Freescale Layerscape PCIe controller"
  	depends on PCI
-	depends on OF && (ARM || ARCH_LAYERSCAPE)
+	depends on OF && (ARM || ARCH_LAYERSCAPE || COMPILE_TEST)
  	depends on PCI_MSI_IRQ_DOMAIN
  	select MFD_SYSCON
  	select PCIE_DW_HOST
@@ -113,7 +113,7 @@ config PCI_LAYERSCAPE
  	  Say Y here if you want PCIe controller support on Layerscape SoCs.
 
  config PCI_HISI
-	depends on OF && ARM64
+	depends on OF && (ARM64 || COMPILE_TEST)
  	bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers"
  	depends on PCI
  	depends on PCI_MSI_IRQ_DOMAIN
@@ -127,7 +127,7 @@ config PCI_HISI
  config PCIE_QCOM
  	bool "Qualcomm PCIe controller"
  	depends on PCI
-	depends on ARCH_QCOM && OF
+	depends on OF && (ARCH_QCOM || COMPILE_TEST)
  	depends on PCI_MSI_IRQ_DOMAIN
  	select PCIEPORTBUS
  	select PCIE_DW_HOST
@@ -139,7 +139,7 @@ config PCIE_QCOM
  config PCIE_ARMADA_8K
  	bool "Marvell Armada-8K PCIe controller"
  	depends on PCI
-	depends on ARCH_MVEBU
+	depends on ARCH_MVEBU || COMPILE_TEST
  	depends on PCI_MSI_IRQ_DOMAIN
  	select PCIEPORTBUS
  	select PCIE_DW_HOST
@@ -154,7 +154,7 @@ config PCIE_ARTPEC6
 
  config PCIE_ARTPEC6_HOST
  	bool "Axis ARTPEC-6 PCIe controller Host Mode"
-	depends on MACH_ARTPEC6
+	depends on MACH_ARTPEC6 || COMPILE_TEST
  	depends on PCI && PCI_MSI_IRQ_DOMAIN
  	select PCIEPORTBUS
  	select PCIE_DW_HOST
@@ -165,7 +165,7 @@ config PCIE_ARTPEC6_HOST
 
  config PCIE_ARTPEC6_EP
  	bool "Axis ARTPEC-6 PCIe controller Endpoint Mode"
-	depends on MACH_ARTPEC6
+	depends on MACH_ARTPEC6 || COMPILE_TEST
  	depends on PCI_ENDPOINT
  	select PCIE_DW_EP
  	select PCIE_ARTPEC6
@@ -174,7 +174,7 @@ config PCIE_ARTPEC6_EP
  	  endpoint mode. This uses the DesignWare core.
 
  config PCIE_KIRIN
-	depends on OF && ARM64
+	depends on OF && (ARM64 || COMPILE_TEST)
  	bool "HiSilicon Kirin series SoCs PCIe controllers"
  	depends on PCI_MSI_IRQ_DOMAIN
  	depends on PCI
@@ -186,7 +186,7 @@ config PCIE_KIRIN
 
  config PCIE_HISI_STB
  	bool "HiSilicon STB SoCs PCIe controllers"
-	depends on ARCH_HISI
+	depends on ARCH_HISI || COMPILE_TEST
  	depends on PCI
  	depends on PCI_MSI_IRQ_DOMAIN
  	select PCIEPORTBUS
drivers/pci/host/Kconfig +10 -11
index a4ed7484d127..752d93ce904e 100644
@@ -5,13 +5,13 @@ menu "PCI host controller drivers"
 
  config PCI_MVEBU
  	bool "Marvell EBU PCIe controller"
-	depends on ARCH_MVEBU || ARCH_DOVE
+	depends on ARCH_MVEBU || ARCH_DOVE || COMPILE_TEST
  	depends on ARM
  	depends on OF
 
  config PCI_AARDVARK
  	bool "Aardvark PCIe controller"
-	depends on ARCH_MVEBU && ARM64
+	depends on (ARCH_MVEBU && ARM64) || COMPILE_TEST
  	depends on OF
  	depends on PCI_MSI_IRQ_DOMAIN
  	help
@@ -21,7 +21,7 @@ config PCI_AARDVARK
 
  config PCIE_XILINX_NWL
  	bool "NWL PCIe Core"
-	depends on ARCH_ZYNQMP
+	depends on ARCH_ZYNQMP || COMPILE_TEST
  	depends on PCI_MSI_IRQ_DOMAIN
  	help
  	 Say 'Y' here if you want kernel support for Xilinx
@@ -32,20 +32,19 @@ config PCIE_XILINX_NWL
  config PCI_FTPCI100
  	bool "Faraday Technology FTPCI100 PCI controller"
  	depends on OF
-	depends on ARM
  	default ARCH_GEMINI
 
  config PCI_TEGRA
  	bool "NVIDIA Tegra PCIe controller"
-	depends on ARCH_TEGRA
+	depends on ARCH_TEGRA || COMPILE_TEST
  	help
  	  Say Y here if you want support for the PCIe host controller found
  	  on NVIDIA Tegra SoCs.
 
  config PCI_RCAR_GEN2
  	bool "Renesas R-Car Gen2 Internal PCI controller"
-	depends on ARM
  	depends on ARCH_RENESAS || COMPILE_TEST
+	depends on ARM
  	help
  	  Say Y here if you want internal PCI support on R-Car Gen2 SoC.
  	  There are 3 internal PCI controllers available with a single
@@ -53,7 +52,7 @@ config PCI_RCAR_GEN2
 
  config PCIE_RCAR
  	bool "Renesas R-Car PCIe controller"
-	depends on ARCH_RENESAS || (ARM && COMPILE_TEST)
+	depends on ARCH_RENESAS || COMPILE_TEST
  	depends on PCI_MSI_IRQ_DOMAIN
  	help
  	  Say Y here if you want PCIe controller support on R-Car SoCs.
@@ -64,7 +63,7 @@ config PCI_HOST_COMMON
 
  config PCI_HOST_GENERIC
  	bool "Generic PCI host controller"
-	depends on (ARM || ARM64) && OF
+	depends on OF
  	select PCI_HOST_COMMON
  	select IRQ_DOMAIN
  	help
@@ -73,14 +72,14 @@ config PCI_HOST_GENERIC
 
  config PCIE_XILINX
  	bool "Xilinx AXI PCIe host bridge support"
-	depends on ARCH_ZYNQ || MICROBLAZE || (MIPS && PCI_DRIVERS_GENERIC)
+	depends on ARCH_ZYNQ || MICROBLAZE || (MIPS && PCI_DRIVERS_GENERIC) || COMPILE_TEST
  	help
  	  Say 'Y' here if you want kernel to support the Xilinx AXI PCIe
  	  Host Bridge driver.
 
  config PCI_XGENE
  	bool "X-Gene PCIe controller"
-	depends on ARM64
+	depends on ARM64 || COMPILE_TEST
  	depends on OF || (ACPI && PCI_QUIRKS)
  	select PCIEPORTBUS
  	help
@@ -100,7 +99,7 @@ config PCI_XGENE_MSI
  config PCI_V3_SEMI
  	bool "V3 Semiconductor PCI controller"
  	depends on OF
-	depends on ARM
+	depends on ARM || COMPILE_TEST
  	default ARCH_INTEGRATOR_AP
 
  config PCI_VERSATILE

drivers/pci/host/Kconfig config PCIE_IPROC_PLATFORM · line 132

Quoted 8 lines
drivers/pci/host/Kconfig +1 -1
@@ -127,7 +126,7 @@ config PCIE_IPROC_PLATFORM
 
  config PCIE_IPROC_BCMA
  	tristate "Broadcom iProc PCIe BCMA bus driver"
-	depends on ARM && (ARCH_BCM_IPROC || COMPILE_TEST)
+	depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST)
  	select PCIE_IPROC
  	select BCMA
  	default ARCH_BCM_5301X

The was intentionally depending on ARM (as it does not apply to ARM64 which ARCH_BCM__IPROC also applies to).  Please keep that in place. depends on (ARM && ARCH_BCM_IPROC) || COMPILE_TEST

Quoted 39 lines
drivers/pci/host/Kconfig +4 -6
@@ -146,8 +145,7 @@ config PCIE_IPROC_MSI
 
  config PCIE_ALTERA
  	bool "Altera PCIe controller"
-	depends on ARM || NIOS2
-	depends on OF_PCI
+	depends on ARM || NIOS2 || COMPILE_TEST
  	select PCI_DOMAINS
  	help
  	  Say Y here if you want to enable PCIe controller support on Altera
@@ -163,7 +161,7 @@ config PCIE_ALTERA_MSI
 
  config PCI_HOST_THUNDER_PEM
  	bool "Cavium Thunder PCIe controller to off-chip devices"
-	depends on ARM64
+	depends on ARM64 || COMPILE_TEST
  	depends on OF || (ACPI && PCI_QUIRKS)
  	select PCI_HOST_COMMON
  	help
@@ -171,7 +169,7 @@ config PCI_HOST_THUNDER_PEM
 
  config PCI_HOST_THUNDER_ECAM
  	bool "Cavium Thunder ECAM controller to on-chip devices on pass-1.x silicon"
-	depends on ARM64
+	depends on ARM64 || COMPILE_TEST
  	depends on OF || (ACPI && PCI_QUIRKS)
  	select PCI_HOST_COMMON
  	help
@@ -190,9 +188,8 @@ config PCIE_ROCKCHIP
 
  config PCIE_MEDIATEK
  	bool "MediaTek PCIe controller"
-	depends on (ARM || ARM64) && (ARCH_MEDIATEK || COMPILE_TEST)
+	depends on ARCH_MEDIATEK || COMPILE_TEST
  	depends on OF
-	depends on PCI
  	select PCIEPORTBUS
  	help
  	  Say Y here if you want to enable PCIe controller support on
Acked-by on v1 2/9
#3 lore raw

Re: [PATCH 2/9] PCI: iproc: remove dependency on ARM specific struct pci_sys_data

In reply to Rob Herring

Looks fine.

Quoted 5 lines · Rob Herring

The iproc driver is using ARM's struct pci_sys_data simply to store a private data pointer. This is completely unnecessary, so store the private data directly in bus->sysdata as is done on arm64.

Quoted 93 lines
---
  drivers/pci/host/pcie-iproc-bcma.c |  3 +--
  drivers/pci/host/pcie-iproc.c      | 19 ++-----------------
  drivers/pci/host/pcie-iproc.h      |  4 ----
  3 files changed, 3 insertions(+), 23 deletions(-)
drivers/pci/host/pcie-iproc-bcma.c +1 -2
index 603c83429cb3..aa55b064f64d 100644
@@ -25,8 +25,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8012, bcma_pcie2_fixup_class);
 
  static int iproc_pcie_bcma_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  {
-	struct pci_sys_data *sys = dev->sysdata;
-	struct iproc_pcie *pcie = sys->private_data;
+	struct iproc_pcie *pcie = dev->sysdata;
  	struct bcma_device *bdev = container_of(pcie->dev, struct bcma_device, dev);
 
  	return bcma_core_irq(bdev, 5);
drivers/pci/host/pcie-iproc.c +2 -17
index cbb095481cdc..3c76c5fa4f32 100644
@@ -377,14 +377,7 @@ static const u16 iproc_pcie_reg_paxc_v2[] = {
 
  static inline struct iproc_pcie *iproc_data(struct pci_bus *bus)
  {
-	struct iproc_pcie *pcie;
-#ifdef CONFIG_ARM
-	struct pci_sys_data *sys = bus->sysdata;
-
-	pcie = sys->private_data;
-#else
-	pcie = bus->sysdata;
-#endif
+	struct iproc_pcie *pcie = bus->sysdata;
  	return pcie;
  }
 
@@ -1331,7 +1324,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
  {
  	struct device *dev;
  	int ret;
-	void *sysdata;
  	struct pci_bus *child;
  	struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
 
@@ -1376,13 +1368,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
  			goto err_power_off_phy;
  	}
 
-#ifdef CONFIG_ARM
-	pcie->sysdata.private_data = pcie;
-	sysdata = &pcie->sysdata;
-#else
-	sysdata = pcie;
-#endif
-
  	ret = iproc_pcie_check_link(pcie);
  	if (ret) {
  		dev_err(dev, "no PCIe EP device detected\n");
@@ -1399,7 +1384,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
  	host->busnr = 0;
  	host->dev.parent = dev;
  	host->ops = &iproc_pcie_ops;
-	host->sysdata = sysdata;
+	host->sysdata = pcie;
  	host->map_irq = pcie->map_irq;
  	host->swizzle_irq = pci_common_swizzle;
 
drivers/pci/host/pcie-iproc.h +0 -4
index d55f56a186cd..814b600b383a 100644
@@ -54,7 +54,6 @@ struct iproc_msi;
   * @reg_offsets: register offsets
   * @base: PCIe host controller I/O register base
   * @base_addr: PCIe host controller register base physical address
- * @sysdata: Per PCI controller data (ARM-specific)
   * @root_bus: pointer to root bus
   * @phy: optional PHY device that controls the Serdes
   * @map_irq: function callback to map interrupts
@@ -80,9 +79,6 @@ struct iproc_pcie {
  	u16 *reg_offsets;
  	void __iomem *base;
  	phys_addr_t base_addr;
-#ifdef CONFIG_ARM
-	struct pci_sys_data sysdata;
-#endif
  	struct resource mem;
  	struct pci_bus *root_bus;
  	struct phy *phy;
#6 lore raw

Re: [PATCH 4/9] PCI: kirin_pcie_driver can be static

In reply to Rob Herring
Quoted 33 lines · Rob Herring

From: kbuild test robot <[email protected]>

This was generated from 0-day builder.

Fixes c44f2aed62c2 ("PCI: improve compile test coverage")
[robh: add commit msg]
---
 drivers/pci/dwc/pcie-kirin.c    | 2 +-
 drivers/pci/host/pci-ftpci100.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/pci/dwc/pcie-kirin.c +1 -1
index dcc8cedf6e17..a6b88c7f6e3e 100644
@@ -504,7 +504,7 @@ static const struct of_device_id kirin_pcie_match[] = {
 	{},
 };
 
-struct platform_driver kirin_pcie_driver = {
+static struct platform_driver kirin_pcie_driver = {
 	.probe			= kirin_pcie_probe,
 	.driver			= {
 		.name			= "kirin-pcie",
drivers/pci/host/pci-ftpci100.c +0 -0
index b9617d1c1d48..5008fd87956a 100644
@@ -586,11 +586,11 @@ static int faraday_pci_probe(struct platform_device *pdev)
  * We encode bridge variants here, we have at least two so it doesn't
  * hurt to have infrastructure to encompass future variants as well.

drivers/pci/host/pci-ftpci100.c static int faraday_pci_probe(struct platform_device *pdev) · line 595

Quoted 10 lines
drivers/pci/host/pci-ftpci100.c +2 -2
  */
-const struct faraday_pci_variant faraday_regular = {
+static const struct faraday_pci_variant faraday_regular = {
 	.cascaded_irq = true,
 };
 
-const struct faraday_pci_variant faraday_dual = {
+static const struct faraday_pci_variant faraday_dual = {
 	.cascaded_irq = false,
 };

It is more than kirin_pcie_driver then :), I can update the commit log myself.

Lorenzo

author maintainer
#11 lore raw

Re: [PATCH 7/9] PCI: improve host drivers compile test coverage

In reply to Scott Branden
Quoted 15 lines · Scott Branden

Hi Rob,

Change to PCIE_IPROC_BCMA to be made.

Quoted 9 lines · Rob Herring

Add COMPILE_TEST on driver config options with it. Some ARM drivers still have arch dependencies, so we have to keep those dependent on ARM.

---
  drivers/pci/dwc/Kconfig  | 24 ++++++++++++------------
  drivers/pci/host/Kconfig | 33 +++++++++++++++------------------
  2 files changed, 27 insertions(+), 30 deletions(-)

[...]

Quoted 4 lines
Quoted 4 lines
drivers/pci/host/Kconfig +0 -1
@@ -127,7 +126,7 @@ config PCIE_IPROC_PLATFORM
    config PCIE_IPROC_BCMA
        tristate "Broadcom iProc PCIe BCMA bus driver"
-       depends on ARM && (ARCH_BCM_IPROC || COMPILE_TEST)
Quoted 8 lines

drivers/pci/host/Kconfig config PCIE_IPROC_PLATFORM · line 132

Quoted 4 lines
drivers/pci/host/Kconfig +1 -0
+       depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST)
        select PCIE_IPROC
        select BCMA
        default ARCH_BCM_5301X

The was intentionally depending on ARM (as it does not apply to ARM64 which ARCH_BCM__IPROC also applies to). Please keep that in place. depends on (ARM && ARCH_BCM_IPROC) || COMPILE_TEST

Indeed.

Lorenzo, can you fix up or want me to send a new version?

Rob

#12 lore raw

Re: [PATCH 7/9] PCI: improve host drivers compile test coverage

Quoted 33 lines · Rob Herring
Quoted 15 lines · Scott Branden

Hi Rob,

Change to PCIE_IPROC_BCMA to be made.

Quoted 9 lines · Rob Herring

Add COMPILE_TEST on driver config options with it. Some ARM drivers still have arch dependencies, so we have to keep those dependent on ARM.

---
  drivers/pci/dwc/Kconfig  | 24 ++++++++++++------------
  drivers/pci/host/Kconfig | 33 +++++++++++++++------------------
  2 files changed, 27 insertions(+), 30 deletions(-)

[...]

Quoted 4 lines
Quoted 4 lines
drivers/pci/host/Kconfig +0 -1
@@ -127,7 +126,7 @@ config PCIE_IPROC_PLATFORM
    config PCIE_IPROC_BCMA
        tristate "Broadcom iProc PCIe BCMA bus driver"
-       depends on ARM && (ARCH_BCM_IPROC || COMPILE_TEST)
Quoted 8 lines

drivers/pci/host/Kconfig config PCIE_IPROC_PLATFORM · line 132

Quoted 4 lines
drivers/pci/host/Kconfig +1 -0
+       depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST)
        select PCIE_IPROC
        select BCMA
        default ARCH_BCM_5301X

The was intentionally depending on ARM (as it does not apply to ARM64 which ARCH_BCM__IPROC also applies to). Please keep that in place. depends on (ARM && ARCH_BCM_IPROC) || COMPILE_TEST

Quoted 3 lines

Indeed.

Lorenzo, can you fix up or want me to send a new version?

Hi Rob,

I can fix it up, I am not sure where the dependency on ARM is though, isn't patch 2 supposed to remove it ? I am certainly missing something here so please chime in.

Thanks,
Lorenzo

#13 lore raw

Re: [PATCH 7/9] PCI: improve host drivers compile test coverage

Hi Lorenzo,

Quoted 33 lines · Lorenzo Pieralisi
Quoted 29 lines · Rob Herring
Quoted 14 lines · Scott Branden

Hi Rob,

Change to PCIE_IPROC_BCMA to be made.

Quoted 8 lines · Rob Herring

Add COMPILE_TEST on driver config options with it. Some ARM drivers still have arch dependencies, so we have to keep those dependent on ARM.

---
   drivers/pci/dwc/Kconfig  | 24 ++++++++++++------------
   drivers/pci/host/Kconfig | 33 +++++++++++++++------------------
   2 files changed, 27 insertions(+), 30 deletions(-)

[...]

Quoted 11 lines

drivers/pci/host/Kconfig config PCIE_IPROC_PLATFORM · line 131

Quoted 8 lines
drivers/pci/host/Kconfig +1 -1
@@ -127,7 +126,7 @@ config PCIE_IPROC_PLATFORM
     config PCIE_IPROC_BCMA
         tristate "Broadcom iProc PCIe BCMA bus driver"
-       depends on ARM && (ARCH_BCM_IPROC || COMPILE_TEST)
+       depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST)
         select PCIE_IPROC
         select BCMA
         default ARCH_BCM_5301X

The was intentionally depending on ARM (as it does not apply to ARM64 which ARCH_BCM__IPROC also applies to). Please keep that in place. depends on (ARM && ARCH_BCM_IPROC) || COMPILE_TEST

Quoted 3 lines

Indeed.

Lorenzo, can you fix up or want me to send a new version?

Quoted 8 lines

Hi Rob,

I can fix it up, I am not sure where the dependency on ARM is though, isn't patch 2 supposed to remove it ? I am certainly missing something here so please chime in.

Thanks,
Lorenzo

You patch wanted to remove the dependency on ARM during COMPILE_TEST. But, during normal use, it should not remove such dependency. As such, the following is the correct change to make:

depends on (ARM && ARCH_BCM_IPROC) || COMPILE_TEST

Thanks,
Scott

#16 lore raw
In reply to Rob Herring

Hi Rob, all,

Quoted 8 lines · Rob Herring

This started with just moving private functions from of_pci.h to drivers/pci/pci.h, but I was annoyed with trying to build all the right configs, so I enabled COMPILE_TEST on a bunch of drivers. Then I fixed the fallout from doing that. I'm sending this as all one series, but really there is no dependency for the header refactoring patch.

Needless to say, this series is *compile tested* only. This is based on Bjorn's for-linus branch (and the of_pci.h fix there).

I reworked it and applied on top of v4.16-rc1 in my pci/host/misc branch to get a kbot report on it - then we can decide how we can merge it.

Thanks,
Lorenzo

Quoted 46 lines

Rob

Fengguang Wu (2):
PCI: rcar: fix semicolon.cocci warnings
PCI: v3-semi: fix semicolon.cocci warnings

Rob Herring (6):
PCI: kirin: remove unnecessary asm/compiler.h include
PCI: iproc: remove dependency on ARM specific struct pci_sys_data
PCI: kirin: fix missing dependency on PCI_MSI_IRQ_DOMAIN
PCI: improve host drivers compile test coverage
PCI: dw: move CONFIG_PCI depends to menu
PCI: move private DT related functions into private header

kbuild test robot (1):
PCI: kirin_pcie_driver can be static

 drivers/pci/dwc/Kconfig                | 42 +++++++++++++---------------------
 drivers/pci/dwc/pci-dra7xx.c           |  1 +
 drivers/pci/dwc/pcie-designware-host.c |  1 +
 drivers/pci/dwc/pcie-kirin.c           |  3 +--
 drivers/pci/host/Kconfig               | 33 ++++++++++++--------------
 drivers/pci/host/pci-aardvark.c        |  2 ++
 drivers/pci/host/pci-ftpci100.c        |  6 +++--
 drivers/pci/host/pci-mvebu.c           |  2 ++
 drivers/pci/host/pci-rcar-gen2.c       |  2 ++
 drivers/pci/host/pci-tegra.c           |  2 ++
 drivers/pci/host/pci-v3-semi.c         |  4 +++-
 drivers/pci/host/pci-xgene.c           |  2 ++
 drivers/pci/host/pcie-altera.c         |  2 ++
 drivers/pci/host/pcie-iproc-bcma.c     |  3 +--
 drivers/pci/host/pcie-iproc-platform.c |  1 +
 drivers/pci/host/pcie-iproc.c          | 19 ++-------------
 drivers/pci/host/pcie-iproc.h          |  4 ----
 drivers/pci/host/pcie-mediatek.c       |  2 ++
 drivers/pci/host/pcie-rcar.c           |  4 +++-
 drivers/pci/host/pcie-rockchip.c       |  2 ++
 drivers/pci/host/pcie-xilinx-nwl.c     |  2 ++
 drivers/pci/host/pcie-xilinx.c         |  2 ++
 drivers/pci/pci.h                      | 40 ++++++++++++++++++++++++++++++++
 include/linux/of_pci.h                 | 34 ---------------------------
 24 files changed, 108 insertions(+), 107 deletions(-)
Signature · 1 line
2.14.1
#17 lore raw

Hi Lorenzo,

Quoted 9 lines · Lorenzo Pieralisi

Hi Rob, all,

Quoted 6 lines · Rob Herring

This started with just moving private functions from of_pci.h to drivers/pci/pci.h, but I was annoyed with trying to build all the right configs, so I enabled COMPILE_TEST on a bunch of drivers. Then I fixed the fallout from doing that. I'm sending this as all one series, but really there is no dependency for the header refactoring patch.

Quoted 5 lines
Quoted 2 lines

Needless to say, this series is *compile tested* only. This is based on Bjorn's for-linus branch (and the of_pci.h fix there).

I reworked it and applied on top of v4.16-rc1 in my pci/host/misc branch to get a kbot report on it - then we can decide how we can merge it.

You should send out v2 of the patch series so it can be reviewed and ack'd?

The v1 of the patch shouldn't be merged into mainline and then have v2 applied on top of it.  Only v2 should be merged upstream.

Quoted 50 lines

Thanks,
Lorenzo

Quoted 46 lines

Rob

Fengguang Wu (2):
PCI: rcar: fix semicolon.cocci warnings
PCI: v3-semi: fix semicolon.cocci warnings

Rob Herring (6):
PCI: kirin: remove unnecessary asm/compiler.h include
PCI: iproc: remove dependency on ARM specific struct pci_sys_data
PCI: kirin: fix missing dependency on PCI_MSI_IRQ_DOMAIN
PCI: improve host drivers compile test coverage
PCI: dw: move CONFIG_PCI depends to menu
PCI: move private DT related functions into private header

kbuild test robot (1):
PCI: kirin_pcie_driver can be static

  drivers/pci/dwc/Kconfig                | 42 +++++++++++++---------------------
  drivers/pci/dwc/pci-dra7xx.c           |  1 +
  drivers/pci/dwc/pcie-designware-host.c |  1 +
  drivers/pci/dwc/pcie-kirin.c           |  3 +--
  drivers/pci/host/Kconfig               | 33 ++++++++++++--------------
  drivers/pci/host/pci-aardvark.c        |  2 ++
  drivers/pci/host/pci-ftpci100.c        |  6 +++--
  drivers/pci/host/pci-mvebu.c           |  2 ++
  drivers/pci/host/pci-rcar-gen2.c       |  2 ++
  drivers/pci/host/pci-tegra.c           |  2 ++
  drivers/pci/host/pci-v3-semi.c         |  4 +++-
  drivers/pci/host/pci-xgene.c           |  2 ++
  drivers/pci/host/pcie-altera.c         |  2 ++
  drivers/pci/host/pcie-iproc-bcma.c     |  3 +--
  drivers/pci/host/pcie-iproc-platform.c |  1 +
  drivers/pci/host/pcie-iproc.c          | 19 ++-------------
  drivers/pci/host/pcie-iproc.h          |  4 ----
  drivers/pci/host/pcie-mediatek.c       |  2 ++
  drivers/pci/host/pcie-rcar.c           |  4 +++-
  drivers/pci/host/pcie-rockchip.c       |  2 ++
  drivers/pci/host/pcie-xilinx-nwl.c     |  2 ++
  drivers/pci/host/pcie-xilinx.c         |  2 ++
  drivers/pci/pci.h                      | 40 ++++++++++++++++++++++++++++++++
  include/linux/of_pci.h                 | 34 ---------------------------
  24 files changed, 108 insertions(+), 107 deletions(-)
Signature · 1 line
2.14.1