linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] dma/ti: enable udma and psil to be built as modules
@ 2022-09-26 18:18 Kevin Hilman
  2022-09-26 18:18 ` [PATCH 1/3] of/irq: export of_msi_get_domain Kevin Hilman
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Kevin Hilman @ 2022-09-26 18:18 UTC (permalink / raw)
  To: Peter Ujfalusi, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Enable the UDMA driver & glue and PSIL maps to be built & loaded as modules.

The defauilt Kconfig settings are not changed, so default upstream is
still to be built in.  This series just enables the option to build as
modules.

Kevin Hilman (3):
  of/irq: export of_msi_get_domain
  dma/ti: convert k3-udma to module
  dma/ti: convert PSIL to be buildable as module

 drivers/dma/ti/Kconfig          |  7 +++---
 drivers/dma/ti/k3-psil-am62.c   |  4 ++++
 drivers/dma/ti/k3-psil-am64.c   |  4 ++++
 drivers/dma/ti/k3-psil-am654.c  |  4 ++++
 drivers/dma/ti/k3-psil-j7200.c  |  4 ++++
 drivers/dma/ti/k3-psil-j721e.c  |  4 ++++
 drivers/dma/ti/k3-psil-j721s2.c |  4 ++++
 drivers/dma/ti/k3-psil.c        |  2 ++
 drivers/dma/ti/k3-udma-glue.c   |  5 ++++-
 drivers/dma/ti/k3-udma.c        | 40 +++++----------------------------
 drivers/of/irq.c                |  1 +
 11 files changed, 40 insertions(+), 39 deletions(-)

-- 
2.34.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/3] of/irq: export of_msi_get_domain
  2022-09-26 18:18 [PATCH 0/3] dma/ti: enable udma and psil to be built as modules Kevin Hilman
@ 2022-09-26 18:18 ` Kevin Hilman
  2022-09-26 18:18 ` [PATCH 2/3] dma/ti: convert k3-udma to module Kevin Hilman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Kevin Hilman @ 2022-09-26 18:18 UTC (permalink / raw)
  To: Peter Ujfalusi, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Export of_mis_get_domain to enable it for users from outside.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20200122104723.16955-1-peter.ujfalusi@ti.com
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
---
 drivers/of/irq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index d22f605fa7ee..c9308baa32c5 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -727,6 +727,7 @@ struct irq_domain *of_msi_get_domain(struct device *dev,
 
 	return NULL;
 }
+EXPORT_SYMBOL_GPL(of_msi_get_domain);
 
 /**
  * of_msi_configure - Set the msi_domain field of a device
-- 
2.34.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/3] dma/ti: convert k3-udma to module
  2022-09-26 18:18 [PATCH 0/3] dma/ti: enable udma and psil to be built as modules Kevin Hilman
  2022-09-26 18:18 ` [PATCH 1/3] of/irq: export of_msi_get_domain Kevin Hilman
@ 2022-09-26 18:18 ` Kevin Hilman
  2022-09-26 18:52   ` Péter Ujfalusi
  2022-09-26 18:18 ` [PATCH 3/3] dma/ti: convert PSIL to be buildable as module Kevin Hilman
  2022-09-26 19:02 ` [PATCH 0/3] dma/ti: enable udma and psil to be built as modules Péter Ujfalusi
  3 siblings, 1 reply; 16+ messages in thread
From: Kevin Hilman @ 2022-09-26 18:18 UTC (permalink / raw)
  To: Peter Ujfalusi, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Currently k3-udma driver is built as separate platform drivers with a
shared probe and identical code path, just differnet platform data.

To enable to build as module, convert the separate platform driver
into a single module_platform_driver with the data selection done via
compatible string and of_match.  The separate of_match tables are also
combined into a single table to avoid the multiple calls to
of_match_node()

Since all modern TI platforms using this are DT enabled, the removal
of separate platform_drivers shoul should nave no functional change.

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
---
 drivers/dma/ti/Kconfig        |  4 ++--
 drivers/dma/ti/k3-udma-glue.c |  5 ++++-
 drivers/dma/ti/k3-udma.c      | 40 +++++------------------------------
 3 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/drivers/dma/ti/Kconfig b/drivers/dma/ti/Kconfig
index 79618fac119a..f196be3b222f 100644
--- a/drivers/dma/ti/Kconfig
+++ b/drivers/dma/ti/Kconfig
@@ -35,7 +35,7 @@ config DMA_OMAP
 	  DMA engine is found on OMAP and DRA7xx parts.
 
 config TI_K3_UDMA
-	bool "Texas Instruments UDMA support"
+	tristate "Texas Instruments UDMA support"
 	depends on ARCH_K3
 	depends on TI_SCI_PROTOCOL
 	depends on TI_SCI_INTA_IRQCHIP
@@ -48,7 +48,7 @@ config TI_K3_UDMA
 	  DMA engine is used in AM65x and j721e.
 
 config TI_K3_UDMA_GLUE_LAYER
-	bool "Texas Instruments UDMA Glue layer for non DMAengine users"
+	tristate "Texas Instruments UDMA Glue layer for non DMAengine users"
 	depends on ARCH_K3
 	depends on TI_K3_UDMA
 	help
diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c
index 4fdd9f06b723..c29de4695ae7 100644
--- a/drivers/dma/ti/k3-udma-glue.c
+++ b/drivers/dma/ti/k3-udma-glue.c
@@ -6,6 +6,7 @@
  *
  */
 
+#include <linux/module.h>
 #include <linux/atomic.h>
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
@@ -1433,4 +1434,6 @@ static int __init k3_udma_glue_class_init(void)
 {
 	return class_register(&k3_udma_glue_devclass);
 }
-arch_initcall(k3_udma_glue_class_init);
+
+module_init(k3_udma_glue_class_init);
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 2f0d2c68c93c..7239ff31c8c5 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -5,6 +5,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/dmaengine.h>
 #include <linux/dma-mapping.h>
@@ -4318,18 +4319,10 @@ static const struct of_device_id udma_of_match[] = {
 		.compatible = "ti,j721e-navss-mcu-udmap",
 		.data = &j721e_mcu_data,
 	},
