lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251204095530.1033142-1-arnd@kernel.org>
Date: Thu,  4 Dec 2025 10:55:22 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Lorenzo Pieralisi <lpieralisi@...nel.org>,
	Krzysztof WilczyƄski <kwilczynski@...nel.org>,
	Manivannan Sadhasivam <mani@...nel.org>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Manikandan K Pillai <mpillai@...ence.com>
Cc: Arnd Bergmann <arnd@...db.de>,
	Rob Herring <robh@...nel.org>,
	Siddharth Vadapalli <s-vadapalli@...com>,
	Chen Wang <unicorn_wang@...look.com>,
	Hans Zhang <hans.zhang@...tech.com>,
	Kishon Vijay Abraham I <kishon@...nel.org>,
	linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] PCI: cadence: fix build-time dependencies

From: Arnd Bergmann <arnd@...db.de>

The split of the the cadence pcie controller driver into three modules
does not match the Kconfig structure, as the common symbol tries to
call into the more specific ones. If one is built-in but the other is
a loadable module, we get one of these link errors:

arm-linux-gnueabi-ld: drivers/pci/controller/cadence/pcie-cadence-plat.o: in function `cdns_plat_pcie_probe':
pcie-cadence-plat.c:(.text+0x33c): undefined reference to `cdns_pcie_host_setup'
arm-linux-gnueabi-ld: drivers/pci/controller/cadence/pcie-cadence-plat.o: in function `cdns_plat_pcie_probe':
pcie-cadence-plat.c:(.text+0x264): undefined reference to `cdns_pcie_ep_setup'

Move the two parts back into a common module to ensure they can always
link, while keeping the optional parts out of possible.

Fixes: 611627a4e5e4 ("PCI: cadence: Add module support for platform controller driver")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
We had discussed this on the list earlier, but I independently ran into
the problem while build-testing. This was the version that actually ended
up passing randconfig testing for me.
---
 drivers/pci/controller/cadence/Kconfig  | 15 +++++++++------
 drivers/pci/controller/cadence/Makefile | 12 +++++++++---
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/controller/cadence/Kconfig b/drivers/pci/controller/cadence/Kconfig
index 9e651d545973..978ffe9a1da2 100644
--- a/drivers/pci/controller/cadence/Kconfig
+++ b/drivers/pci/controller/cadence/Kconfig
@@ -7,16 +7,14 @@ config PCIE_CADENCE
 	tristate
 
 config PCIE_CADENCE_HOST
-	tristate
+	bool
 	depends on OF
 	select IRQ_DOMAIN
-	select PCIE_CADENCE
 
 config PCIE_CADENCE_EP
-	tristate
+	bool
 	depends on OF
 	depends on PCI_ENDPOINT
-	select PCIE_CADENCE
 
 config PCIE_CADENCE_PLAT
 	tristate
@@ -24,6 +22,7 @@ config PCIE_CADENCE_PLAT
 config PCIE_CADENCE_PLAT_HOST
 	tristate "Cadence platform PCIe controller (host mode)"
 	depends on OF
+	select PCIE_CADENCE
 	select PCIE_CADENCE_HOST
 	select PCIE_CADENCE_PLAT
 	help
@@ -35,6 +34,7 @@ config PCIE_CADENCE_PLAT_EP
 	tristate "Cadence platform PCIe controller (endpoint mode)"
 	depends on OF
 	depends on PCI_ENDPOINT
+	select PCIE_CADENCE
 	select PCIE_CADENCE_EP
 	select PCIE_CADENCE_PLAT
 	help
@@ -45,6 +45,7 @@ config PCIE_CADENCE_PLAT_EP
 config PCI_SKY1_HOST
 	tristate "CIX SKY1 PCIe controller (host mode)"
 	depends on OF && (ARCH_CIX || COMPILE_TEST)
+	select PCIE_CADENCE
 	select PCIE_CADENCE_HOST
 	select PCI_ECAM
 	help
@@ -60,6 +61,7 @@ config PCI_SKY1_HOST
 config PCIE_SG2042_HOST
 	tristate "Sophgo SG2042 PCIe controller (host mode)"
 	depends on OF && (ARCH_SOPHGO || COMPILE_TEST)
+	select PCIE_CADENCE
 	select PCIE_CADENCE_HOST
 	help
 	  Say Y here if you want to support the Sophgo SG2042 PCIe platform
@@ -68,14 +70,14 @@ config PCIE_SG2042_HOST
 
 config PCI_J721E
 	tristate
-	select PCIE_CADENCE_HOST if PCI_J721E_HOST != n
-	select PCIE_CADENCE_EP if PCI_J721E_EP != n
+	select PCIE_CADENCE
 
 config PCI_J721E_HOST
 	tristate "TI J721E PCIe controller (host mode)"
 	depends on ARCH_K3 || COMPILE_TEST
 	depends on OF
 	select PCI_J721E
+	select PCIE_CADENCE_HOST
 	help
 	  Say Y here if you want to support the TI J721E PCIe platform
 	  controller in host mode. TI J721E PCIe controller uses Cadence PCIe
@@ -87,6 +89,7 @@ config PCI_J721E_EP
 	depends on OF
 	depends on PCI_ENDPOINT
 	select PCI_J721E
+	select PCIE_CADENCE_EP
 	help
 	  Say Y here if you want to support the TI J721E PCIe platform
 	  controller in endpoint mode. TI J721E PCIe controller uses Cadence PCIe
diff --git a/drivers/pci/controller/cadence/Makefile b/drivers/pci/controller/cadence/Makefile
index b8ec1cecfaa8..139ac0a0de6f 100644
--- a/drivers/pci/controller/cadence/Makefile
+++ b/drivers/pci/controller/cadence/Makefile
@@ -1,11 +1,17 @@
 # SPDX-License-Identifier: GPL-2.0
 pcie-cadence-mod-y := pcie-cadence-hpa.o pcie-cadence.o
+obj-$(CONFIG_PCIE_CADENCE) = pcie-cadence-mod.o
+
+ifdef CONFIG_PCIE_CADENCE_HOST
 pcie-cadence-host-mod-y := pcie-cadence-host-common.o pcie-cadence-host.o pcie-cadence-host-hpa.o
+obj-$(CONFIG_PCIE_CADENCE) += pcie-cadence-host-mod.o
+endif
+
+ifdef CONFIG_PCIE_CADENCE_EP
 pcie-cadence-ep-mod-y := pcie-cadence-ep.o
+obj-$(CONFIG_PCIE_CADENCE) += pcie-cadence-ep-mod.o
+endif
 
-obj-$(CONFIG_PCIE_CADENCE) = pcie-cadence-mod.o
-obj-$(CONFIG_PCIE_CADENCE_HOST) += pcie-cadence-host-mod.o
-obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep-mod.o
 obj-$(CONFIG_PCIE_CADENCE_PLAT) += pcie-cadence-plat.o
 obj-$(CONFIG_PCI_J721E) += pci-j721e.o
 obj-$(CONFIG_PCIE_SG2042_HOST) += pcie-sg2042.o
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