linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add support to build pci-j721e as a module.
@ 2023-01-08 15:57 Achal Verma
  2023-01-08 15:57 ` [PATCH v2 1/2] PCI: cadence: Add support to build pcie-cadence library as module Achal Verma
  2023-01-08 15:57 ` [PATCH v2 2/2] PCI: j721e: Add support to build pci-j721e " Achal Verma
  0 siblings, 2 replies; 6+ messages in thread
From: Achal Verma @ 2023-01-08 15:57 UTC (permalink / raw)
  To: Tom Joseph, Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczy_ski,
	Bjorn Helgaas, Vignesh Raghavendra
  Cc: linux-pci, linux-kernel, linux-omap, linux-arm-kernel,
	Achal Verma, Milind Parab

Patch series to add support to build pci-j721e as module.
It requires pcie-cadence library to be built as a module too.

Changes from v1 to v2:
*)Resolve build failure of pci-j721e.o module because of its dependency 
  on pcie-cadence-host.o in following configuration as 
  Reported-by: kernel test robot <lkp@intel.com>

  CONFIG_PCIE_CADENCE=y
  CONFIG_PCIE_CADENCE_HOST=m
  CONFIG_PCIE_CADENCE_EP=y
  CONFIG_PCIE_CADENCE_PLAT=y
  CONFIG_PCIE_CADENCE_PLAT_EP=y
  CONFIG_PCI_J721E=y
  CONFIG_PCI_J721E_HOST=m
  CONFIG_PCI_J721E_EP=y

Achal Verma (2):
  PCI: cadence: Add support to build pcie-cadence library as module.
  PCI: j721e: Add support to build pci-j721e as module.

 drivers/pci/controller/cadence/Kconfig           | 16 ++++++++--------
 drivers/pci/controller/cadence/pci-j721e.c       |  6 +++++-
 drivers/pci/controller/cadence/pcie-cadence-ep.c |  4 ++++
 .../pci/controller/cadence/pcie-cadence-host.c   |  5 +++++
 drivers/pci/controller/cadence/pcie-cadence.c    |  9 +++++++++
 drivers/pci/controller/cadence/pcie-cadence.h    |  4 ++--
 6 files changed, 33 insertions(+), 11 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] PCI: cadence: Add support to build pcie-cadence library as module.
  2023-01-08 15:57 [PATCH v2 0/2] Add support to build pci-j721e as a module Achal Verma
@ 2023-01-08 15:57 ` Achal Verma
  2023-01-08 15:57 ` [PATCH v2 2/2] PCI: j721e: Add support to build pci-j721e " Achal Verma
  1 sibling, 0 replies; 6+ messages in thread
From: Achal Verma @ 2023-01-08 15:57 UTC (permalink / raw)
  To: Tom Joseph, Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczy_ski,
	Bjorn Helgaas, Vignesh Raghavendra
  Cc: linux-pci, linux-kernel, linux-omap, linux-arm-kernel,
	Achal Verma, Milind Parab

Add support to build pcie-cadence library as module.

Signed-off-by: Achal Verma <a-verma1@ti.com>
---
 drivers/pci/controller/cadence/Kconfig             | 6 +++---
 drivers/pci/controller/cadence/pcie-cadence-ep.c   | 4 ++++
 drivers/pci/controller/cadence/pcie-cadence-host.c | 5 +++++
 drivers/pci/controller/cadence/pcie-cadence.c      | 9 +++++++++
 drivers/pci/controller/cadence/pcie-cadence.h      | 4 ++--
 5 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/controller/cadence/Kconfig b/drivers/pci/controller/cadence/Kconfig
index 5d30564190e1..693c41fe32ce 100644
--- a/drivers/pci/controller/cadence/Kconfig
+++ b/drivers/pci/controller/cadence/Kconfig
@@ -4,16 +4,16 @@ menu "Cadence PCIe controllers support"
 	depends on PCI
 
 config PCIE_CADENCE
-	bool
+	tristate
 
 config PCIE_CADENCE_HOST
