Skip to content

Commit c9b4a31

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu/omap: Add minimal fwnode support
The OMAP driver uses the generic "iommus" DT binding but is the final holdout not implementing a corresponding .of_xlate method. Unfortunately this now results in __iommu_probe_device() failing to find ops due to client devices missing the expected IOMMU fwnode association. The legacy DT parsing in omap_iommu_probe_device() could probably all be delegated to generic code now, but for the sake of an immediate fix, just add a minimal .of_xlate implementation to allow client fwspecs to be created appropriately, and so the ops lookup to work again. This means we also need to register the additional instances on DRA7 so that of_iommu_xlate() doesn't defer indefinitely waiting for their ops either, but we'll continue to hide them from sysfs just in case. This also renders the bus_iommu_probe() call entirely redundant. Reported-by: Beleswar Padhi <[email protected]> Link: https://lore.kernel.org/linux-iommu/[email protected]/ Reported-by: H. Nikolaus Schaller <[email protected]> Link: https://lore.kernel.org/linux-media/[email protected]/ Fixes: 17de3f5 ("iommu: Retire bus ops") Signed-off-by: Robin Murphy <[email protected]> Tested-by: H. Nikolaus Schaller <[email protected]> Reviewed-by: Kevin Hilman <[email protected]> Tested-by: Kevin Hilman <[email protected]> Tested-by: Beleswar Padhi <[email protected]> Link: https://lore.kernel.org/r/cfd766f96bc799e32b97f4664707adbcf99097b0.1730136799.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent 8e929cb commit c9b4a31

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

drivers/iommu/omap-iommu.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,36 +1230,35 @@ static int omap_iommu_probe(struct platform_device *pdev)
12301230
if (err)
12311231
return err;
12321232

1233-
err = iommu_device_register(&obj->iommu, &omap_iommu_ops, &pdev->dev);
1234-
if (err)
1235-
goto out_sysfs;
12361233
obj->has_iommu_driver = true;
12371234
}
12381235

1236+
err = iommu_device_register(&obj->iommu, &omap_iommu_ops, &pdev->dev);
1237+
if (err)
1238+
goto out_sysfs;
1239+
12391240
pm_runtime_enable(obj->dev);
12401241

12411242
omap_iommu_debugfs_add(obj);
12421243

12431244
dev_info(&pdev->dev, "%s registered\n", obj->name);
12441245

1245-
/* Re-probe bus to probe device attached to this IOMMU */
1246-
bus_iommu_probe(&platform_bus_type);
1247-
12481246
return 0;
12491247

12501248
out_sysfs:
1251-
iommu_device_sysfs_remove(&obj->iommu);
1249+
if (obj->has_iommu_driver)
1250+
iommu_device_sysfs_remove(&obj->iommu);
12521251
return err;
12531252
}
12541253

12551254
static void omap_iommu_remove(struct platform_device *pdev)
12561255
{
12571256
struct omap_iommu *obj = platform_get_drvdata(pdev);
12581257

1259-
if (obj->has_iommu_driver) {
1258+
if (obj->has_iommu_driver)
12601259
iommu_device_sysfs_remove(&obj->iommu);
1261-
iommu_device_unregister(&obj->iommu);
1262-
}
1260+
1261+
iommu_device_unregister(&obj->iommu);
12631262

12641263
omap_iommu_debugfs_remove(obj);
12651264

@@ -1723,12 +1722,19 @@ static void omap_iommu_release_device(struct device *dev)
17231722

17241723
}
17251724

1725+
static int omap_iommu_of_xlate(struct device *dev, const struct of_phandle_args *args)
1726+
{
1727+
/* TODO: collect args->np to save re-parsing in probe above */
1728+
return 0;
1729+
}
1730+
17261731
static const struct iommu_ops omap_iommu_ops = {
17271732
.identity_domain = &omap_iommu_identity_domain,
17281733
.domain_alloc_paging = omap_iommu_domain_alloc_paging,
17291734
.probe_device = omap_iommu_probe_device,
17301735
.release_device = omap_iommu_release_device,
17311736
.device_group = generic_single_device_group,
1737+
.of_xlate = omap_iommu_of_xlate,
17321738
.pgsize_bitmap = OMAP_IOMMU_PGSIZES,
17331739
.default_domain_ops = &(const struct iommu_domain_ops) {
17341740
.attach_dev = omap_iommu_attach_dev,

0 commit comments

Comments
 (0)