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

Commit d2c81e06 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: smmu: add re-route calling for specified iova when mapping"

parents 3b0f5d0b bdac1e68
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -120,17 +120,31 @@ static int msm_smmu_map(struct msm_mmu *mmu, uint64_t iova,
{
	struct msm_smmu *smmu = to_msm_smmu(mmu);
	struct msm_smmu_client *client = msm_smmu_to_client(smmu);
	struct iommu_domain *domain;
	int ret;

	if (!client || !sgt)
		return -EINVAL;

	if (iova != 0) {
		if (!client->mmu_mapping || !client->mmu_mapping->domain)
			return -EINVAL;

		domain = client->mmu_mapping->domain;

		return iommu_map_sg(domain, iova, sgt->sgl,
				sgt->nents, flags);
	} else {
		if (priv)
		ret = msm_dma_map_sg_lazy(client->dev, sgt->sgl, sgt->nents,
			DMA_BIDIRECTIONAL, priv);
			ret = msm_dma_map_sg_lazy(client->dev, sgt->sgl,
					sgt->nents, DMA_BIDIRECTIONAL, priv);
		else
			ret = dma_map_sg(client->dev, sgt->sgl, sgt->nents,
				DMA_BIDIRECTIONAL);

		return (ret != sgt->nents) ? -ENOMEM : 0;
	}
}

static void msm_smmu_unmap(struct msm_mmu *mmu, uint64_t iova,
		struct sg_table *sgt, void *priv)