Skip to contentSkip to conversation

drivers/pci/controller/cadence/pci-j721e.c:648:undefined reference to `cdns_pcie_host_disable'

DISCUSSION kernel test robot 3 participants 7 messages Nov 11, 2025 – Nov 13, 2025

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4427259cc7f7571a157fbc9b5011e1ef6fe0a4a8
commit: 1c72774df028429836eec3394212f2921bb830fc PCI: sg2042: Add Sophgo SG2042 PCIe driver
date:   8 weeks ago
config: loongarch-randconfig-r113-20251110 (https://download.01.org/0day-ci/archive/20251111/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251111/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

loongarch64-linux-ld: drivers/pci/controller/cadence/pci-j721e.o: in function `j721e_pcie_remove':

>> drivers/pci/controller/cadence/pci-j721e.c:648:(.text+0x83c): undefined reference to `cdns_pcie_host_disable'

vim +648 drivers/pci/controller/cadence/pci-j721e.c

f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 637
c86f4bd6008e7e Uwe Kleine-König 2023-03-21 638 static void j721e_pcie_remove(struct platform_device *pdev)

f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  639  {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  640  	struct j721e_pcie *pcie = platform_get_drvdata(pdev);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  641  	struct cdns_pcie *cdns_pcie = pcie->cdns_pcie;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  642  	struct device *dev = &pdev->dev;
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  643  	struct cdns_pcie_ep *ep;
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  644  	struct cdns_pcie_rc *rc;
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  645  
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  646  	if (pcie->mode == PCI_MODE_RC) {
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  647  		rc = container_of(cdns_pcie, struct cdns_pcie_rc, pcie);
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17 @648  		cdns_pcie_host_disable(rc);
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  649  	} else {
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  650  		ep = container_of(cdns_pcie, struct cdns_pcie_ep, pcie);
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  651  		cdns_pcie_ep_disable(ep);
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  652  	}
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  653  
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  654  	gpiod_set_value_cansleep(pcie->reset_gpio, 0);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  655  
49e0efdce79125 Kishon Vijay Abraham I 2021-03-08  656  	clk_disable_unprepare(pcie->refclk);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  657  	cdns_pcie_disable_phy(cdns_pcie);
a2790bf81f0f7b Siddharth Vadapalli    2025-04-17  658  	j721e_pcie_disable_link_irq(pcie);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  659  	pm_runtime_put(dev);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  660  	pm_runtime_disable(dev);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  661  }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22  662  

:::::: The code at line 648 was first introduced by commit
:::::: a2790bf81f0f7b0fb683204cd3bef07feecb9958 PCI: j721e: Add support to build as a loadable module

:::::: TO: Siddharth Vadapalli <[email protected]> :::::: CC: Bjorn Helgaas <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw

+ Siddharth

Quoted 8 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4427259cc7f7571a157fbc9b5011e1ef6fe0a4a8
commit: 1c72774df028429836eec3394212f2921bb830fc PCI: sg2042: Add Sophgo SG2042 PCIe driver
date:   8 weeks ago
config: loongarch-randconfig-r113-20251110 (https://download.01.org/0day-ci/archive/20251111/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251111/[email protected]/reproduce)
Quoted 10 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

loongarch64-linux-ld: drivers/pci/controller/cadence/pci-j721e.o: in function `j721e_pcie_remove':

Quoted 1 line
Quoted 1 line

drivers/pci/controller/cadence/pci-j721e.c:648:(.text+0x83c): undefined reference to `cdns_pcie_host_disable'

From .config:

CONFIG_PCIE_CADENCE=y
CONFIG_PCIE_CADENCE_HOST=m
CONFIG_PCIE_CADENCE_EP=y
CONFIG_PCIE_CADENCE_PLAT=y
# CONFIG_PCIE_CADENCE_PLAT_HOST is not set
CONFIG_PCIE_CADENCE_PLAT_EP=y
CONFIG_PCIE_SG2042_HOST=m
CONFIG_PCI_J721E=y
# CONFIG_PCI_J721E_HOST is not set
CONFIG_PCI_J721E_EP=y

PCI_J721E selects PCIE_CADENCE_HOST only if PCI_J721E_HOST is selected, otherwise, it will not select it. This will take care of the dependency between PCI_J721E and PCIE_CADENCE_{HOST/EP}.

But if PCIE_CADENCE_HOST is selected as a module by other drivers like, CONFIG_PCIE_SG2042_HOST=m, then if PCI_J721E is selected as a built-in using CONFIG_PCI_J721E_EP=y, it results in this build error as the built-in driver becomes dependent on a symbol from a loadable module.

I guess, we should force PCIE_CADENCE_{HOST/EP} to be 'bool' as it is getting selected by multiple drivers.

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#2 lore raw

On Tue, 2025-11-11 at 16:24 +0530, Manivannan Sadhasivam wrote:

Hello Mani,

Quoted 1 line

+ Siddharth

Thank you for notifying me of this.

Quoted 34 lines · kernel test robot
Quoted 8 lines
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4427259cc7f7571a157fbc9b5011e1ef6fe0a4a8
commit: 1c72774df028429836eec3394212f2921bb830fc PCI: sg2042: Add Sophgo SG2042 PCIe driver
date:   8 weeks ago
config: loongarch-randconfig-r113-20251110 (https://download.01.org/0day-ci/archive/20251111/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251111/[email protected]/reproduce)
Quoted 10 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

Quoted 2 lines

All errors (new ones prefixed by >>):

loongarch64-linux-ld: drivers/pci/controller/cadence/pci-j721e.o: in function `j721e_pcie_remove':