-	{ /* Sentinel */ },
-};
-
-static const struct of_device_id bcdma_of_match[] = {
 	{
 		.compatible = "ti,am64-dmss-bcdma",
 		.data = &am64_bcdma_data,
 	},
-	{ /* Sentinel */ },
-};
-
-static const struct of_device_id pktdma_of_match[] = {
 	{
 		.compatible = "ti,am64-dmss-pktdma",
 		.data = &am64_pktdma_data,
@@ -5254,14 +5247,9 @@ static int udma_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	match = of_match_node(udma_of_match, dev->of_node);
-	if (!match)
-		match = of_match_node(bcdma_of_match, dev->of_node);
 	if (!match) {
-		match = of_match_node(pktdma_of_match, dev->of_node);
-		if (!match) {
-			dev_err(dev, "No compatible match found\n");
-			return -ENODEV;
-		}
+		dev_err(dev, "No compatible match found\n");
+		return -ENODEV;
 	}
 	ud->match_data = match->data;
 
@@ -5494,27 +5482,9 @@ static struct platform_driver udma_driver = {
 	},
 	.probe		= udma_probe,
 };
-builtin_platform_driver(udma_driver);
 
-static struct platform_driver bcdma_driver = {
-	.driver = {
-		.name	= "ti-bcdma",
-		.of_match_table = bcdma_of_match,
-		.suppress_bind_attrs = true,
-	},
-	.probe		= udma_probe,
-};
-builtin_platform_driver(bcdma_driver);
-
-static struct platform_driver pktdma_driver = {
-	.driver = {
-		.name	= "ti-pktdma",
-		.of_match_table = pktdma_of_match,
-		.suppress_bind_attrs = true,
-	},
-	.probe		= udma_probe,
-};
-builtin_platform_driver(pktdma_driver);
+module_platform_driver(udma_driver);
+MODULE_LICENSE("GPL v2");
 
 /* Private interfaces to UDMA */
 #include "k3-udma-private.c"
-- 
2.34.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 3/3] dma/ti: convert PSIL to be buildable as module
  2022-09-26 18:18 [PATCH 0/3] dma/ti: enable udma and psil to be built as modules Kevin Hilman
  2022-09-26 18:18 ` [PATCH 1/3] of/irq: export of_msi_get_domain Kevin Hilman
  2022-09-26 18:18 ` [PATCH 2/3] dma/ti: convert k3-udma to module Kevin Hilman
@ 2022-09-26 18:18 ` Kevin Hilman
  2022-09-26 18:47   ` Péter Ujfalusi
  2022-09-26 19:02 ` [PATCH 0/3] dma/ti: enable udma and psil to be built as modules Péter Ujfalusi
  3 siblings, 1 reply; 16+ messages in thread
From: Kevin Hilman @ 2022-09-26 18:18 UTC (permalink / raw)
  To: Peter Ujfalusi, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

map symbols need EXPORT_SYMBOL and files need MODULE_LICENSE.

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
---
 drivers/dma/ti/Kconfig          | 3 ++-
 drivers/dma/ti/k3-psil-am62.c   | 4 ++++
 drivers/dma/ti/k3-psil-am64.c   | 4 ++++
 drivers/dma/ti/k3-psil-am654.c  | 4 ++++
 drivers/dma/ti/k3-psil-j7200.c  | 4 ++++
 drivers/dma/ti/k3-psil-j721e.c  | 4 ++++
 drivers/dma/ti/k3-psil-j721s2.c | 4 ++++
 drivers/dma/ti/k3-psil.c        | 2 ++
 8 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/ti/Kconfig b/drivers/dma/ti/Kconfig
index f196be3b222f..2adc2cca10e9 100644
--- a/drivers/dma/ti/Kconfig
+++ b/drivers/dma/ti/Kconfig
@@ -56,7 +56,8 @@ config TI_K3_UDMA_GLUE_LAYER
 	  If unsure, say N.
 
 config TI_K3_PSIL
-	bool
+       tristate
+       default TI_K3_UDMA
 
 config TI_DMA_CROSSBAR
 	bool
diff --git a/drivers/dma/ti/k3-psil-am62.c b/drivers/dma/ti/k3-psil-am62.c
index 2b6fd6e37c61..7c4ca85f68b1 100644
--- a/drivers/dma/ti/k3-psil-am62.c
+++ b/drivers/dma/ti/k3-psil-am62.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 
 #include "k3-psil-priv.h"
 
@@ -184,3 +185,6 @@ struct psil_ep_map am62_ep_map = {
 	.dst = am62_dst_ep_map,
 	.dst_count = ARRAY_SIZE(am62_dst_ep_map),
 };
+EXPORT_SYMBOL_GPL(am62_ep_map);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/dma/ti/k3-psil-am64.c b/drivers/dma/ti/k3-psil-am64.c
index 9fdeaa11a4fc..c579374feef9 100644
--- a/drivers/dma/ti/k3-psil-am64.c
+++ b/drivers/dma/ti/k3-psil-am64.c
@@ -5,6 +5,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 
 #include "k3-psil-priv.h"
 
@@ -156,3 +157,6 @@ struct psil_ep_map am64_ep_map = {
 	.dst = am64_dst_ep_map,
 	.dst_count = ARRAY_SIZE(am64_dst_ep_map),
 };
+EXPORT_SYMBOL_GPL(am64_ep_map);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/dma/ti/k3-psil-am654.c b/drivers/dma/ti/k3-psil-am654.c
index a896a15908cf..10db638b1178 100644
--- a/drivers/dma/ti/k3-psil-am654.c
+++ b/drivers/dma/ti/k3-psil-am654.c
@@ -5,6 +5,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 
 #include "k3-psil-priv.h"
 
@@ -173,3 +174,6 @@ struct psil_ep_map am654_ep_map = {
 	.dst = am654_dst_ep_map,
 	.dst_count = ARRAY_SIZE(am654_dst_ep_map),
 };
+EXPORT_SYMBOL_GPL(am654_ep_map);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/dma/ti/k3-psil-j7200.c b/drivers/dma/ti/k3-psil-j7200.c
index 5ea63ea74822..b7c638a5d140 100644
--- a/drivers/dma/ti/k3-psil-j7200.c
+++ b/drivers/dma/ti/k3-psil-j7200.c
@@ -5,6 +5,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 
 #include "k3-psil-priv.h"
 
@@ -173,3 +174,6 @@ struct psil_ep_map j7200_ep_map = {
 	.dst = j7200_dst_ep_map,
 	.dst_count = ARRAY_SIZE(j7200_dst_ep_map),
 };
+EXPORT_SYMBOL_GPL(j7200_ep_map);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/dma/ti/k3-psil-j721e.c b/drivers/dma/ti/k3-psil-j721e.c
index 34e3fc565a37..759e4a156acd 100644
--- a/drivers/dma/ti/k3-psil-j721e.c
+++ b/drivers/dma/ti/k3-psil-j721e.c
@@ -5,6 +5,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 
 #include "k3-psil-priv.h"
 
@@ -296,3 +297,6 @@ struct psil_ep_map j721e_ep_map = {
 	.dst = j721e_dst_ep_map,
 	.dst_count = ARRAY_SIZE(j721e_dst_ep_map),
 };
+EXPORT_SYMBOL_GPL(j721e_ep_map);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/dma/ti/k3-psil-j721s2.c b/drivers/dma/ti/k3-psil-j721s2.c
index a488c2250623..fd9e56851e59 100644
--- a/drivers/dma/ti/k3-psil-j721s2.c
+++ b/drivers/dma/ti/k3-psil-j721s2.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 
 #include "k3-psil-priv.h"
 
@@ -173,3 +174,6 @@ struct psil_ep_map j721s2_ep_map = {
 	.dst = j721s2_dst_ep_map,
 	.dst_count = ARRAY_SIZE(j721s2_dst_ep_map),
 };
+EXPORT_SYMBOL_GPL(j721s2_ep_map);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/dma/ti/k3-psil.c b/drivers/dma/ti/k3-psil.c
index 761a384093d2..8b6533a1eeeb 100644
--- a/drivers/dma/ti/k3-psil.c
+++ b/drivers/dma/ti/k3-psil.c
@@ -5,6 +5,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/device.h>
 #include <linux/init.h>
 #include <linux/mutex.h>
@@ -101,3 +102,4 @@ int psil_set_new_ep_config(struct device *dev, const char *name,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(psil_set_new_ep_config);
+MODULE_LICENSE("GPL v2");
-- 
2.34.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] dma/ti: convert PSIL to be buildable as module
  2022-09-26 18:18 ` [PATCH 3/3] dma/ti: convert PSIL to be buildable as module Kevin Hilman
