|
|
fa02ba3 |
From: Thierry Reding <treding@nvidia.com>
|
|
|
fa02ba3 |
Date: Fri, 6 Feb 2015 11:44:06 +0100
|
|
|
fa02ba3 |
Subject: [PATCH] iommu/omap: Play nice in multi-platform builds
|
|
|
fa02ba3 |
|
|
|
fa02ba3 |
The OMAP IOMMU driver unconditionally executes code and registers a
|
|
|
fa02ba3 |
struct iommu_ops with the platform bus irrespective of whether it runs
|
|
|
fa02ba3 |
on an OMAP SoC or not. This causes problems in multi-platform kernels
|
|
|
fa02ba3 |
where drivers for other SoCs will no longer be able to register their
|
|
|
fa02ba3 |
own struct iommu_ops or even try to use a struct iommu_ops for an IOMMU
|
|
|
fa02ba3 |
that obviously isn't there.
|
|
|
fa02ba3 |
|
|
|
fa02ba3 |
The smallest fix I could think of is to check for the existence of any
|
|
|
fa02ba3 |
OMAP IOMMU devices in the device tree and skip initialization otherwise.
|
|
|
fa02ba3 |
|
|
|
fa02ba3 |
This fixes a problem on Tegra20 where the DRM driver will try to use the
|
|
|
fa02ba3 |
obviously non-existent OMAP IOMMU.
|
|
|
fa02ba3 |
|
|
|
fa02ba3 |
Reported-by: Nicolas Chauvet <kwizart@gmail.com>
|
|
|
fa02ba3 |
Cc: Tony Lindgren <tony@atomide.com>
|
|
|
fa02ba3 |
Cc: Suman Anna <s-anna@ti.com>
|
|
|
fa02ba3 |
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
|
fa02ba3 |
Signed-off-by: Thierry Reding <treding@nvidia.com>
|
|
|
fa02ba3 |
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
|
fa02ba3 |
Signed-off-by: Joerg Roedel <jroedel@suse.de>
|
|
|
fa02ba3 |
---
|
|
|
fa02ba3 |
drivers/iommu/omap-iommu.c | 7 +++++++
|
|
|
fa02ba3 |
1 file changed, 7 insertions(+)
|
|
|
fa02ba3 |
|
|
|
fa02ba3 |
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
|
|
|
fa02ba3 |
index bbb7dcef02d3..19db0b684b7f 100644
|
|
|
fa02ba3 |
--- a/drivers/iommu/omap-iommu.c
|
|
|
fa02ba3 |
+++ b/drivers/iommu/omap-iommu.c
|
|
|
fa02ba3 |
@@ -1376,6 +1376,13 @@ static int __init omap_iommu_init(void)
|
|
|
fa02ba3 |
struct kmem_cache *p;
|
|
|
fa02ba3 |
const unsigned long flags = SLAB_HWCACHE_ALIGN;
|
|
|
fa02ba3 |
size_t align = 1 << 10; /* L2 pagetable alignement */
|
|
|
fa02ba3 |
+ struct device_node *np;
|
|
|
fa02ba3 |
+
|
|
|
fa02ba3 |
+ np = of_find_matching_node(NULL, omap_iommu_of_match);
|
|
|
fa02ba3 |
+ if (!np)
|
|
|
fa02ba3 |
+ return 0;
|
|
|
fa02ba3 |
+
|
|
|
fa02ba3 |
+ of_node_put(np);
|
|
|
fa02ba3 |
|
|
|
fa02ba3 |
p = kmem_cache_create("iopte_cache", IOPTE_TABLE_SIZE, align, flags,
|
|
|
fa02ba3 |
iopte_cachep_ctor);
|
|
|
fa02ba3 |
--
|
|
|
fa02ba3 |
2.1.0
|
|
|
fa02ba3 |
|