Quoted 1 line
Quoted 1 line

drivers/pci/controller/cadence/pci-j721e.c:648:(.text+0x83c): undefined reference to `cdns_pcie_host_disable'

From .config:

CONFIG_PCIE_CADENCE=y
CONFIG_PCIE_CADENCE_HOST=m
CONFIG_PCIE_CADENCE_EP=y
CONFIG_PCIE_CADENCE_PLAT=y
# CONFIG_PCIE_CADENCE_PLAT_HOST is not set
CONFIG_PCIE_CADENCE_PLAT_EP=y
CONFIG_PCIE_SG2042_HOST=m
CONFIG_PCI_J721E=y
# CONFIG_PCI_J721E_HOST is not set
CONFIG_PCI_J721E_EP=y

Quoted 8 lines

PCI_J721E selects PCIE_CADENCE_HOST only if PCI_J721E_HOST is selected, otherwise, it will not select it. This will take care of the dependency between PCI_J721E and PCIE_CADENCE_{HOST/EP}.

But if PCIE_CADENCE_HOST is selected as a module by other drivers like, CONFIG_PCIE_SG2042_HOST=m, then if PCI_J721E is selected as a built-in using CONFIG_PCI_J721E_EP=y, it results in this build error as the built-in driver becomes dependent on a symbol from a loadable module.

While I don't deny the build error associated with the above config, it is an invalid config in the sense that the Glue drivers for two different devices are being enabled. This seems to be a generic issue wherein multiple drivers tend to depend on a library/common driver. How is it handled in such cases?
Is there a notion of reordering configs to ensure that such build errors are avoided?

If PCI_J721E_EP was selected as 'y' before 'PCI_SG2042_HOST' being selected as 'm', it would have resulted in 'PCIE_CADENCE_EP' being selected as 'y' and this won't cause a build error even with 'PCI_SG2042_HOST' selected as 'm'.

Quoted 3 lines

I guess, we should force PCIE_CADENCE_{HOST/EP} to be 'bool' as it is getting selected by multiple drivers.

This will defeat the purpose of the series that enabled loadable module support for the pci-j721e.c driver and the pcie-cadence-host/ep.c drivers.

Is there a way to address the issue by updating Kconfig? Specifically, is there a way to re-order the 'select' scheme to fix the build error?

Regards,
Siddharth.

#3 lore raw
Quoted 51 lines · Siddharth Vadapalli

On Tue, 2025-11-11 at 16:24 +0530, Manivannan Sadhasivam wrote:

Hello Mani,

Quoted 1 line

+ Siddharth

Thank you for notifying me of this.

Quoted 34 lines · kernel test robot
Quoted 8 lines
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4427259cc7f7571a157fbc9b5011e1ef6fe0a4a8
commit: 1c72774df028429836eec3394212f2921bb830fc PCI: sg2042: Add Sophgo SG2042 PCIe driver
date:   8 weeks ago
config: loongarch-randconfig-r113-20251110 (https://download.01.org/0day-ci/archive/20251111/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251111/[email protected]/reproduce)
Quoted 10 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

Quoted 2 lines

All errors (new ones prefixed by >>):

loongarch64-linux-ld: drivers/pci/controller/cadence/pci-j721e.o: in function `j721e_pcie_remove':

Quoted 1 line
Quoted 1 line