-	bool
+	tristate
 	depends on OF
 	select IRQ_DOMAIN
 	select PCIE_CADENCE
 
 config PCIE_CADENCE_EP
-	bool
+	tristate
 	depends on OF
 	depends on PCI_ENDPOINT
 	select PCIE_CADENCE
diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c
index b8b655d4047e..598b2b9c5969 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-ep.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c
@@ -5,6 +5,7 @@
 
 #include <linux/delay.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/pci-epc.h>
 #include <linux/platform_device.h>
@@ -741,3 +742,6 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(cdns_pcie_ep_setup);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c
index 940c7dd701d6..84754c63df34 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-host.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-host.c
@@ -5,6 +5,7 @@
 
 #include <linux/delay.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/list_sort.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
@@ -70,6 +71,7 @@ void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int devfn,
 
 	return rc->cfg_base + (where & 0xfff);
 }
+EXPORT_SYMBOL_GPL(cdns_pci_map_bus);
 
 static struct pci_ops cdns_pcie_host_ops = {
 	.map_bus	= cdns_pci_map_bus,
@@ -542,3 +544,6 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(cdns_pcie_host_setup);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/controller/cadence/pcie-cadence.c b/drivers/pci/controller/cadence/pcie-cadence.c
index 13c4032ca379..8e3a86578284 100644
--- a/drivers/pci/controller/cadence/pcie-cadence.c
+++ b/drivers/pci/controller/cadence/pcie-cadence.c
@@ -4,6 +4,7 @@
 // Author: Cyrille Pitchen <cyrille.pitchen@free-electrons.com>
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 
 #include "pcie-cadence.h"
 
@@ -22,6 +23,7 @@ void cdns_pcie_detect_quiet_min_delay_set(struct cdns_pcie *pcie)
 
 	cdns_pcie_writel(pcie, CDNS_PCIE_LTSSM_CONTROL_CAP, ltssm_control_cap);
 }
+EXPORT_SYMBOL_GPL(cdns_pcie_detect_quiet_min_delay_set);
 
 void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 busnr, u8 fn,
 				   u32 r, bool is_io,
@@ -99,6 +101,7 @@ void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 busnr, u8 fn,
 	cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR0(r), addr0);
 	cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR1(r), addr1);
 }
+EXPORT_SYMBOL_GPL(cdns_pcie_set_outbound_region);
 
 void cdns_pcie_set_outbound_region_for_normal_msg(struct cdns_pcie *pcie,
 						  u8 busnr, u8 fn,
@@ -133,6 +136,7 @@ void cdns_pcie_set_outbound_region_for_normal_msg(struct cdns_pcie *pcie,
 	cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR0(r), addr0);
 	cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR1(r), addr1);
 }
+EXPORT_SYMBOL_GPL(cdns_pcie_set_outbound_region_for_normal_msg);
 
 void cdns_pcie_reset_outbound_region(struct cdns_pcie *pcie, u32 r)
 {
@@ -145,6 +149,7 @@ void cdns_pcie_reset_outbound_region(struct cdns_pcie *pcie, u32 r)
 	cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR0(r), 0);
 	cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR1(r), 0);
 }
+EXPORT_SYMBOL_GPL(cdns_pcie_reset_outbound_region);
 
 void cdns_pcie_disable_phy(struct cdns_pcie *pcie)
 {
@@ -155,6 +160,7 @@ void cdns_pcie_disable_phy(struct cdns_pcie *pcie)
 		phy_exit(pcie->phy[i]);
 	}
 }