@ 2022-09-26 18:47   ` Péter Ujfalusi
  2022-09-26 18:50     ` Kevin Hilman
  0 siblings, 1 reply; 16+ messages in thread
From: Péter Ujfalusi @ 2022-09-26 18:47 UTC (permalink / raw)
  To: Kevin Hilman, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Hi Kevin,

On 9/26/22 21:18, Kevin Hilman wrote:
> map symbols need EXPORT_SYMBOL and files need MODULE_LICENSE.
> 
> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
> ---
>  drivers/dma/ti/Kconfig          | 3 ++-
>  drivers/dma/ti/k3-psil-am62.c   | 4 ++++
>  drivers/dma/ti/k3-psil-am64.c   | 4 ++++
>  drivers/dma/ti/k3-psil-am654.c  | 4 ++++
>  drivers/dma/ti/k3-psil-j7200.c  | 4 ++++
>  drivers/dma/ti/k3-psil-j721e.c  | 4 ++++
>  drivers/dma/ti/k3-psil-j721s2.c | 4 ++++
>  drivers/dma/ti/k3-psil.c        | 2 ++
>  8 files changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ti/Kconfig b/drivers/dma/ti/Kconfig
> index f196be3b222f..2adc2cca10e9 100644
> --- a/drivers/dma/ti/Kconfig
> +++ b/drivers/dma/ti/Kconfig
> @@ -56,7 +56,8 @@ config TI_K3_UDMA_GLUE_LAYER
>  	  If unsure, say N.
>  
>  config TI_K3_PSIL
> -	bool
> +       tristate
> +       default TI_K3_UDMA
>  
>  config TI_DMA_CROSSBAR
>  	bool
> diff --git a/drivers/dma/ti/k3-psil-am62.c b/drivers/dma/ti/k3-psil-am62.c
> index 2b6fd6e37c61..7c4ca85f68b1 100644
> --- a/drivers/dma/ti/k3-psil-am62.c
> +++ b/drivers/dma/ti/k3-psil-am62.c
> @@ -4,6 +4,7 @@
>   */
>  
>  #include <linux/kernel.h>
> +#include <linux/module.h>
>  
>  #include "k3-psil-priv.h"
>  
> @@ -184,3 +185,6 @@ struct psil_ep_map am62_ep_map = {
>  	.dst = am62_dst_ep_map,
>  	.dst_count = ARRAY_SIZE(am62_dst_ep_map),
>  };
> +EXPORT_SYMBOL_GPL(am62_ep_map);

Wouldn't it be better to build one module (k3-psil.ko) and link all the
platform libs into that?
They are unconditionally built in all cases anyways and makes the lsmod
under control.
And no need to export these maps at all is a plus.

> +
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/dma/ti/k3-psil-am64.c b/drivers/dma/ti/k3-psil-am64.c
> index 9fdeaa11a4fc..c579374feef9 100644
> --- a/drivers/dma/ti/k3-psil-am64.c
> +++ b/drivers/dma/ti/k3-psil-am64.c
> @@ -5,6 +5,7 @@
>   */
>  
>  #include <linux/kernel.h>
> +#include <linux/module.h>
>  
>  #include "k3-psil-priv.h"
>  
> @@ -156,3 +157,6 @@ struct psil_ep_map am64_ep_map = {
>  	.dst = am64_dst_ep_map,
>  	.dst_count = ARRAY_SIZE(am64_dst_ep_map),
>  };
> +EXPORT_SYMBOL_GPL(am64_ep_map);
> +
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/dma/ti/k3-psil-am654.c b/drivers/dma/ti/k3-psil-am654.c
> index a896a15908cf..10db638b1178 100644
> --- a/drivers/dma/ti/k3-psil-am654.c
> +++ b/drivers/dma/ti/k3-psil-am654.c
> @@ -5,6 +5,7 @@
>   */
>  
>  #include <linux/kernel.h>
> +#include <linux/module.h>
>  
>  #include "k3-psil-priv.h"
>  
> @@ -173,3 +174,6 @@ struct psil_ep_map am654_ep_map = {
>  	.dst = am654_dst_ep_map,
>  	.dst_count = ARRAY_SIZE(am654_dst_ep_map),
>  };
> +EXPORT_SYMBOL_GPL(am654_ep_map);
> +
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/dma/ti/k3-psil-j7200.c b/drivers/dma/ti/k3-psil-j7200.c
> index 5ea63ea74822..b7c638a5d140 100644
> --- a/drivers/dma/ti/k3-psil-j7200.c
> +++ b/drivers/dma/ti/k3-psil-j7200.c
> @@ -5,6 +5,7 @@
>   */
>  
>  #include <linux/kernel.h>
> +#include <linux/module.h>
>  
>  #include "k3-psil-priv.h"
>  
> @@ -173,3 +174,6 @@ struct psil_ep_map j7200_ep_map = {
>  	.dst = j7200_dst_ep_map,
>  	.dst_count = ARRAY_SIZE(j7200_dst_ep_map),
>  };
> +EXPORT_SYMBOL_GPL(j7200_ep_map);
> +
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/dma/ti/k3-psil-j721e.c b/drivers/dma/ti/k3-psil-j721e.c
> index 34e3fc565a37..759e4a156acd 100644
> --- a/drivers/dma/ti/k3-psil-j721e.c
> +++ b/drivers/dma/ti/k3-psil-j721e.c
> @@ -5,6 +5,7 @@
>   */
>  
>  #include <linux/kernel.h>
> +#include <linux/module.h>
>  
>  #include "k3-psil-priv.h"
>  
> @@ -296,3 +297,6 @@ struct psil_ep_map j721e_ep_map = {
>  	.dst = j721e_dst_ep_map,
>  	.dst_count = ARRAY_SIZE(j721e_dst_ep_map),
>  };
> +EXPORT_SYMBOL_GPL(j721e_ep_map);
> +
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/dma/ti/k3-psil-j721s2.c b/drivers/dma/ti/k3-psil-j721s2.c
> index a488c2250623..fd9e56851e59 100644
> --- a/drivers/dma/ti/k3-psil-j721s2.c
> +++ b/drivers/dma/ti/k3-psil-j721s2.c
> @@ -4,6 +4,7 @@
>   */
>  
>  #include <linux/kernel.h>
> +#include <linux/module.h>
>  
>  #include "k3-psil-priv.h"
>  
> @@ -173,3 +174,6 @@ struct psil_ep_map j721s2_ep_map = {
>  	.dst = j721s2_dst_ep_map,
>  	.dst_count = ARRAY_SIZE(j721s2_dst_ep_map),
>  };
> +EXPORT_SYMBOL_GPL(j721s2_ep_map);
> +
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/dma/ti/k3-psil.c b/drivers/dma/ti/k3-psil.c
> index 761a384093d2..8b6533a1eeeb 100644
> --- a/drivers/dma/ti/k3-psil.c
> +++ b/drivers/dma/ti/k3-psil.c
> @@ -5,6 +5,7 @@
>   */
>  
>  #include <linux/kernel.h>
> +#include <linux/module.h>
>  #include <linux/device.h>
>  #include <linux/init.h>
>  #include <linux/mutex.h>
> @@ -101,3 +102,4 @@ int psil_set_new_ep_config(struct device *dev, const char *name,
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(psil_set_new_ep_config);
> +MODULE_LICENSE("GPL v2");

-- 
Péter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] dma/ti: convert PSIL to be buildable as module
  2022-09-26 18:47   ` Péter Ujfalusi
@ 2022-09-26 18:50     ` Kevin Hilman
  2022-09-27 17:19       ` Péter Ujfalusi
  0 siblings, 1 reply; 16+ messages in thread
From: Kevin Hilman @ 2022-09-26 18:50 UTC (permalink / raw)
  To: Péter Ujfalusi, dmaengine
  Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Péter Ujfalusi <peter.ujfalusi@gmail.com> writes:

> Hi Kevin,
>
> On 9/26/22 21:18, Kevin Hilman wrote:
>> map symbols need EXPORT_SYMBOL and files need MODULE_LICENSE.
>> 
>> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
>> ---
>>  drivers/dma/ti/Kconfig          | 3 ++-
>>  drivers/dma/ti/k3-psil-am62.c   | 4 ++++
>>  drivers/dma/ti/k3-psil-am64.c   | 4 ++++
>>  drivers/dma/ti/k3-psil-am654.c  | 4 ++++
>>  drivers/dma/ti/k3-psil-j7200.c  | 4 ++++
>>  drivers/dma/ti/k3-psil-j721e.c  | 4 ++++
>>  drivers/dma/ti/k3-psil-j721s2.c | 4 ++++
>>  drivers/dma/ti/k3-psil.c        | 2 ++
>>  8 files changed, 28 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/dma/ti/Kconfig b/drivers/dma/ti/Kconfig
>> index f196be3b222f..2adc2cca10e9 100644
>> --- a/drivers/dma/ti/Kconfig
>> +++ b/drivers/dma/ti/Kconfig
>> @@ -56,7 +56,8 @@ config TI_K3_UDMA_GLUE_LAYER
>>  	  If unsure, say N.
>>  
>>  config TI_K3_PSIL
>> -	bool
>> +       tristate
>> +       default TI_K3_UDMA
>>  
>>  config TI_DMA_CROSSBAR
>>  	bool
>> diff --git a/drivers/dma/ti/k3-psil-am62.c b/drivers/dma/ti/k3-psil-am62.c
>> index 2b6fd6e37c61..7c4ca85f68b1 100644
>> --- a/drivers/dma/ti/k3-psil-am62.c
>> +++ b/drivers/dma/ti/k3-psil-am62.c
>> @@ -4,6 +4,7 @@
>>   */
>>  
>>  #include <linux/kernel.h>
>> +#include <linux/module.h>
>>  
>>  #include "k3-psil-priv.h"
>>  
>> @@ -184,3 +185,6 @@ struct psil_ep_map am62_ep_map = {
>>  	.dst = am62_dst_ep_map,
>>  	.dst_count = ARRAY_SIZE(am62_dst_ep_map),
>>  };
>> +EXPORT_SYMBOL_GPL(am62_ep_map);
>
> Wouldn't it be better to build one module (k3-psil.ko) and link all the
> platform libs into that?
> They are unconditionally built in all cases anyways and makes the lsmod
> under control.
> And no need to export these maps at all is a plus.

I guess that's one option, but seems to be to be the wrong direction for
a modular kernel.  To me, it seems like the next step would be to make
it so only the SoC specific module is loaded instead of always loading
them all.

Kevin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/3] dma/ti: convert k3-udma to module
  2022-09-26 18:18 ` [PATCH 2/3] dma/ti: convert k3-udma to module Kevin Hilman