drivers/pci/controller/cadence/pci-j721e.c:648:(.text+0x83c): undefined reference to `cdns_pcie_host_disable'

From .config:

CONFIG_PCIE_CADENCE=y
CONFIG_PCIE_CADENCE_HOST=m
CONFIG_PCIE_CADENCE_EP=y
CONFIG_PCIE_CADENCE_PLAT=y
# CONFIG_PCIE_CADENCE_PLAT_HOST is not set
CONFIG_PCIE_CADENCE_PLAT_EP=y
CONFIG_PCIE_SG2042_HOST=m
CONFIG_PCI_J721E=y
# CONFIG_PCI_J721E_HOST is not set
CONFIG_PCI_J721E_EP=y

Quoted 8 lines

PCI_J721E selects PCIE_CADENCE_HOST only if PCI_J721E_HOST is selected, otherwise, it will not select it. This will take care of the dependency between PCI_J721E and PCIE_CADENCE_{HOST/EP}.

But if PCIE_CADENCE_HOST is selected as a module by other drivers like, CONFIG_PCIE_SG2042_HOST=m, then if PCI_J721E is selected as a built-in using CONFIG_PCI_J721E_EP=y, it results in this build error as the built-in driver becomes dependent on a symbol from a loadable module.

Quoted 5 lines

While I don't deny the build error associated with the above config, it is an invalid config in the sense that the Glue drivers for two different devices are being enabled. This seems to be a generic issue wherein multiple drivers tend to depend on a library/common driver. How is it handled in such cases?

AFAIK, the common library should be built-in to avoid issues like this.

Quoted 9 lines

Is there a notion of reordering configs to ensure that such build errors are avoided?

If PCI_J721E_EP was selected as 'y' before 'PCI_SG2042_HOST' being selected as 'm', it would have resulted in 'PCIE_CADENCE_EP' being selected as 'y' and this won't cause a build error even with 'PCI_SG2042_HOST' selected as 'm'.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

I guess, we should force PCIE_CADENCE_{HOST/EP} to be 'bool' as it is getting selected by multiple drivers.

This will defeat the purpose of the series that enabled loadable module support for the pci-j721e.c driver and the pcie-cadence-host/ep.c drivers.

Your 'pci-j721e.c' can still be a loadable module, only the common library will be built-in, which is not that bad.

Quoted 3 lines

Is there a way to address the issue by updating Kconfig? Specifically, is there a way to re-order the 'select' scheme to fix the build error?

Not that I'm aware of atm.

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#4 lore raw
Quoted 52 lines · Manivannan Sadhasivam
Quoted 51 lines · Siddharth Vadapalli

On Tue, 2025-11-11 at 16:24 +0530, Manivannan Sadhasivam wrote:

Hello Mani,

Quoted 1 line

+ Siddharth

Thank you for notifying me of this.

Quoted 42 lines · kernel test robot
Quoted 8 lines
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4427259cc7f7571a157fbc9b5011e1ef6fe0a4a8
commit: 1c72774df028429836eec3394212f2921bb830fc PCI: sg2042: Add Sophgo SG2042 PCIe driver
date:   8 weeks ago
config: loongarch-randconfig-r113-20251110 (https://download.01.org/0day-ci/archive/20251111/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251111/[email protected]/reproduce)
Quoted 10 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

Quoted 2 lines

All errors (new ones prefixed by >>):

loongarch64-linux-ld: drivers/pci/controller/cadence/pci-j721e.o: in function `j721e_pcie_remove':

Quoted 1 line
Quoted 1 line