+EXPORT_SYMBOL_GPL(cdns_pcie_disable_phy);
 
 int cdns_pcie_enable_phy(struct cdns_pcie *pcie)
 {
@@ -242,6 +248,7 @@ int cdns_pcie_init_phy(struct device *dev, struct cdns_pcie *pcie)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(cdns_pcie_init_phy);
 
 static int cdns_pcie_suspend_noirq(struct device *dev)
 {
@@ -270,3 +277,5 @@ const struct dev_pm_ops cdns_pcie_pm_ops = {
 	NOIRQ_SYSTEM_SLEEP_PM_OPS(cdns_pcie_suspend_noirq,
 				  cdns_pcie_resume_noirq)
 };
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/controller/cadence/pcie-cadence.h b/drivers/pci/controller/cadence/pcie-cadence.h
index 190786e47df9..65b330c28299 100644
--- a/drivers/pci/controller/cadence/pcie-cadence.h
+++ b/drivers/pci/controller/cadence/pcie-cadence.h
@@ -514,7 +514,7 @@ static inline bool cdns_pcie_link_up(struct cdns_pcie *pcie)
 	return true;
 }
 
-#ifdef CONFIG_PCIE_CADENCE_HOST
+#if IS_ENABLED(CONFIG_PCIE_CADENCE_HOST)
 int cdns_pcie_host_setup(struct cdns_pcie_rc *rc);
 void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int devfn,
 			       int where);
@@ -531,7 +531,7 @@ static inline void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int d
 }
 #endif
 
-#ifdef CONFIG_PCIE_CADENCE_EP
+#if IS_ENABLED(CONFIG_PCIE_CADENCE_EP)
 int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep);
 #else
 static inline int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] PCI: j721e: Add support to build pci-j721e as module.
  2023-01-08 15:57 [PATCH v2 0/2] Add support to build pci-j721e as a module Achal Verma
  2023-01-08 15:57 ` [PATCH v2 1/2] PCI: cadence: Add support to build pcie-cadence library as module Achal Verma
@ 2023-01-08 15:57 ` Achal Verma
  2023-01-09  3:53   ` Vignesh Raghavendra
  1 sibling, 1 reply; 6+ messages in thread
From: Achal Verma @ 2023-01-08 15:57 UTC (permalink / raw)
  To: Tom Joseph, Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczy_ski,
	Bjorn Helgaas, Vignesh Raghavendra
  Cc: linux-pci, linux-kernel, linux-omap, linux-arm-kernel,
	Achal Verma, Milind Parab

Add support to build pci-j721e as module.

Signed-off-by: Achal Verma <a-verma1@ti.com>
---
 drivers/pci/controller/cadence/Kconfig     | 10 +++++-----
 drivers/pci/controller/cadence/pci-j721e.c |  6 +++++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/cadence/Kconfig b/drivers/pci/controller/cadence/Kconfig
index 693c41fe32ce..51edf723586c 100644
--- a/drivers/pci/controller/cadence/Kconfig
+++ b/drivers/pci/controller/cadence/Kconfig
@@ -43,12 +43,13 @@ config PCIE_CADENCE_PLAT_EP
 	  different vendors SoCs.
 
 config PCI_J721E
-	bool
+	tristate
+	select PCIE_CADENCE_HOST
+	select PCIE_CADENCE_EP
 
 config PCI_J721E_HOST
-	bool "TI J721E PCIe platform host controller"
+	tristate "TI J721E PCIe platform host controller"
 	depends on OF
-	select PCIE_CADENCE_HOST
 	select PCI_J721E
 	help
 	  Say Y here if you want to support the TI J721E PCIe platform
@@ -56,10 +57,9 @@ config PCI_J721E_HOST
 	  core.
 
 config PCI_J721E_EP
-	bool "TI J721E PCIe platform endpoint controller"
+	tristate "TI J721E PCIe platform endpoint controller"
 	depends on OF
 	depends on PCI_ENDPOINT
-	select PCIE_CADENCE_EP
 	select PCI_J721E
 	help
 	  Say Y here if you want to support the TI J721E PCIe platform
diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
index cc83a8925ce0..c4017fa6ae61 100644
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -13,6 +13,7 @@
 #include <linux/irqchip/chained_irq.h>
 #include <linux/irqdomain.h>
 #include <linux/mfd/syscon.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/pci.h>
@@ -565,4 +566,7 @@ static struct platform_driver j721e_pcie_driver = {
 		.suppress_bind_attrs = true,
 	},
 };
-builtin_platform_driver(j721e_pcie_driver);
+module_platform_driver(j721e_pcie_driver);
+
+MODULE_AUTHOR("Kishon Vijay Abraham I <kishon@ti.com>");
+MODULE_LICENSE("GPL v2");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] PCI: j721e: Add support to build pci-j721e as module.
  2023-01-08 15:57 ` [PATCH v2 2/2] PCI: j721e: Add support to build pci-j721e " Achal Verma
