Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 377ddf4e authored by Mayank Rana's avatar Mayank Rana
Browse files

dwc3-msm: Use upstream IOMMU driver based dma_ops() with USB dev



MSM specific IOMMU driver has below limitations:
(a) dma_map_sg() API doesn't support unaligned buffer usage.
(b) It doesn't perform cache flush.
Some of USB usecase (e.g. host mode mass storage case) uses unaligned
buffer with dma_map_sg() API which fails due to above (a) limitation.
Upstream IOMMU driver doesn't have above limitation. Hence to allow
USB SMMU stage S1 functionality use UPSTREAM_IOVA_ALLOCATOR attribute
which sets upstream IOMMU driver's dma_ops() with dev.

Change-Id: I0fd8c1eb38d0db454009d44b86e6d68be9304058
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 42dfac44
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3010,6 +3010,13 @@ static int dwc3_msm_init_iommu(struct dwc3_msm *mdwc)
		return ret;
	}
	dev_dbg(mdwc->dev, "IOMMU mapping created: %pK\n", mdwc->iommu_map);
	ret = iommu_domain_set_attr(mdwc->iommu_map->domain,
			DOMAIN_ATTR_UPSTREAM_IOVA_ALLOCATOR, &atomic_ctx);
	if (ret) {
		dev_err(mdwc->dev, "set UPSTREAM_IOVA_ALLOCATOR failed(%d)\n",
				ret);
		goto release_mapping;
	}

	ret = iommu_domain_set_attr(mdwc->iommu_map->domain, DOMAIN_ATTR_ATOMIC,
			&atomic_ctx);