@ 2022-09-26 18:52   ` Péter Ujfalusi
  2022-09-26 21:17     ` Kevin Hilman
  0 siblings, 1 reply; 16+ messages in thread
From: Péter Ujfalusi @ 2022-09-26 18:52 UTC (permalink / raw)
  To: Kevin Hilman, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer



On 9/26/22 21:18, Kevin Hilman wrote:
> Currently k3-udma driver is built as separate platform drivers with a
> shared probe and identical code path, just differnet platform data.
> 
> To enable to build as module, convert the separate platform driver
> into a single module_platform_driver with the data selection done via
> compatible string and of_match.  The separate of_match tables are also
> combined into a single table to avoid the multiple calls to
> of_match_node()
> 
> Since all modern TI platforms using this are DT enabled, the removal
> of separate platform_drivers shoul should nave no functional change.
> 
> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
> ---
>  drivers/dma/ti/Kconfig        |  4 ++--
>  drivers/dma/ti/k3-udma-glue.c |  5 ++++-
>  drivers/dma/ti/k3-udma.c      | 40 +++++------------------------------
>  3 files changed, 11 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/dma/ti/Kconfig b/drivers/dma/ti/Kconfig
> index 79618fac119a..f196be3b222f 100644
> --- a/drivers/dma/ti/Kconfig
> +++ b/drivers/dma/ti/Kconfig
> @@ -35,7 +35,7 @@ config DMA_OMAP
>  	  DMA engine is found on OMAP and DRA7xx parts.
>  
>  config TI_K3_UDMA
> -	bool "Texas Instruments UDMA support"
> +	tristate "Texas Instruments UDMA support"
>  	depends on ARCH_K3
>  	depends on TI_SCI_PROTOCOL
>  	depends on TI_SCI_INTA_IRQCHIP
> @@ -48,7 +48,7 @@ config TI_K3_UDMA
>  	  DMA engine is used in AM65x and j721e.
>  
>  config TI_K3_UDMA_GLUE_LAYER
> -	bool "Texas Instruments UDMA Glue layer for non DMAengine users"
> +	tristate "Texas Instruments UDMA Glue layer for non DMAengine users"
>  	depends on ARCH_K3
>  	depends on TI_K3_UDMA
>  	help
> diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c
> index 4fdd9f06b723..c29de4695ae7 100644
> --- a/drivers/dma/ti/k3-udma-glue.c
> +++ b/drivers/dma/ti/k3-udma-glue.c
> @@ -6,6 +6,7 @@
>   *
>   */
>  
> +#include <linux/module.h>
>  #include <linux/atomic.h>
>  #include <linux/delay.h>
>  #include <linux/dma-mapping.h>
> @@ -1433,4 +1434,6 @@ static int __init k3_udma_glue_class_init(void)
>  {
>  	return class_register(&k3_udma_glue_devclass);
>  }
> -arch_initcall(k3_udma_glue_class_init);
> +
> +module_init(k3_udma_glue_class_init);
> +MODULE_LICENSE("GPL v2");
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 2f0d2c68c93c..7239ff31c8c5 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -5,6 +5,7 @@
>   */
>  
>  #include <linux/kernel.h>
> +#include <linux/module.h>
>  #include <linux/delay.h>
>  #include <linux/dmaengine.h>
>  #include <linux/dma-mapping.h>
> @@ -4318,18 +4319,10 @@ static const struct of_device_id udma_of_match[] = {
>  		.compatible = "ti,j721e-navss-mcu-udmap",
>  		.data = &j721e_mcu_data,
>  	},
> -	{ /* Sentinel */ },
> -};
> -
> -static const struct of_device_id bcdma_of_match[] = {
>  	{
>  		.compatible = "ti,am64-dmss-bcdma",
>  		.data = &am64_bcdma_data,
>  	},
> -	{ /* Sentinel */ },
> -};
> -
> -static const struct of_device_id pktdma_of_match[] = {
>  	{
>  		.compatible = "ti,am64-dmss-pktdma",
>  		.data = &am64_pktdma_data,
> @@ -5254,14 +5247,9 @@ static int udma_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	match = of_match_node(udma_of_match, dev->of_node);
> -	if (!match)
> -		match = of_match_node(bcdma_of_match, dev->of_node);
>  	if (!match) {
> -		match = of_match_node(pktdma_of_match, dev->of_node);
> -		if (!match) {
> -			dev_err(dev, "No compatible match found\n");
> -			return -ENODEV;
> -		}
> +		dev_err(dev, "No compatible match found\n");
> +		return -ENODEV;
>  	}
>  	ud->match_data = match->data;
>  
> @@ -5494,27 +5482,9 @@ static struct platform_driver udma_driver = {
>  	},
>  	.probe		= udma_probe,
>  };
> -builtin_platform_driver(udma_driver);
>  
> -static struct platform_driver bcdma_driver = {
> -	.driver = {
> -		.name	= "ti-bcdma",
> -		.of_match_table = bcdma_of_match,
> -		.suppress_bind_attrs = true,
> -	},
> -	.probe		= udma_probe,
> -};
> -builtin_platform_driver(bcdma_driver);
> -
> -static struct platform_driver pktdma_driver = {
> -	.driver = {
> -		.name	= "ti-pktdma",
> -		.of_match_table = pktdma_of_match,
> -		.suppress_bind_attrs = true,
> -	},
> -	.probe		= udma_probe,
> -};
> -builtin_platform_driver(pktdma_driver);
> +module_platform_driver(udma_driver);

I did liked the 'hack' that the dev_* prints contained the actual type
of the DMA (udma/bcdma/pktdma), but it is not working via modules,
unless the driver init parts are split out and the bulk is kept as a
library.
I had this half way implemented in my wip, but never got the chance to
finalize it.

But, one can get the info via the address, so...

> +MODULE_LICENSE("GPL v2");
>  
>  /* Private interfaces to UDMA */
>  #include "k3-udma-private.c"

-- 
Péter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 0/3] dma/ti: enable udma and psil to be built as modules
  2022-09-26 18:18 [PATCH 0/3] dma/ti: enable udma and psil to be built as modules Kevin Hilman
                   ` (2 preceding siblings ...)
  2022-09-26 18:18 ` [PATCH 3/3] dma/ti: convert PSIL to be buildable as module Kevin Hilman
