Skip to contentSkip to conversation

iommu: A couple of urgent fixes

PATCH Superseded Thierry Reding 7 participants 13 messages Feb 4, 2015 – Feb 6, 2015 7 messages not in the archive

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover iommu: A couple of urgent fixes

From: Thierry Reding <[email protected]>

Hi Joerg,

Here are a couple of urgent fixes for a regression on old Tegra devices related to IOMMU support. The issue is that many drivers think it's a good idea to register IOMMU support unconditionally, which is not the smart thing to do at all on multi-platform kernels. This probably went unnoticed for a while because the offending drivers aren't enabled in any of the multi-platform default configurations. Fedora ARM has their own config where the offending drivers did get enabled, hence caused a regression on Tegra20. I would expect the same regression to exist on a number of other SoCs, possibly all that support IOMMU.

I've tried to keep the patches minimal in the hopes of still getting this into v3.19-rc8 or the final release to avoid the regression.

Thierry

Thierry Reding (4):
iommu/exynos: Play nice in multi-platform builds iommu/omap: Play nice in multi-platform builds iommu/rockchip: Play nice in multi-platform builds iommu/msm: Mark driver BROKEN

 drivers/iommu/Kconfig          | 1 +
 drivers/iommu/exynos-iommu.c   | 3 +++
 drivers/iommu/omap-iommu.c     | 6 ++++++
 drivers/iommu/rockchip-iommu.c | 6 ++++++
 4 files changed, 16 insertions(+)
Signature · 1 line
2.1.3

A message that is not in the archive (sent off-list or not yet received): 1423036690-3862-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/4 iommu/exynos: Play nice in multi-platform builds

From: Thierry Reding <[email protected]>

The Exynos System MMU driver unconditionally executes code and registers a struct iommu_ops with the platform bus irrespective of whether it runs on an Exynos SoC or not. This causes problems in multi-platform kernels where drivers for other SoCs will no longer be able to register their own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU that obviously isn't there.

The smallest fix I could think of is to check for the existence of any Exynos System MMU devices in the device tree and skip initialization otherwise.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent Exynos System MMU.

---
 drivers/iommu/exynos-iommu.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/iommu/exynos-iommu.c +3 -0
