iommu: arm-smmu: Handle multiple arm-smmu instances
There may be multiple instances of an iommu present on the same bus.
Ensure the add_device() callback is called for each iommu instance,
rather than just the first one.
Change-Id: Ia55ef6e8ed3bd85214d111bb29f4e22ca696b185
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 59f913e..c344673 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -3628,6 +3628,14 @@
return 0;
}
+static int arm_smmu_add_device_fixup(struct device *dev, void *data)
+{
+ struct iommu_ops *ops = data;
+
+ ops->add_device(dev);
+ return 0;
+}
+
static int qsmmuv500_tbu_register(struct device *dev, void *data);
static int arm_smmu_device_dt_probe(struct platform_device *pdev)
{
@@ -3767,6 +3775,9 @@
/* Oh, for a proper bus abstraction */
if (!iommu_present(&platform_bus_type))
bus_set_iommu(&platform_bus_type, &arm_smmu_ops);
+ else
+ bus_for_each_dev(&platform_bus_type, NULL, &arm_smmu_ops,
+ arm_smmu_add_device_fixup);
#ifdef CONFIG_ARM_AMBA
if (!iommu_present(&amba_bustype))
bus_set_iommu(&amba_bustype, &arm_smmu_ops);