@ 2022-09-26 19:02 ` Péter Ujfalusi
  2022-09-26 21:21   ` Kevin Hilman
  3 siblings, 1 reply; 16+ messages in thread
From: Péter Ujfalusi @ 2022-09-26 19:02 UTC (permalink / raw)
  To: Kevin Hilman, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Hi Kevin,

On 9/26/22 21:18, Kevin Hilman wrote:
> Enable the UDMA driver & glue and PSIL maps to be built & loaded as modules.
> 
> The defauilt Kconfig settings are not changed, so default upstream is
> still to be built in.  This series just enables the option to build as
> modules.

I can finally drop the half backed stuff I roll on top of -next ;)

Do you plan to convert the ringacc also? It is straight forward, like:
https://github.com/omap-audio/linux-audio/commit/01f9290c1c61e8bbc0fbdd877382672883ba7e73

> Kevin Hilman (3):
>   of/irq: export of_msi_get_domain
>   dma/ti: convert k3-udma to module
>   dma/ti: convert PSIL to be buildable as module
> 
>  drivers/dma/ti/Kconfig          |  7 +++---
>  drivers/dma/ti/k3-psil-am62.c   |  4 ++++
>  drivers/dma/ti/k3-psil-am64.c   |  4 ++++
>  drivers/dma/ti/k3-psil-am654.c  |  4 ++++
>  drivers/dma/ti/k3-psil-j7200.c  |  4 ++++
>  drivers/dma/ti/k3-psil-j721e.c  |  4 ++++
>  drivers/dma/ti/k3-psil-j721s2.c |  4 ++++
>  drivers/dma/ti/k3-psil.c        |  2 ++
>  drivers/dma/ti/k3-udma-glue.c   |  5 ++++-
>  drivers/dma/ti/k3-udma.c        | 40 +++++----------------------------
>  drivers/of/irq.c                |  1 +
>  11 files changed, 40 insertions(+), 39 deletions(-)
> 

