Merge "Revert "msm: smmu: add re-route calling for specified iova.""
This commit is contained in:
commit
16fcfea171
1 changed files with 13 additions and 41 deletions
|
@ -120,30 +120,16 @@ static int msm_smmu_map(struct msm_mmu *mmu, uint64_t iova,
|
||||||
{
|
{
|
||||||
struct msm_smmu *smmu = to_msm_smmu(mmu);
|
struct msm_smmu *smmu = to_msm_smmu(mmu);
|
||||||
struct msm_smmu_client *client = msm_smmu_to_client(smmu);
|
struct msm_smmu_client *client = msm_smmu_to_client(smmu);
|
||||||
struct iommu_domain *domain;
|
|
||||||
int ret;
|
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)
|
if (priv)
|
||||||
ret = msm_dma_map_sg_lazy(client->dev, sgt->sgl,
|
ret = msm_dma_map_sg_lazy(client->dev, sgt->sgl, sgt->nents,
|
||||||
sgt->nents, DMA_BIDIRECTIONAL, priv);
|
DMA_BIDIRECTIONAL, priv);
|
||||||
else
|
else
|
||||||
ret = dma_map_sg(client->dev, sgt->sgl, sgt->nents,
|
ret = dma_map_sg(client->dev, sgt->sgl, sgt->nents,
|
||||||
DMA_BIDIRECTIONAL);
|
DMA_BIDIRECTIONAL);
|
||||||
|
|
||||||
return (ret != sgt->nents) ? -ENOMEM : 0;
|
return (ret != sgt->nents) ? -ENOMEM : 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void msm_smmu_unmap(struct msm_mmu *mmu, uint64_t iova,
|
static void msm_smmu_unmap(struct msm_mmu *mmu, uint64_t iova,
|
||||||
|
@ -151,27 +137,13 @@ static void msm_smmu_unmap(struct msm_mmu *mmu, uint64_t iova,
|
||||||
{
|
{
|
||||||
struct msm_smmu *smmu = to_msm_smmu(mmu);
|
struct msm_smmu *smmu = to_msm_smmu(mmu);
|
||||||
struct msm_smmu_client *client = msm_smmu_to_client(smmu);
|
struct msm_smmu_client *client = msm_smmu_to_client(smmu);
|
||||||
struct iommu_domain *domain = client->mmu_mapping->domain;
|
|
||||||
struct scatterlist *sg;
|
|
||||||
size_t len = 0;
|
|
||||||
int unmapped, i = 0;
|
|
||||||
|
|
||||||
if (iova != 0) {
|
|
||||||
for_each_sg(sgt->sgl, sg, sgt->nents, i)
|
|
||||||
len += sg->length;
|
|
||||||
|
|
||||||
unmapped = iommu_unmap(domain, iova, len);
|
|
||||||
if (unmapped < len)
|
|
||||||
dev_warn(mmu->dev,
|
|
||||||
"could not unmap iova@%llx\n", iova);
|
|
||||||
} else {
|
|
||||||
if (priv)
|
if (priv)
|
||||||
msm_dma_unmap_sg(client->dev, sgt->sgl,
|
msm_dma_unmap_sg(client->dev, sgt->sgl, sgt->nents,
|
||||||
sgt->nents, DMA_BIDIRECTIONAL, priv);
|
DMA_BIDIRECTIONAL, priv);
|
||||||
else
|
else
|
||||||
dma_unmap_sg(client->dev, sgt->sgl, sgt->nents,
|
dma_unmap_sg(client->dev, sgt->sgl, sgt->nents,
|
||||||
DMA_BIDIRECTIONAL);
|
DMA_BIDIRECTIONAL);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void msm_smmu_destroy(struct msm_mmu *mmu)
|
static void msm_smmu_destroy(struct msm_mmu *mmu)
|
||||||
|
|
Loading…
Add table
Reference in a new issue