ARMv7: add patches to fix crash on boot for some devices on multiplatform

This commit is contained in:
Peter Robinson 2015-03-08 23:50:13 +00:00
parent 382c3e3884
commit 94f21fb741
4 changed files with 159 additions and 0 deletions

View File

@ -0,0 +1,48 @@
From: Thierry Reding <treding at nvidia.com>
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.
Reported-by: Nicolas Chauvet <kwizart at gmail.com>
Cc: Kukjin Kim <kgene at kernel.org>
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
Changes in v2:
- drop reference to struct device_node
drivers/iommu/exynos-iommu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 7ce52737c7a1..dc14fec4ede1 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -1186,8 +1186,15 @@ static const struct iommu_ops exynos_iommu_ops = {
static int __init exynos_iommu_init(void)
{
+ struct device_node *np;
int ret;
+ np = of_find_matching_node(NULL, sysmmu_of_match);
+ if (!np)
+ return 0;
+
+ of_node_put(np);
+
lv2table_kmem_cache = kmem_cache_create("exynos-iommu-lv2table",
LV2TABLE_SIZE, LV2TABLE_SIZE, 0, NULL);
if (!lv2table_kmem_cache) {
--
2.1.3

48
arm-fix-iommu-omap.patch Normal file
View File

@ -0,0 +1,48 @@
From: Thierry Reding <treding at nvidia.com>
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.
Reported-by: Nicolas Chauvet <kwizart at gmail.com>
Cc: Tony Lindgren <tony at atomide.com>
Cc: Suman Anna <s-anna at ti.com>
Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
Changes in v2:
- do not fix up module exit function since it's dead code
- drop reference to struct device_node
drivers/iommu/omap-iommu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index f59f857b702e..a4ba851825c2 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1376,6 +1376,13 @@ static int __init omap_iommu_init(void)
struct kmem_cache *p;
const unsigned long flags = SLAB_HWCACHE_ALIGN;
size_t align = 1 << 10; /* L2 pagetable alignement */
+ struct device_node *np;
+
+ np = of_find_matching_node(NULL, omap_iommu_of_match);
+ if (!np)
+ return 0;
+
+ of_node_put(np);
p = kmem_cache_create("iopte_cache", IOPTE_TABLE_SIZE, align, flags,
iopte_cachep_ctor);
--
2.1.3

View File

@ -0,0 +1,51 @@
From: Thierry Reding <treding at nvidia.com>
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.
Reported-by: Nicolas Chauvet <kwizart at gmail.com>
Cc: Heiko Stuebner <heiko at sntech.de>
Cc: Daniel Kurtz <djkurtz at chromium.org>
Reviewed-by: Heiko Stuebner <heiko at sntech.de>
Tested-by: Heiko Stuebner <heiko at sntech.de>
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
Changes in v2:
- do not fix up module exit function since it's dead code
- drop reference to struct device_node
drivers/iommu/rockchip-iommu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 6a8b1ec4a48a..9f74fddcd304 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1015,8 +1015,15 @@ static struct platform_driver rk_iommu_driver = {
static int __init rk_iommu_init(void)
{
+ struct device_node *np;
int ret;
+ np = of_find_matching_node(NULL, rk_iommu_dt_ids);
+ if (!np)
+ return 0;
+
+ of_node_put(np);
+
ret = bus_set_iommu(&platform_bus_type, &rk_iommu_ops);
if (ret)
return ret;
--
2.1.3

View File

@ -592,6 +592,11 @@ Patch21026: pinctrl-pinctrl-single-must-be-initialized-early.patch
Patch21028: arm-i.MX6-Utilite-device-dtb.patch
# IOMMU crash fixes - https://lists.linuxfoundation.org/pipermail/iommu/2015-February/012329.html
Patch21030: arm-fix-iommu-omap.patch
Patch21031: arm-fix-iommu-exynos.patch
Patch21032: arm-fix-iommu-rockchip.patch
Patch21100: arm-highbank-l2-reverts.patch
#rhbz 754518
@ -1215,6 +1220,10 @@ ApplyPatch pinctrl-pinctrl-single-must-be-initialized-early.patch
ApplyPatch arm-i.MX6-Utilite-device-dtb.patch
ApplyPatch arm-fix-iommu-omap.patch
ApplyPatch arm-fix-iommu-exynos.patch
ApplyPatch arm-fix-iommu-rockchip.patch
ApplyPatch arm-highbank-l2-reverts.patch
#
@ -2210,6 +2219,9 @@ fi
#
#
%changelog
* Sun Mar 8 2015 Peter Robinson <pbrobinson@fedoraproject.org>
- ARMv7: add patches to fix crash on boot for some devices on multiplatform
* Fri Mar 06 2015 Josh Boyer <jwboyer@fedoraproject.org> - 4.0.0-0.rc2.git2.1
- Linux v4.0-rc2-255-g5f237425f352