]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
iommu/arm-smmu: Play nice on non-ARM/SMMU systems
authorThierry Reding <treding@nvidia.com>
Fri, 7 Nov 2014 15:26:18 +0000 (15:26 +0000)
committerWill Deacon <will.deacon@arm.com>
Fri, 14 Nov 2014 14:41:39 +0000 (14:41 +0000)
Currently the driver registers IOMMU bus operations for all busses even
if no ARM SMMU is present on a system. Depending on the driver probing
order this prevents the driver for the real IOMMU to register itself as
the bus-wide IOMMU.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
drivers/iommu/arm-smmu.c

index c8fc02f111c59b2f04ee3c7126f8b918333f3908..217581469f79cfbed5c1e793f1baa8f8affa4cf0 100644 (file)
@@ -2075,8 +2075,20 @@ static struct platform_driver arm_smmu_driver = {
 
 static int __init arm_smmu_init(void)
 {
+       struct device_node *np;
        int ret;
 
+       /*
+        * Play nice with systems that don't have an ARM SMMU by checking that
+        * an ARM SMMU exists in the system before proceeding with the driver
+        * and IOMMU bus operation registration.
+        */
+       np = of_find_matching_node(NULL, arm_smmu_of_match);
+       if (!np)
+               return 0;
+
+       of_node_put(np);
+
        ret = platform_driver_register(&arm_smmu_driver);
        if (ret)
                return ret;