-- 
Péter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/3] dma/ti: convert k3-udma to module
  2022-09-26 18:52   ` Péter Ujfalusi
@ 2022-09-26 21:17     ` Kevin Hilman
  2022-09-27 17:07       ` Péter Ujfalusi
  0 siblings, 1 reply; 16+ messages in thread
From: Kevin Hilman @ 2022-09-26 21:17 UTC (permalink / raw)
  To: Péter Ujfalusi, dmaengine
  Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Péter Ujfalusi <peter.ujfalusi@gmail.com> writes:

> On 9/26/22 21:18, Kevin Hilman wrote:
>> Currently k3-udma driver is built as separate platform drivers with a
>> shared probe and identical code path, just differnet platform data.
>> 
>> To enable to build as module, convert the separate platform driver
>> into a single module_platform_driver with the data selection done via
>> compatible string and of_match.  The separate of_match tables are also
>> combined into a single table to avoid the multiple calls to
>> of_match_node()
>> 
>> Since all modern TI platforms using this are DT enabled, the removal
>> of separate platform_drivers shoul should nave no functional change.
>> 
>> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
>> ---
>>  drivers/dma/ti/Kconfig        |  4 ++--
>>  drivers/dma/ti/k3-udma-glue.c |  5 ++++-
>>  drivers/dma/ti/k3-udma.c      | 40 +++++------------------------------
>>  3 files changed, 11 insertions(+), 38 deletions(-)
>> 
>> diff --git a/drivers/dma/ti/Kconfig b/drivers/dma/ti/Kconfig
>> index 79618fac119a..f196be3b222f 100644
>> --- a/drivers/dma/ti/Kconfig
>> +++ b/drivers/dma/ti/Kconfig
>> @@ -35,7 +35,7 @@ config DMA_OMAP
>>  	  DMA engine is found on OMAP and DRA7xx parts.
>>  
>>  config TI_K3_UDMA
>> -	bool "Texas Instruments UDMA support"
>> +	tristate "Texas Instruments UDMA support"
>>  	depends on ARCH_K3
>>  	depends on TI_SCI_PROTOCOL
>>  	depends on TI_SCI_INTA_IRQCHIP
>> @@ -48,7 +48,7 @@ config TI_K3_UDMA
>>  	  DMA engine is used in AM65x and j721e.
>>  
>>  config TI_K3_UDMA_GLUE_LAYER
>> -	bool "Texas Instruments UDMA Glue layer for non DMAengine users"
>> +	tristate "Texas Instruments UDMA Glue layer for non DMAengine users"
>>  	depends on ARCH_K3
>>  	depends on TI_K3_UDMA
>>  	help
>> diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c
>> index 4fdd9f06b723..c29de4695ae7 100644
>> --- a/drivers/dma/ti/k3-udma-glue.c
>> +++ b/drivers/dma/ti/k3-udma-glue.c
>> @@ -6,6 +6,7 @@
>>   *
>>   */
>>  
>> +#include <linux/module.h>
>>  #include <linux/atomic.h>
>>  #include <linux/delay.h>
>>  #include <linux/dma-mapping.h>
>> @@ -1433,4 +1434,6 @@ static int __init k3_udma_glue_class_init(void)
>>  {
>>  	return class_register(&k3_udma_glue_devclass);
>>  }
>> -arch_initcall(k3_udma_glue_class_init);
>> +
>> +module_init(k3_udma_glue_class_init);
>> +MODULE_LICENSE("GPL v2");
>> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
>> index 2f0d2c68c93c..7239ff31c8c5 100644
>> --- a/drivers/dma/ti/k3-udma.c
>> +++ b/drivers/dma/ti/k3-udma.c
>> @@ -5,6 +5,7 @@
>>   */
>>  
>>  #include <linux/kernel.h>
>> +#include <linux/module.h>
>>  #include <linux/delay.h>
>>  #include <linux/dmaengine.h>
>>  #include <linux/dma-mapping.h>
>> @@ -4318,18 +4319,10 @@ static const struct of_device_id udma_of_match[] = {
>>  		.compatible = "ti,j721e-navss-mcu-udmap",
>>  		.data = &j721e_mcu_data,
>>  	},
>> -	{ /* Sentinel */ },
>> -};
>> -
>> -static const struct of_device_id bcdma_of_match[] = {
>>  	{
>>  		.compatible = "ti,am64-dmss-bcdma",
>>  		.data = &am64_bcdma_data,
>>  	},
>> -	{ /* Sentinel */ },
>> -};
>> -
>> -static const struct of_device_id pktdma_of_match[] = {
>>  	{
>>  		.compatible = "ti,am64-dmss-pktdma",
>>  		.data = &am64_pktdma_data,
>> @@ -5254,14 +5247,9 @@ static int udma_probe(struct platform_device *pdev)
>>  		return -ENOMEM;
>>  
>>  	match = of_match_node(udma_of_match, dev->of_node);
>> -	if (!match)
>> -		match = of_match_node(bcdma_of_match, dev->of_node);
>>  	if (!match) {
>> -		match = of_match_node(pktdma_of_match, dev->of_node);
>> -		if (!match) {
>> -			dev_err(dev, "No compatible match found\n");
>> -			return -ENODEV;
>> -		}
>> +		dev_err(dev, "No compatible match found\n");
>> +		return -ENODEV;
>>  	}
>>  	ud->match_data = match->data;
>>  
>> @@ -5494,27 +5482,9 @@ static struct platform_driver udma_driver = {
>>  	},
>>  	.probe		= udma_probe,
>>  };
>> -builtin_platform_driver(udma_driver);
>>  
>> -static struct platform_driver bcdma_driver = {
>> -	.driver = {
>> -		.name	= "ti-bcdma",
>> -		.of_match_table = bcdma_of_match,
>> -		.suppress_bind_attrs = true,
>> -	},
>> -	.probe		= udma_probe,
>> -};
>> -builtin_platform_driver(bcdma_driver);
>> -
>> -static struct platform_driver pktdma_driver = {
>> -	.driver = {
>> -		.name	= "ti-pktdma",
>> -		.of_match_table = pktdma_of_match,
>> -		.suppress_bind_attrs = true,
>> -	},
>> -	.probe		= udma_probe,
>> -};
>> -builtin_platform_driver(pktdma_driver);
>> +module_platform_driver(udma_driver);

> I did liked the 'hack' that the dev_* prints contained the actual type
> of the DMA (udma/bcdma/pktdma), but it is not working via modules,
> unless the driver init parts are split out and the bulk is kept as a
> library.
>
> I had this half way implemented in my wip, but never got the chance to
> finalize it.

I guess that could always be done as a second path if needed, but I
wanted to keep this module conversion as simple as possible at first.

> But, one can get the info via the address, so...

Shall I take this "so..." as an acked-by?  ;)

Kevin



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 0/3] dma/ti: enable udma and psil to be built as modules
  2022-09-26 19:02 ` [PATCH 0/3] dma/ti: enable udma and psil to be built as modules Péter Ujfalusi
@ 2022-09-26 21:21   ` Kevin Hilman
  2022-09-27 17:21     ` Péter Ujfalusi
  0 siblings, 1 reply; 16+ messages in thread
From: Kevin Hilman @ 2022-09-26 21:21 UTC (permalink / raw)
  To: Péter Ujfalusi, dmaengine
  Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Hi Péter,

Péter Ujfalusi <peter.ujfalusi@gmail.com> writes:

> On 9/26/22 21:18, Kevin Hilman wrote:
>> Enable the UDMA driver & glue and PSIL maps to be built & loaded as modules.
>> 
>> The defauilt Kconfig settings are not changed, so default upstream is
>> still to be built in.  This series just enables the option to build as
>> modules.
>
> I can finally drop the half backed stuff I roll on top of -next ;)
>
> Do you plan to convert the ringacc also? It is straight forward, like:
> https://github.com/omap-audio/linux-audio/commit/01f9290c1c61e8bbc0fbdd877382672883ba7e73

Yes, my colleague Nicolas (cc'd) was planning ringacc shortly, but we
didn't realize you had already don it.  Your version looks fine to me.
Any reason not to submit yours?

Kevin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/3] dma/ti: convert k3-udma to module
  2022-09-26 21:17     ` Kevin Hilman
@ 2022-09-27 17:07       ` Péter Ujfalusi
  0 siblings, 0 replies; 16+ messages in thread
From: Péter Ujfalusi @ 2022-09-27 17:07 UTC (permalink / raw)
  To: Kevin Hilman, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer



On 27/09/2022 00:17, Kevin Hilman wrote:
> 
>> I did liked the 'hack' that the dev_* prints contained the actual type
>> of the DMA (udma/bcdma/pktdma), but it is not working via modules,
>> unless the driver init parts are split out and the bulk is kept as a
>> library.
>>
>> I had this half way implemented in my wip, but never got the chance to
>> finalize it.
> 
> I guess that could always be done as a second path if needed, but I
> wanted to keep this module conversion as simple as possible at first.
> 
>> But, one can get the info via the address, so...
> 
> Shall I take this "so..." as an acked-by?  ;)

For this patch, definitely:

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>

> 
> Kevin
> 
> 