drivers/pci/controller/cadence/pci-j721e.c:648:(.text+0x83c): undefined reference to `cdns_pcie_host_disable'

From .config:

CONFIG_PCIE_CADENCE=y
CONFIG_PCIE_CADENCE_HOST=m
CONFIG_PCIE_CADENCE_EP=y
CONFIG_PCIE_CADENCE_PLAT=y
# CONFIG_PCIE_CADENCE_PLAT_HOST is not set
CONFIG_PCIE_CADENCE_PLAT_EP=y
CONFIG_PCIE_SG2042_HOST=m
CONFIG_PCI_J721E=y
# CONFIG_PCI_J721E_HOST is not set
CONFIG_PCI_J721E_EP=y

PCI_J721E selects PCIE_CADENCE_HOST only if PCI_J721E_HOST is selected, otherwise, it will not select it. This will take care of the dependency between PCI_J721E and PCIE_CADENCE_{HOST/EP}.

But if PCIE_CADENCE_HOST is selected as a module by other drivers like, CONFIG_PCIE_SG2042_HOST=m, then if PCI_J721E is selected as a built-in using CONFIG_PCI_J721E_EP=y, it results in this build error as the built-in driver becomes dependent on a symbol from a loadable module.

Quoted 7 lines
Quoted 5 lines

While I don't deny the build error associated with the above config, it is an invalid config in the sense that the Glue drivers for two different devices are being enabled. This seems to be a generic issue wherein multiple drivers tend to depend on a library/common driver. How is it handled in such cases?

AFAIK, the common library should be built-in to avoid issues like this.

Ok. If that is the usual approach then I have no objections to it.

Quoted 13 lines
Quoted 13 lines

Is there a notion of reordering configs to ensure that such build errors are avoided?

If PCI_J721E_EP was selected as 'y' before 'PCI_SG2042_HOST' being selected as 'm', it would have resulted in 'PCIE_CADENCE_EP' being selected as 'y' and this won't cause a build error even with 'PCI_SG2042_HOST' selected as 'm'.

Quoted 3 lines

I guess, we should force PCIE_CADENCE_{HOST/EP} to be 'bool' as it is getting selected by multiple drivers.

Quoted 6 lines
Quoted 3 lines

This will defeat the purpose of the series that enabled loadable module support for the pci-j721e.c driver and the pcie-cadence-host/ep.c drivers.

Your 'pci-j721e.c' can still be a loadable module, only the common library will be built-in, which is not that bad.

Yes, this will work.

Please let me know if you want me to post the patch to update CONFIG_PCIE_CADENCE_{EP/HOST} to a bool.

Regards,
Siddharth.

#5 lore raw
Quoted 80 lines · Siddharth Vadapalli
Quoted 52 lines · Manivannan Sadhasivam
Quoted 51 lines · Siddharth Vadapalli

On Tue, 2025-11-11 at 16:24 +0530, Manivannan Sadhasivam wrote:

Hello Mani,

Quoted 1 line

+ Siddharth

Thank you for notifying me of this.

Quoted 42 lines · kernel test robot
Quoted 8 lines
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4427259cc7f7571a157fbc9b5011e1ef6fe0a4a8
commit: 1c72774df028429836eec3394212f2921bb830fc PCI: sg2042: Add Sophgo SG2042 PCIe driver
date:   8 weeks ago
config: loongarch-randconfig-r113-20251110 (https://download.01.org/0day-ci/archive/20251111/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251111/[email protected]/reproduce)
Quoted 10 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

Quoted 2 lines

All errors (new ones prefixed by >>):

loongarch64-linux-ld: drivers/pci/controller/cadence/pci-j721e.o: in function `j721e_pcie_remove':

Quoted 1 line
Quoted 1 line

drivers/pci/controller/cadence/pci-j721e.c:648:(.text+0x83c): undefined reference to `cdns_pcie_host_disable'

From .config:

CONFIG_PCIE_CADENCE=y
CONFIG_PCIE_CADENCE_HOST=m
CONFIG_PCIE_CADENCE_EP=y
CONFIG_PCIE_CADENCE_PLAT=y
# CONFIG_PCIE_CADENCE_PLAT_HOST is not set
CONFIG_PCIE_CADENCE_PLAT_EP=y
CONFIG_PCIE_SG2042_HOST=m
CONFIG_PCI_J721E=y
# CONFIG_PCI_J721E_HOST is not set
CONFIG_PCI_J721E_EP=y

PCI_J721E selects PCIE_CADENCE_HOST only if PCI_J721E_HOST is selected, otherwise, it will not select it. This will take care of the dependency between PCI_J721E and PCIE_CADENCE_{HOST/EP}.

But if PCIE_CADENCE_HOST is selected as a module by other drivers like, CONFIG_PCIE_SG2042_HOST=m, then if PCI_J721E is selected as a built-in using CONFIG_PCI_J721E_EP=y, it results in this build error as the built-in driver becomes dependent on a symbol from a loadable module.

Quoted 7 lines
Quoted 5 lines

While I don't deny the build error associated with the above config, it is an invalid config in the sense that the Glue drivers for two different devices are being enabled. This seems to be a generic issue wherein multiple drivers tend to depend on a library/common driver. How is it handled in such cases?

AFAIK, the common library should be built-in to avoid issues like this.

Ok. If that is the usual approach then I have no objections to it.

Quoted 17 lines
Quoted 16 lines

Is there a notion of reordering configs to ensure that such build errors are avoided?

If PCI_J721E_EP was selected as 'y' before 'PCI_SG2042_HOST' being selected as 'm', it would have resulted in 'PCIE_CADENCE_EP' being selected as 'y' and this won't cause a build error even with 'PCI_SG2042_HOST' selected as 'm'.

Quoted 3 lines

I guess, we should force PCIE_CADENCE_{HOST/EP} to be 'bool' as it is getting selected by multiple drivers.

This will defeat the purpose of the series that enabled loadable module support for the pci-j721e.c driver and the pcie-cadence-host/ep.c drivers.

Quoted 8 lines
Quoted 2 lines

Your 'pci-j721e.c' can still be a loadable module, only the common library will be built-in, which is not that bad.

Yes, this will work.

Please let me know if you want me to post the patch to update CONFIG_PCIE_CADENCE_{EP/HOST} to a bool.

Yes, please.

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#6 lore raw
Quoted 84 lines · Manivannan Sadhasivam
Quoted 83 lines · Siddharth Vadapalli
Quoted 52 lines · Manivannan Sadhasivam
Quoted 51 lines · Siddharth Vadapalli

On Tue, 2025-11-11 at 16:24 +0530, Manivannan Sadhasivam wrote:

Hello Mani,

Quoted 1 line

+ Siddharth

Thank you for notifying me of this.

Quoted 42 lines · kernel test robot
Quoted 8 lines
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4427259cc7f7571a157fbc9b5011e1ef6fe0a4a8
commit: 1c72774df028429836eec3394212f2921bb830fc PCI: sg2042: Add Sophgo SG2042 PCIe driver
date:   8 weeks ago
config: loongarch-randconfig-r113-20251110 (https://download.01.org/0day-ci/archive/20251111/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251111/[email protected]/reproduce)
Quoted 10 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

Quoted 2 lines

All errors (new ones prefixed by >>):

loongarch64-linux-ld: drivers/pci/controller/cadence/pci-j721e.o: in function `j721e_pcie_remove':