@ 2023-01-09  3:53   ` Vignesh Raghavendra
       [not found]     ` <20230109123550.GA2647927@desktop-3598>
  0 siblings, 1 reply; 6+ messages in thread
From: Vignesh Raghavendra @ 2023-01-09  3:53 UTC (permalink / raw)
  To: Achal Verma, Tom Joseph, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczy_ski, Bjorn Helgaas
  Cc: linux-pci, linux-kernel, linux-omap, linux-arm-kernel, Milind Parab

Hi Achal,

On 08/01/23 21:27, Achal Verma wrote:
> Add support to build pci-j721e as module.
> 
> Signed-off-by: Achal Verma <a-verma1@ti.com>
> ---
>  drivers/pci/controller/cadence/Kconfig     | 10 +++++-----
>  drivers/pci/controller/cadence/pci-j721e.c |  6 +++++-
>  2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/controller/cadence/Kconfig b/drivers/pci/controller/cadence/Kconfig
> index 693c41fe32ce..51edf723586c 100644
> --- a/drivers/pci/controller/cadence/Kconfig
> +++ b/drivers/pci/controller/cadence/Kconfig
> @@ -43,12 +43,13 @@ config PCIE_CADENCE_PLAT_EP
>  	  different vendors SoCs.
>  
>  config PCI_J721E
> -	bool
> +	tristate
> +	select PCIE_CADENCE_HOST
> +	select PCIE_CADENCE_EP
>  

Please don't use select when symbol being selected, depends on
additional configs

Documentation/kbuild/kconfig-language.rst::

select should be used with care. select will force
a symbol to a value without visiting the dependencies.
By abusing select you are able to select a symbol FOO even
if FOO depends on BAR that is not set.


>  config PCI_J721E_HOST
> -	bool "TI J721E PCIe platform host controller"
> +	tristate "TI J721E PCIe platform host controller"
>  	depends on OF
> -	select PCIE_CADENCE_HOST
>  	select PCI_J721E
>  	help
>  	  Say Y here if you want to support the TI J721E PCIe platform
> @@ -56,10 +57,9 @@ config PCI_J721E_HOST
>  	  core.
>  
>  config PCI_J721E_EP
> -	bool "TI J721E PCIe platform endpoint controller"
> +	tristate "TI J721E PCIe platform endpoint controller"
>  	depends on OF
>  	depends on PCI_ENDPOINT
> -	select PCIE_CADENCE_EP
>  	select PCI_J721E
>  	help
>  	  Say Y here if you want to support the TI J721E PCIe platform
> diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
> index cc83a8925ce0..c4017fa6ae61 100644
> --- a/drivers/pci/controller/cadence/pci-j721e.c
> +++ b/drivers/pci/controller/cadence/pci-j721e.c
> @@ -13,6 +13,7 @@
>  #include <linux/irqchip/chained_irq.h>
>  #include <linux/irqdomain.h>
>  #include <linux/mfd/syscon.h>
> +#include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
>  #include <linux/pci.h>
> @@ -565,4 +566,7 @@ static struct platform_driver j721e_pcie_driver = {
>  		.suppress_bind_attrs = true,
>  	},
>  };
> -builtin_platform_driver(j721e_pcie_driver);
> +module_platform_driver(j721e_pcie_driver);
> +
> +MODULE_AUTHOR("Kishon Vijay Abraham I <kishon@ti.com>");
> +MODULE_LICENSE("GPL v2");