-- 
Péter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] dma/ti: convert PSIL to be buildable as module
  2022-09-26 18:50     ` Kevin Hilman
@ 2022-09-27 17:19       ` Péter Ujfalusi
  2022-09-27 22:56         ` Kevin Hilman
  0 siblings, 1 reply; 16+ messages in thread
From: Péter Ujfalusi @ 2022-09-27 17:19 UTC (permalink / raw)
  To: Kevin Hilman, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer



On 26/09/2022 21:50, Kevin Hilman wrote:
> Péter Ujfalusi <peter.ujfalusi@gmail.com> writes:
> 
>> Hi Kevin,
>>
>> On 9/26/22 21:18, Kevin Hilman wrote:
>>> map symbols need EXPORT_SYMBOL and files need MODULE_LICENSE.
>>>
>>> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
>>> ---
>>>   drivers/dma/ti/Kconfig          | 3 ++-
>>>   drivers/dma/ti/k3-psil-am62.c   | 4 ++++
>>>   drivers/dma/ti/k3-psil-am64.c   | 4 ++++
>>>   drivers/dma/ti/k3-psil-am654.c  | 4 ++++
>>>   drivers/dma/ti/k3-psil-j7200.c  | 4 ++++
>>>   drivers/dma/ti/k3-psil-j721e.c  | 4 ++++
>>>   drivers/dma/ti/k3-psil-j721s2.c | 4 ++++
>>>   drivers/dma/ti/k3-psil.c        | 2 ++
>>>   8 files changed, 28 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/dma/ti/Kconfig b/drivers/dma/ti/Kconfig
>>> index f196be3b222f..2adc2cca10e9 100644
>>> --- a/drivers/dma/ti/Kconfig
>>> +++ b/drivers/dma/ti/Kconfig
>>> @@ -56,7 +56,8 @@ config TI_K3_UDMA_GLUE_LAYER
>>>   	  If unsure, say N.
>>>   
>>>   config TI_K3_PSIL
>>> -	bool
>>> +       tristate
>>> +       default TI_K3_UDMA
>>>   
>>>   config TI_DMA_CROSSBAR
>>>   	bool
>>> diff --git a/drivers/dma/ti/k3-psil-am62.c b/drivers/dma/ti/k3-psil-am62.c
>>> index 2b6fd6e37c61..7c4ca85f68b1 100644
>>> --- a/drivers/dma/ti/k3-psil-am62.c
>>> +++ b/drivers/dma/ti/k3-psil-am62.c
>>> @@ -4,6 +4,7 @@
>>>    */
>>>   
>>>   #include <linux/kernel.h>
>>> +#include <linux/module.h>
>>>   
>>>   #include "k3-psil-priv.h"
>>>   
>>> @@ -184,3 +185,6 @@ struct psil_ep_map am62_ep_map = {
>>>   	.dst = am62_dst_ep_map,
>>>   	.dst_count = ARRAY_SIZE(am62_dst_ep_map),
>>>   };
>>> +EXPORT_SYMBOL_GPL(am62_ep_map);
>>
>> Wouldn't it be better to build one module (k3-psil.ko) and link all the
>> platform libs into that?
>> They are unconditionally built in all cases anyways and makes the lsmod
>> under control.
>> And no need to export these maps at all is a plus.
> 
> I guess that's one option, but seems to be to be the wrong direction for
> a modular kernel.  To me, it seems like the next step would be to make
> it so only the SoC specific module is loaded instead of always loading
> them all.

The PSI-L map is a library atm and exporting all the maps outside of the 
PSI-L library is wrong. We shall have fixed API to look up (and update) 
a PSI-L endpoint configuration and only that API shall be allowed.

I prefer to have a single .ko binary for the PSI-L library/database for 
now. Optionally the individual SoC maps could be marked as init data and 
we could make a copy of the one that is needed on the booted device.

For SoC only loading this whole library way must be reworked to a 
platform or a bus driver (the bus description via DT was shot down 
during the initial UDMA submission, fyi). So you need to find a 'device' 
which would probe the PSI-L map and only load the map that is needed.

Furthermore: having the individual maps as separate .ko objects does not 
make much sense as none of them can be removed runtime, the symbols are 
used in the 'core' library.

-- 
Péter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 0/3] dma/ti: enable udma and psil to be built as modules
  2022-09-26 21:21   ` Kevin Hilman
@ 2022-09-27 17:21     ` Péter Ujfalusi
  2022-09-27 23:10       ` Kevin Hilman
  0 siblings, 1 reply; 16+ messages in thread
From: Péter Ujfalusi @ 2022-09-27 17:21 UTC (permalink / raw)
  To: Kevin Hilman, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer



On 27/09/2022 00:21, Kevin Hilman wrote:
> Hi Péter,
> 
> Péter Ujfalusi <peter.ujfalusi@gmail.com> writes:
> 
>> On 9/26/22 21:18, Kevin Hilman wrote:
>>> Enable the UDMA driver & glue and PSIL maps to be built & loaded as modules.
>>>
>>> The defauilt Kconfig settings are not changed, so default upstream is
>>> still to be built in.  This series just enables the option to build as
>>> modules.
>>
>> I can finally drop the half backed stuff I roll on top of -next ;)
>>
>> Do you plan to convert the ringacc also? It is straight forward, like:
>> https://github.com/omap-audio/linux-audio/commit/01f9290c1c61e8bbc0fbdd877382672883ba7e73
> 
> Yes, my colleague Nicolas (cc'd) was planning ringacc shortly, but we
> didn't realize you had already don it.  Your version looks fine to me.
> Any reason not to submit yours?

It can only be sent after the UDMA is able to be built as a module.
When I did the module support there were also a tisci dependency which 
for some reason took too long for me to be able to send these.

I can send my version later if it is OK, but if Nicolas have a better 
take on it, I don't mind.

-- 
Péter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 3/3] dma/ti: convert PSIL to be buildable as module
  2022-09-27 17:19       ` Péter Ujfalusi
@ 2022-09-27 22:56         ` Kevin Hilman
  0 siblings, 0 replies; 16+ messages in thread
From: Kevin Hilman @ 2022-09-27 22:56 UTC (permalink / raw)
  To: Péter Ujfalusi, dmaengine
  Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Hi Péter

Péter Ujfalusi <peter.ujfalusi@gmail.com> writes:

