summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorKrishna Reddy <vdumpa@nvidia.com>2013-07-29 14:56:24 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 13:37:42 -0700
commit5b363d7fa80e508924de3b07bd91da1140c9cef7 (patch)
tree497d89eadc112334b11c36c540cb8ab292cb52c9 /drivers/iommu
parentfe99ef54dba00e4128de9a6194735060f7155c8b (diff)
iommu: tegra: fix incorrect iova used during tlb/ptc flush
Change-Id: I13ed5d9c426e1b421283e0261fe397f79034e808 Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/255236 Reviewed-by: Ken Adams <kadams@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Tested-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com> Tested-by: Hiroshi Doyu <hdoyu@nvidia.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/tegra-smmu.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index adc8b0d78246..ba4cd1f7769c 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -830,6 +830,7 @@ static size_t __smmu_iommu_unmap_pages(struct smmu_as *as, dma_addr_t iova,
int total = bytes >> PAGE_SHIFT;
unsigned long *pdir = page_address(as->pdir_page);
struct smmu_device *smmu = as->smmu;
+ unsigned long iova_base = iova;
bool flush_all = (total > SZ_512) ? true : false;
while (total > 0) {
@@ -873,7 +874,8 @@ static size_t __smmu_iommu_unmap_pages(struct smmu_as *as, dma_addr_t iova,
}
if (flush_all)
- flush_ptc_and_tlb_as(as, iova, iova + bytes);
+ flush_ptc_and_tlb_as(as, iova_base,
+ iova_base + bytes);
return bytes;
}
@@ -970,6 +972,7 @@ static int smmu_iommu_map_pages(struct iommu_domain *domain, unsigned long iova,
unsigned long flags;
unsigned long *pdir = page_address(as->pdir_page);
int err = 0;
+ unsigned long iova_base = iova;
bool flush_all = (total > SZ_512) ? true : false;
spin_lock_irqsave(&as->lock, flags);
@@ -1023,7 +1026,8 @@ skip:
out:
if (flush_all)
- flush_ptc_and_tlb_as(as, iova, iova + total * PAGE_SIZE);
+ flush_ptc_and_tlb_as(as, iova_base,
+ iova_base + total * PAGE_SIZE);
spin_unlock_irqrestore(&as->lock, flags);
return err;
@@ -1035,6 +1039,7 @@ static int smmu_iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
unsigned int count;
struct scatterlist *s;
int err = 0;
+ unsigned long iova_base = iova;
bool flush_all = (nents * PAGE_SIZE > SZ_512) ? true : false;
struct smmu_as *as = domain->priv;
struct smmu_device *smmu = as->smmu;
@@ -1101,7 +1106,8 @@ skip:
}
if (flush_all)
- flush_ptc_and_tlb_as(as, iova, iova + nents * PAGE_SIZE);
+ flush_ptc_and_tlb_as(as, iova_base,
+ iova_base + nents * PAGE_SIZE);
return err;
}