On 2022-04-06 15:32, Dmitry Osipenko wrote:
On 4/5/22 17:19, Robin Murphy wrote:
Remove the pointless check. host1x_drm_wants_iommu() cannot return true unless an IOMMU exists for the host1x platform device, which at the moment means the iommu_present() test could never fail.
Signed-off-by: Robin Murphy robin.murphy@arm.com
drivers/gpu/drm/tegra/drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 9464f522e257..bc4321561400 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1149,7 +1149,7 @@ static int host1x_drm_probe(struct host1x_device *dev) goto put; }
- if (host1x_drm_wants_iommu(dev) && iommu_present(&platform_bus_type)) {
- if (host1x_drm_wants_iommu(dev)) { tegra->domain = iommu_domain_alloc(&platform_bus_type); if (!tegra->domain) { err = -ENOMEM;
host1x_drm_wants_iommu() returns true if there is no IOMMU for the host1x platform device of Tegra20/30 SoCs.
Ah, apparently this is another example of what happens when I write patches late on a Friday night...
So on second look, what we want to ascertain here is whether dev has an IOMMU, but only if the host1x parent is not addressing-limited, either because it can also use the IOMMU, or because all possible addresses are small enough anyway, right? Are we specifically looking for the host1x having a DMA-API-managed domain, or can that also end up using the tegra->domain or another unmanaged domain too? I can't quite figure out from the comments whether it's physical addresses, IOVAs, or both that we're concerned with here.
Thanks, Robin.