Quoted 1 line
Quoted 1 line

drivers/pci/controller/cadence/pci-j721e.c:648:(.text+0x83c): undefined reference to `cdns_pcie_host_disable'

From .config:

CONFIG_PCIE_CADENCE=y
CONFIG_PCIE_CADENCE_HOST=m
CONFIG_PCIE_CADENCE_EP=y
CONFIG_PCIE_CADENCE_PLAT=y
# CONFIG_PCIE_CADENCE_PLAT_HOST is not set
CONFIG_PCIE_CADENCE_PLAT_EP=y
CONFIG_PCIE_SG2042_HOST=m
CONFIG_PCI_J721E=y
# CONFIG_PCI_J721E_HOST is not set
CONFIG_PCI_J721E_EP=y

PCI_J721E selects PCIE_CADENCE_HOST only if PCI_J721E_HOST is selected, otherwise, it will not select it. This will take care of the dependency between PCI_J721E and PCIE_CADENCE_{HOST/EP}.

But if PCIE_CADENCE_HOST is selected as a module by other drivers like, CONFIG_PCIE_SG2042_HOST=m, then if PCI_J721E is selected as a built-in using CONFIG_PCI_J721E_EP=y, it results in this build error as the built-in driver becomes dependent on a symbol from a loadable module.

Quoted 7 lines
Quoted 5 lines

While I don't deny the build error associated with the above config, it is an invalid config in the sense that the Glue drivers for two different devices are being enabled. This seems to be a generic issue wherein multiple drivers tend to depend on a library/common driver. How is it handled in such cases?

AFAIK, the common library should be built-in to avoid issues like this.

Ok. If that is the usual approach then I have no objections to it.

Quoted 19 lines
Quoted 10 lines

Is there a notion of reordering configs to ensure that such build errors are avoided?

If PCI_J721E_EP was selected as 'y' before 'PCI_SG2042_HOST' being selected as 'm', it would have resulted in 'PCIE_CADENCE_EP' being selected as 'y' and this won't cause a build error even with 'PCI_SG2042_HOST' selected as 'm'.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

I guess, we should force PCIE_CADENCE_{HOST/EP} to be 'bool' as it is getting selected by multiple drivers.

This will defeat the purpose of the series that enabled loadable module support for the pci-j721e.c driver and the pcie-cadence-host/ep.c drivers.

Your 'pci-j721e.c' can still be a loadable module, only the common library will be built-in, which is not that bad.

Quoted 7 lines
Quoted 5 lines

Yes, this will work.

Please let me know if you want me to post the patch to update CONFIG_PCIE_CADENCE_{EP/HOST} to a bool.

Yes, please.

I have posted the patch at:
https://lore.kernel.org/r/[email protected]

Regards,
Siddharth.