[PATCH] iommu/ipmmu-vmsa: Don't register as BUS IOMMU if machine doesn't have IPMMU-VMSA

Paolo Pisati paolo.pisati at canonical.com
Tue Sep 11 11:00:08 UTC 2018


From: Dmitry Osipenko <digetx at gmail.com>

BugLink: https://bugs.launchpad.net/bugs/1783746

commit 5c5c87411488af3cd082221e567498d813d0fe83 upstream.

This fixes kernel crashing on NVIDIA Tegra if kernel is compiled in
a multiplatform configuration and IPMMU-VMSA driver is enabled.

Cc: <stable at vger.kernel.org> # v3.20+
Signed-off-by: Dmitry Osipenko <digetx at gmail.com>
Signed-off-by: Joerg Roedel <jroedel at suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>

(cherry picked from commit 3245925a8e9c4fb5f2ccb2b7c21d2cb35ce8725a)
Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
---
 drivers/iommu/ipmmu-vmsa.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 8dce3a9..2435103 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -1081,12 +1081,19 @@ static struct platform_driver ipmmu_driver = {
 
 static int __init ipmmu_init(void)
 {
+	struct device_node *np;
 	static bool setup_done;
 	int ret;
 
 	if (setup_done)
 		return 0;
 
+	np = of_find_matching_node(NULL, ipmmu_of_ids);
+	if (!np)
+		return 0;
+
+	of_node_put(np);
+
 	ret = platform_driver_register(&ipmmu_driver);
 	if (ret < 0)
 		return ret;
-- 
2.7.4





More information about the kernel-team mailing list