-- 
Regards
Vignesh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] PCI: j721e: Add support to build pci-j721e as module.
       [not found]     ` <20230109123550.GA2647927@desktop-3598>
@ 2023-01-09 15:36       ` Vignesh Raghavendra
  2023-01-10 15:38         ` Bjorn Helgaas
  0 siblings, 1 reply; 6+ messages in thread
From: Vignesh Raghavendra @ 2023-01-09 15:36 UTC (permalink / raw)
  To: Achal Verma
  Cc: Tom Joseph, Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczy_ski,
	Bjorn Helgaas, linux-pci, linux-kernel, linux-omap,
	linux-arm-kernel, Milind Parab



On 09/01/23 6:05 pm, Achal Verma wrote:
> Discussed with Vignesh the current config dependency of pcie-cadence and pci-j721e modules,
> it seems like for now to modularize these drivers with minimal changes is to use "select"
> as they were used before in PCI_J721E_HOST and PCI_J721E_EP config options.
> 

With this patch its now impossible to build PCI_J721E_HOST without
pcie endpoint support (as PCI_ENDPOINT is now a dependency). I don't
know a way to achieve this via Kconfig magic w/o splitting pci-j721e.c
into EP/RC (like pcie-rcar* or pcie-rockchip*)


> Will push updated version with "depends on PCI_ENDPOINT" in PCI_J721E config to check
> dependency on PCI_ENDPOINT before selecting PCIE_CADENCE_EP.
> 

Please don't top post and respond inline:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

Regards
Vignesh

[...]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] PCI: j721e: Add support to build pci-j721e as module.
  2023-01-09 15:36       ` Vignesh Raghavendra
@ 2023-01-10 15:38         ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2023-01-10 15:38 UTC (permalink / raw)
  To: Vignesh Raghavendra
  Cc: Achal Verma, Tom Joseph, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczy_ski, Bjorn Helgaas, linux-pci, linux-kernel,
	linux-omap, linux-arm-kernel, Milind Parab

On Mon, Jan 09, 2023 at 09:06:14PM +0530, Vignesh Raghavendra wrote:
> On 09/01/23 6:05 pm, Achal Verma wrote:
> > Discussed with Vignesh the current config dependency of pcie-cadence and pci-j721e modules,
> > it seems like for now to modularize these drivers with minimal changes is to use "select"
> > as they were used before in PCI_J721E_HOST and PCI_J721E_EP config options.
> 
> With this patch its now impossible to build PCI_J721E_HOST without
> pcie endpoint support (as PCI_ENDPOINT is now a dependency). I don't
> know a way to achieve this via Kconfig magic w/o splitting pci-j721e.c
> into EP/RC (like pcie-rcar* or pcie-rockchip*)
> 
> > Will push updated version with "depends on PCI_ENDPOINT" in PCI_J721E config to check
> > dependency on PCI_ENDPOINT before selecting PCIE_CADENCE_EP.
> > 
> 
> Please don't top post and respond inline:
> https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

Apparently there was also email from Achal to Vignesh that didn't make
it to the archives, probably because it was HTML or other "fancy"
email.  See the thread overview here, which is missing something:
https://lore.kernel.org/all/20230108155755.2614147-1-a-verma1@ti.com/

It's best to use plain text email when possible.  See
http://vger.kernel.org/majordomo-info.html for details.

Bjorn

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-10 15:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-08 15:57 [PATCH v2 0/2] Add support to build pci-j721e as a module Achal Verma
2023-01-08 15:57 ` [PATCH v2 1/2] PCI: cadence: Add support to build pcie-cadence library as module Achal Verma
2023-01-08 15:57 ` [PATCH v2 2/2] PCI: j721e: Add support to build pci-j721e " Achal Verma
2023-01-09  3:53   ` Vignesh Raghavendra
     [not found]     ` <20230109123550.GA2647927@desktop-3598>
2023-01-09 15:36       ` Vignesh Raghavendra
2023-01-10 15:38         ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).