index 7ce52737c7a1..d4b41fa32368 100644
@@ -1188,6 +1188,9 @@ static int __init exynos_iommu_init(void)
 {
 	int ret;
 
+	if (!of_find_matching_node(NULL, sysmmu_of_match))
+		return 0;
+
 	lv2table_kmem_cache = kmem_cache_create("exynos-iommu-lv2table",
 				LV2TABLE_SIZE, LV2TABLE_SIZE, 0, NULL);
 	if (!lv2table_kmem_cache) {
Signature · 1 line
2.1.3

A message that is not in the archive (sent off-list or not yet received): 1423036690-3862-2-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Re: [PATCH 1/4] iommu/exynos: Play nice in multi-platform builds

Hello,

Quoted 13 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The Exynos System MMU driver unconditionally executes code and registers a struct iommu_ops with the platform bus irrespective of whether it runs on an Exynos SoC or not. This causes problems in multi-platform kernels where drivers for other SoCs will no longer be able to register their own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU that obviously isn't there.

The smallest fix I could think of is to check for the existence of any Exynos System MMU devices in the device tree and skip initialization otherwise.

Quoted 6 lines

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent Exynos System MMU.

Frankly, you may mark the existing exynos iommu driver as BROKEN, what will solve a few other issues as well. In the current version this driver is not functional and not used on any platform. I thought that my fixes will get into v3.20, but it looks that it won't happen.

Quoted 9 lines
---
  drivers/iommu/exynos-iommu.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/iommu/exynos-iommu.c +0 -0
index 7ce52737c7a1..d4b41fa32368 100644

drivers/iommu/exynos-iommu.c static int __init exynos_iommu_init(void) · line 1196

Quoted 9 lines
drivers/iommu/exynos-iommu.c +3 -0
@@ -1188,6 +1188,9 @@ static int __init exynos_iommu_init(void)
  {
  	int ret;
 
+	if (!of_find_matching_node(NULL, sysmmu_of_match))
+		return 0;
+
  	lv2table_kmem_cache = kmem_cache_create("exynos-iommu-lv2table",
  				LV2TABLE_SIZE, LV2TABLE_SIZE, 0, NULL);
  	if (!lv2table_kmem_cache) {

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
#5 lore raw

PATCH 2/4 iommu/omap: Play nice in multi-platform builds

In reply to a message not in the archive

From: Thierry Reding <[email protected]>

The OMAP IOMMU driver unconditionally executes code and registers a struct iommu_ops with the platform bus irrespective of whether it runs on an OMAP SoC or not. This causes problems in multi-platform kernels where drivers for other SoCs will no longer be able to register their own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU that obviously isn't there.

The smallest fix I could think of is to check for the existence of any OMAP IOMMU devices in the device tree and skip initialization otherwise.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent OMAP IOMMU.

Cc Tony Lindgren <[email protected]>
Cc Suman Anna <[email protected]>
Cc Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]>
---
 drivers/iommu/omap-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/omap-iommu.c +6 -0
index bbb7dcef02d3..e4d4f133a3b3 100644
@@ -1377,6 +1377,9 @@ static int __init omap_iommu_init(void)
 	const unsigned long flags = SLAB_HWCACHE_ALIGN;
 	size_t align = 1 << 10; /* L2 pagetable alignement */
 
+	if (!of_find_matching_node(NULL, omap_iommu_of_match))
+		return 0;
+
 	p = kmem_cache_create("iopte_cache", IOPTE_TABLE_SIZE, align, flags,
 			      iopte_cachep_ctor);
 	if (!p)
@@ -1394,6 +1397,9 @@ subsys_initcall(omap_iommu_init);
 
 static void __exit omap_iommu_exit(void)
 {
+	if (!of_find_matching_node(NULL, omap_iommu_of_match))
+		return;
+
 	kmem_cache_destroy(iopte_cachep);
 
 	platform_driver_unregister(&omap_iommu_driver);
Signature · 1 line
2.1.3

A message that is not in the archive (sent off-list or not yet received): 1423036690-3862-3-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#7 lore raw

Re: [PATCH 2/4] iommu/omap: Play nice in multi-platform builds

Hi Thierry,

Thank you for the patch.

Quoted 29 lines · On Wednesday 04 February 2015 08:58:08 Thierry Reding wrote:

From: Thierry Reding <[email protected]>

The OMAP IOMMU driver unconditionally executes code and registers a struct iommu_ops with the platform bus irrespective of whether it runs on an OMAP SoC or not. This causes problems in multi-platform kernels where drivers for other SoCs will no longer be able to register their own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU that obviously isn't there.

The smallest fix I could think of is to check for the existence of any OMAP IOMMU devices in the device tree and skip initialization otherwise.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent OMAP IOMMU.

Cc Tony Lindgren <[email protected]>
Cc Suman Anna <[email protected]>
Cc Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]>
---
 drivers/iommu/omap-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/omap-iommu.c +0 -0
index bbb7dcef02d3..e4d4f133a3b3 100644

drivers/iommu/omap-iommu.c static int __init omap_iommu_init(void) · line 1382

Quoted 6 lines
drivers/iommu/omap-iommu.c +3 -0
@@ -1377,6 +1377,9 @@ static int __init omap_iommu_init(void)
 	const unsigned long flags = SLAB_HWCACHE_ALIGN;
 	size_t align = 1 << 10; /* L2 pagetable alignement */
 
+	if (!of_find_matching_node(NULL, omap_iommu_of_match))
+		return 0;
+

We should convert the omap-iommu driver to proper DT instantiation, but this should do for now.

drivers/iommu/omap-iommu.c subsys_initcall(omap_iommu_init); · line 1405

Quoted 13 lines
drivers/iommu/omap-iommu.c +3 -0
 	p = kmem_cache_create("iopte_cache", IOPTE_TABLE_SIZE, align, flags,
 			      iopte_cachep_ctor);
 	if (!p)
@@ -1394,6 +1397,9 @@ subsys_initcall(omap_iommu_init);
 
 static void __exit omap_iommu_exit(void)
 {
+	if (!of_find_matching_node(NULL, omap_iommu_of_match))
+		return;
+
 	kmem_cache_destroy(iopte_cachep);
 
 	platform_driver_unregister(&omap_iommu_driver);

The exit function will never be called as the omap-iommu driver is always built-in. You could just remove the exit function.

Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

Re: [PATCH 2/4] iommu/omap: Play nice in multi-platform builds

Hi Thierry,

Quoted 37 lines · Laurent Pinchart

Hi Thierry,

Thank you for the patch.

Quoted 32 lines · On Wednesday 04 February 2015 08:58:08 Thierry Reding wrote:

From: Thierry Reding <[email protected]>

The OMAP IOMMU driver unconditionally executes code and registers a struct iommu_ops with the platform bus irrespective of whether it runs on an OMAP SoC or not. This causes problems in multi-platform kernels where drivers for other SoCs will no longer be able to register their own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU that obviously isn't there.

The smallest fix I could think of is to check for the existence of any OMAP IOMMU devices in the device tree and skip initialization otherwise.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent OMAP IOMMU.

Cc Tony Lindgren <[email protected]>
Cc Suman Anna <[email protected]>
Cc Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]>
---
 drivers/iommu/omap-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/omap-iommu.c +0 -0
index bbb7dcef02d3..e4d4f133a3b3 100644
@@ -1377,6 +1377,9 @@ static int __init omap_iommu_init(void)
 	const unsigned long flags = SLAB_HWCACHE_ALIGN;
 	size_t align = 1 << 10; /* L2 pagetable alignement */
 
Quoted 3 lines

drivers/iommu/omap-iommu.c static int __init omap_iommu_init(void) · line 1382

Quoted 3 lines
drivers/iommu/omap-iommu.c +3 -0
+	if (!of_find_matching_node(NULL, omap_iommu_of_match))
+		return 0;
+

Need to call the of_node_put on the cases it succeeds right, you should change this to the semantics you used in the arm-smmu driver.

Quoted 3 lines

We should convert the omap-iommu driver to proper DT instantiation, but this should do for now.

Agreed, and I think this check is better than the iommu_present check used in some of the other IOMMU drivers, as that would work for a SoC family only if that is the first one getting registered.

regards
Suman

Quoted 18 lines
Quoted 5 lines
drivers/iommu/omap-iommu.c +0 -0
 	p = kmem_cache_create("iopte_cache", IOPTE_TABLE_SIZE, align, flags,
 			      iopte_cachep_ctor);
 	if (!p)

drivers/iommu/omap-iommu.c subsys_initcall(omap_iommu_init); · line 1405

Quoted 9 lines
drivers/iommu/omap-iommu.c +3 -0
@@ -1394,6 +1397,9 @@ subsys_initcall(omap_iommu_init);
 
 static void __exit omap_iommu_exit(void)
 {
+	if (!of_find_matching_node(NULL, omap_iommu_of_match))
+		return;
+
 	kmem_cache_destroy(iopte_cachep);
 
 	platform_driver_unregister(&omap_iommu_driver);

The exit function will never be called as the omap-iommu driver is always built-in. You could just remove the exit function.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Re: [PATCH 2/4] iommu/omap: Play nice in multi-platform builds

Quoted 40 lines · Suman Anna

Hi Thierry,

Quoted 37 lines · Laurent Pinchart

Hi Thierry,

Thank you for the patch.

Quoted 32 lines · On Wednesday 04 February 2015 08:58:08 Thierry Reding wrote:

From: Thierry Reding <[email protected]>

The OMAP IOMMU driver unconditionally executes code and registers a struct iommu_ops with the platform bus irrespective of whether it runs on an OMAP SoC or not. This causes problems in multi-platform kernels where drivers for other SoCs will no longer be able to register their own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU that obviously isn't there.

The smallest fix I could think of is to check for the existence of any OMAP IOMMU devices in the device tree and skip initialization otherwise.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent OMAP IOMMU.

Cc Tony Lindgren <[email protected]>
Cc Suman Anna <[email protected]>
Cc Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]>
---
 drivers/iommu/omap-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/omap-iommu.c +0 -0
index bbb7dcef02d3..e4d4f133a3b3 100644
@@ -1377,6 +1377,9 @@ static int __init omap_iommu_init(void)
 	const unsigned long flags = SLAB_HWCACHE_ALIGN;
 	size_t align = 1 << 10; /* L2 pagetable alignement */
 
Quoted 6 lines
Quoted 3 lines

drivers/iommu/omap-iommu.c static int __init omap_iommu_init(void) · line 1382

Quoted 3 lines
drivers/iommu/omap-iommu.c +3 -0
+	if (!of_find_matching_node(NULL, omap_iommu_of_match))
+		return 0;
+

Need to call the of_node_put on the cases it succeeds right, you should change this to the semantics you used in the arm-smmu driver.

Good point. I've sent out an updated set of patches.

Thierry

#11 lore raw

Re: [PATCH 2/4] iommu/omap: Play nice in multi-platform builds

In reply to Laurent Pinchart
Quoted 56 lines · Laurent Pinchart

Hi Thierry,

Thank you for the patch.

Quoted 29 lines · On Wednesday 04 February 2015 08:58:08 Thierry Reding wrote:

From: Thierry Reding <[email protected]>

The OMAP IOMMU driver unconditionally executes code and registers a struct iommu_ops with the platform bus irrespective of whether it runs on an OMAP SoC or not. This causes problems in multi-platform kernels where drivers for other SoCs will no longer be able to register their own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU that obviously isn't there.

The smallest fix I could think of is to check for the existence of any OMAP IOMMU devices in the device tree and skip initialization otherwise.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent OMAP IOMMU.

Cc Tony Lindgren <[email protected]>
Cc Suman Anna <[email protected]>
Cc Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]>
---
 drivers/iommu/omap-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/omap-iommu.c +0 -0
index bbb7dcef02d3..e4d4f133a3b3 100644

drivers/iommu/omap-iommu.c static int __init omap_iommu_init(void) · line 1382

Quoted 6 lines
drivers/iommu/omap-iommu.c +3 -0
@@ -1377,6 +1377,9 @@ static int __init omap_iommu_init(void)
 	const unsigned long flags = SLAB_HWCACHE_ALIGN;
 	size_t align = 1 << 10; /* L2 pagetable alignement */
 
+	if (!of_find_matching_node(NULL, omap_iommu_of_match))
+		return 0;
+

We should convert the omap-iommu driver to proper DT instantiation, but this should do for now.

Quoted 12 lines
drivers/iommu/omap-iommu.c +3 -0
 	p = kmem_cache_create("iopte_cache", IOPTE_TABLE_SIZE, align, flags,
 			      iopte_cachep_ctor);
 	if (!p)
@@ -1394,6 +1397,9 @@ subsys_initcall(omap_iommu_init);
 
 static void __exit omap_iommu_exit(void)
 {
+	if (!of_find_matching_node(NULL, omap_iommu_of_match))
+		return;
+
 	kmem_cache_destroy(iopte_cachep);
 
Quoted 4 lines

drivers/iommu/omap-iommu.c subsys_initcall(omap_iommu_init); · line 1405

Quoted 1 line
drivers/iommu/omap-iommu.c +0 -0
 	platform_driver_unregister(&omap_iommu_driver);

The exit function will never be called as the omap-iommu driver is always built-in. You could just remove the exit function.

I've omitted this hunk since this code will not run anyway. I agree that we should remove the code altogether if it's dead anyway, but that kind of cleanup isn't really suitable for patches this late in the release cycle.

Thierry

#12 lore raw

PATCH 3/4 iommu/rockchip: Play nice in multi-platform builds

In reply to a message not in the archive

From: Thierry Reding <[email protected]>

The Rockchip IOMMU driver unconditionally executes code and registers a struct iommu_ops with the platform bus irrespective of whether it runs on a Rockchip SoC or not. This causes problems in multi-platform kernels where drivers for other SoCs will no longer be able to register their own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU that obviously isn't there.

The smallest fix I could think of is to check for the existence of any Rockchip IOMMU devices in the device tree and skip initialization otherwise.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent Rockchip IOMMU.

---
 drivers/iommu/rockchip-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/rockchip-iommu.c +6 -0
index 6a8b1ec4a48a..869e9c9d5df7 100644
@@ -1017,6 +1017,9 @@ static int __init rk_iommu_init(void)
 {
 	int ret;
 
+	if (!of_find_matching_node(NULL, rk_iommu_dt_ids))
+		return 0;
+
 	ret = bus_set_iommu(&platform_bus_type, &rk_iommu_ops);
 	if (ret)
 		return ret;
@@ -1025,6 +1028,9 @@ static int __init rk_iommu_init(void)
 }
 static void __exit rk_iommu_exit(void)
 {
+	if (!of_find_matching_node(NULL, rk_iommu_dt_ids))
+		return;
+
 	platform_driver_unregister(&rk_iommu_driver);
 }
 
Signature · 1 line
2.1.3

A message that is not in the archive (sent off-list or not yet received): 1423036690-3862-4-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Reviewed-by Tested-by
#14 lore raw

Re: [PATCH 3/4] iommu/rockchip: Play nice in multi-platform builds

Hi Thierry,

Am Mittwoch, 4. Februar 2015, 08:58:09 schrieb Thierry Reding:

Quoted 13 lines

From: Thierry Reding <[email protected]>

The Rockchip IOMMU driver unconditionally executes code and registers a struct iommu_ops with the platform bus irrespective of whether it runs on a Rockchip SoC or not. This causes problems in multi-platform kernels where drivers for other SoCs will no longer be able to register their own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU that obviously isn't there.

The smallest fix I could think of is to check for the existence of any Rockchip IOMMU devices in the device tree and skip initialization otherwise.

Quoted 7 lines

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent Rockchip IOMMU.

on a rk3288-firefly with drm through the hdmi connector

#15 lore raw

PATCH 4/4 iommu/msm: Mark driver BROKEN

In reply to a message not in the archive

From: Thierry Reding <[email protected]>

The MSM IOMMU driver unconditionally calls bus_set_iommu(), which is a very stupid thing to do on multi-platform kernels. While marking the driver BROKEN may seem a little extreme, there is no other way to make the driver skip initialization. One of the problems is that it doesn't have devicetree binding documentation and the driver doesn't contain a struct of_device_id table either, so no way to check that it is indeed valid to set up the IOMMU operations for this driver.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent MSM IOMMU.

Marking the driver BROKEN shouldn't do any harm, since there aren't any users currently. There is no struct of_device_id table, so the device can't be instantiated from device tree, and I couldn't find any code that would instantiate a matching platform_device either, so the driver is effectively unused.

Cc David Brown <[email protected]>
Cc Daniel Walker <[email protected]>
Cc Bryan Huntsman <[email protected]>
Cc Olav Haugan <[email protected]>
---
 drivers/iommu/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/iommu/Kconfig +1 -0
index 325188eef1c1..0f70bc1fce65 100644
@@ -31,6 +31,7 @@ config FSL_PAMU
 config MSM_IOMMU
 	bool "MSM IOMMU Support"
 	depends on ARCH_MSM8X60 || ARCH_MSM8960
+	depends on BROKEN
 	select IOMMU_API
 	help
 	  Support for the IOMMUs found on certain Qualcomm SOCs.
Signature · 1 line
2.1.3

A message that is not in the archive (sent off-list or not yet received): 1423036690-3862-5-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#17 lore raw

Re: [PATCH 4/4] iommu/msm: Mark driver BROKEN

Adding Mitch H. and Rob Clark.

Quoted 35 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The MSM IOMMU driver unconditionally calls bus_set_iommu(), which is a very stupid thing to do on multi-platform kernels. While marking the driver BROKEN may seem a little extreme, there is no other way to make the driver skip initialization. One of the problems is that it doesn't have devicetree binding documentation and the driver doesn't contain a struct of_device_id table either, so no way to check that it is indeed valid to set up the IOMMU operations for this driver.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent MSM IOMMU.

Marking the driver BROKEN shouldn't do any harm, since there aren't any users currently. There is no struct of_device_id table, so the device can't be instantiated from device tree, and I couldn't find any code that would instantiate a matching platform_device either, so the driver is effectively unused.

Cc David Brown <[email protected]>
Cc Daniel Walker <[email protected]>
Cc Bryan Huntsman <[email protected]>
Cc Olav Haugan <[email protected]>
---
  drivers/iommu/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/iommu/Kconfig +0 -0
index 325188eef1c1..0f70bc1fce65 100644

drivers/iommu/Kconfig config FSL_PAMU · line 37

Quoted 7 lines
drivers/iommu/Kconfig +1 -0
@@ -31,6 +31,7 @@ config FSL_PAMU
  config MSM_IOMMU
  	bool "MSM IOMMU Support"
  	depends on ARCH_MSM8X60 || ARCH_MSM8960
+	depends on BROKEN
  	select IOMMU_API
  	help
  	  Support for the IOMMUs found on certain Qualcomm SOCs.

.Olav

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

A message that is not in the archive (sent off-list or not yet received): [email protected]

Acked-by
#19 lore raw

Re: [PATCH 4/4] iommu/msm: Mark driver BROKEN

Quoted 2 lines · Olav Haugan

Adding Mitch H. and Rob Clark.

The current upstream msm-iommu isn't actually used by anything, afaict.. it lacks support for DT based platforms. So this is fine by me.

Quoted 53 lines · Thierry Reding
Quoted 36 lines

From: Thierry Reding <[email protected]>

The MSM IOMMU driver unconditionally calls bus_set_iommu(), which is a very stupid thing to do on multi-platform kernels. While marking the driver BROKEN may seem a little extreme, there is no other way to make the driver skip initialization. One of the problems is that it doesn't have devicetree binding documentation and the driver doesn't contain a struct of_device_id table either, so no way to check that it is indeed valid to set up the IOMMU operations for this driver.

This fixes a problem on Tegra20 where the DRM driver will try to use the obviously non-existent MSM IOMMU.

Marking the driver BROKEN shouldn't do any harm, since there aren't any users currently. There is no struct of_device_id table, so the device can't be instantiated from device tree, and I couldn't find any code that would instantiate a matching platform_device either, so the driver is effectively unused.

Cc David Brown <[email protected]>
Cc Daniel Walker <[email protected]>
Cc Bryan Huntsman <[email protected]>
Cc Olav Haugan <[email protected]>
---
  drivers/iommu/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/iommu/Kconfig +0 -0
index 325188eef1c1..0f70bc1fce65 100644

drivers/iommu/Kconfig config FSL_PAMU · line 37

Quoted 7 lines
drivers/iommu/Kconfig +1 -0
@@ -31,6 +31,7 @@ config FSL_PAMU
  config MSM_IOMMU
        bool "MSM IOMMU Support"
        depends on ARCH_MSM8X60 || ARCH_MSM8960
+       depends on BROKEN
        select IOMMU_API
        help
          Support for the IOMMUs found on certain Qualcomm SOCs.

.Olav

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project