> On 26/09/2022 21:50, Kevin Hilman wrote:
>> Péter Ujfalusi <peter.ujfalusi@gmail.com> writes:
>> 
>>> Hi Kevin,
>>>
>>> On 9/26/22 21:18, Kevin Hilman wrote:
>>>> map symbols need EXPORT_SYMBOL and files need MODULE_LICENSE.
>>>>
>>>> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
>>>> ---
>>>>   drivers/dma/ti/Kconfig          | 3 ++-
>>>>   drivers/dma/ti/k3-psil-am62.c   | 4 ++++
>>>>   drivers/dma/ti/k3-psil-am64.c   | 4 ++++
>>>>   drivers/dma/ti/k3-psil-am654.c  | 4 ++++
>>>>   drivers/dma/ti/k3-psil-j7200.c  | 4 ++++
>>>>   drivers/dma/ti/k3-psil-j721e.c  | 4 ++++
>>>>   drivers/dma/ti/k3-psil-j721s2.c | 4 ++++
>>>>   drivers/dma/ti/k3-psil.c        | 2 ++
>>>>   8 files changed, 28 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/dma/ti/Kconfig b/drivers/dma/ti/Kconfig
>>>> index f196be3b222f..2adc2cca10e9 100644
>>>> --- a/drivers/dma/ti/Kconfig
>>>> +++ b/drivers/dma/ti/Kconfig
>>>> @@ -56,7 +56,8 @@ config TI_K3_UDMA_GLUE_LAYER
>>>>   	  If unsure, say N.
>>>>   
>>>>   config TI_K3_PSIL
>>>> -	bool
>>>> +       tristate
>>>> +       default TI_K3_UDMA
>>>>   
>>>>   config TI_DMA_CROSSBAR
>>>>   	bool
>>>> diff --git a/drivers/dma/ti/k3-psil-am62.c b/drivers/dma/ti/k3-psil-am62.c
>>>> index 2b6fd6e37c61..7c4ca85f68b1 100644
>>>> --- a/drivers/dma/ti/k3-psil-am62.c
>>>> +++ b/drivers/dma/ti/k3-psil-am62.c
>>>> @@ -4,6 +4,7 @@
>>>>    */
>>>>   
>>>>   #include <linux/kernel.h>
>>>> +#include <linux/module.h>
>>>>   
>>>>   #include "k3-psil-priv.h"
>>>>   
>>>> @@ -184,3 +185,6 @@ struct psil_ep_map am62_ep_map = {
>>>>   	.dst = am62_dst_ep_map,
>>>>   	.dst_count = ARRAY_SIZE(am62_dst_ep_map),
>>>>   };
>>>> +EXPORT_SYMBOL_GPL(am62_ep_map);
>>>
>>> Wouldn't it be better to build one module (k3-psil.ko) and link all the
>>> platform libs into that?
>>> They are unconditionally built in all cases anyways and makes the lsmod
>>> under control.
>>> And no need to export these maps at all is a plus.
>> 
>> I guess that's one option, but seems to be to be the wrong direction for
>> a modular kernel.  To me, it seems like the next step would be to make
>> it so only the SoC specific module is loaded instead of always loading
>> them all.
>
> The PSI-L map is a library atm and exporting all the maps outside of the 
> PSI-L library is wrong. We shall have fixed API to look up (and update) 
> a PSI-L endpoint configuration and only that API shall be allowed.
>
> I prefer to have a single .ko binary for the PSI-L library/database for 
> now. Optionally the individual SoC maps could be marked as init data and 
> we could make a copy of the one that is needed on the booted device.
>
> For SoC only loading this whole library way must be reworked to a 
> platform or a bus driver (the bus description via DT was shot down 
> during the initial UDMA submission, fyi). So you need to find a 'device' 
> which would probe the PSI-L map and only load the map that is needed.
>
> Furthermore: having the individual maps as separate .ko objects does not 
> make much sense as none of them can be removed runtime, the symbols are 
> used in the 'core' library.

OK, I understand.  I'll send a v2 with everything built into a single
.ko (but I'll leave the initdata stuff for an optional follow-up series,
since I don't fully understand how/when all these maps are used.)

Thanks for your detailed review & suggestions,

Kevin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 0/3] dma/ti: enable udma and psil to be built as modules
  2022-09-27 17:21     ` Péter Ujfalusi
@ 2022-09-27 23:10       ` Kevin Hilman
  2022-09-28 13:54         ` Péter Ujfalusi
  0 siblings, 1 reply; 16+ messages in thread
From: Kevin Hilman @ 2022-09-27 23:10 UTC (permalink / raw)
  To: Péter Ujfalusi, dmaengine
  Cc: linux-omap, linux-arm-kernel, Nicolas Frayer

Péter Ujfalusi <peter.ujfalusi@gmail.com> writes:

> On 27/09/2022 00:21, Kevin Hilman wrote:
>> Hi Péter,
>> 
>> Péter Ujfalusi <peter.ujfalusi@gmail.com> writes:
>> 
>>> On 9/26/22 21:18, Kevin Hilman wrote:
>>>> Enable the UDMA driver & glue and PSIL maps to be built & loaded as modules.
>>>>
>>>> The defauilt Kconfig settings are not changed, so default upstream is
>>>> still to be built in.  This series just enables the option to build as
>>>> modules.
>>>
>>> I can finally drop the half backed stuff I roll on top of -next ;)
>>>
>>> Do you plan to convert the ringacc also? It is straight forward, like:
>>> https://github.com/omap-audio/linux-audio/commit/01f9290c1c61e8bbc0fbdd877382672883ba7e73
>> 
>> Yes, my colleague Nicolas (cc'd) was planning ringacc shortly, but we
>> didn't realize you had already don it.  Your version looks fine to me.
>> Any reason not to submit yours?
>
> It can only be sent after the UDMA is able to be built as a module.

OK, I sent a v2 of this series, which I think should be ready for merge
now.

> When I did the module support there were also a tisci dependency which 
> for some reason took too long for me to be able to send these.
> I can send my version later if it is OK, but if Nicolas have a better 
> take on it, I don't mind.

We've got a handful of other conversions coming for a fully modular
kernel, so I'm sure Nicolas would be happy if you took care of
ringacc. :)

Kevin



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 0/3] dma/ti: enable udma and psil to be built as modules
  2022-09-27 23:10       ` Kevin Hilman
@ 2022-09-28 13:54         ` Péter Ujfalusi
  0 siblings, 0 replies; 16+ messages in thread
From: Péter Ujfalusi @ 2022-09-28 13:54 UTC (permalink / raw)
  To: Kevin Hilman, dmaengine; +Cc: linux-omap, linux-arm-kernel, Nicolas Frayer



On 28/09/2022 02:10, Kevin Hilman wrote:
>> When I did the module support there were also a tisci dependency which
>> for some reason took too long for me to be able to send these.
>> I can send my version later if it is OK, but if Nicolas have a better
>> take on it, I don't mind.
> 
> We've got a handful of other conversions coming for a fully modular
> kernel, so I'm sure Nicolas would be happy if you took care of
> ringacc. :)

Sure, I will send it when the UDMA part is merged.

-- 
Péter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-09-28 13:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 18:18 [PATCH 0/3] dma/ti: enable udma and psil to be built as modules Kevin Hilman
2022-09-26 18:18 ` [PATCH 1/3] of/irq: export of_msi_get_domain Kevin Hilman
2022-09-26 18:18 ` [PATCH 2/3] dma/ti: convert k3-udma to module Kevin Hilman
2022-09-26 18:52   ` Péter Ujfalusi
2022-09-26 21:17     ` Kevin Hilman
2022-09-27 17:07       ` Péter Ujfalusi
2022-09-26 18:18 ` [PATCH 3/3] dma/ti: convert PSIL to be buildable as module Kevin Hilman
2022-09-26 18:47   ` Péter Ujfalusi
2022-09-26 18:50     ` Kevin Hilman
2022-09-27 17:19       ` Péter Ujfalusi
2022-09-27 22:56         ` Kevin Hilman
2022-09-26 19:02 ` [PATCH 0/3] dma/ti: enable udma and psil to be built as modules Péter Ujfalusi
2022-09-26 21:21   ` Kevin Hilman
2022-09-27 17:21     ` Péter Ujfalusi
2022-09-27 23:10       ` Kevin Hilman
2022-09-28 13:54         ` Péter Ujfalusi

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).