]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
iommu: tegra-smmu: fix phys address truncation issue
authorBryan Wu <pengw@nvidia.com>
Fri, 1 May 2015 18:53:45 +0000 (11:53 -0700)
committermobile promotions <svcmobile_promotions@nvidia.com>
Tue, 19 May 2015 23:32:10 +0000 (16:32 -0700)
Fix the truncation issue for phys addresses >32-bit while making PDE entry.

Bug 1410705

Change-Id: I0f7eaf34b9636ff95575a8ac8135019643244867
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/738111
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/iommu/tegra-smmu.c

index 15c2b51902a4ad1a8e2722165ff5fe0b001c3ae7..d6f48f51c440c7cd8e4e31d652d507db16eef5db 100644 (file)
@@ -977,7 +977,7 @@ static int __smmu_iommu_map_largepage_default(struct smmu_as *as, dma_addr_t iov
        else if (dma_get_attr(DMA_ATTR_WRITE_ONLY, (struct dma_attrs *)prot))
                attrs &= ~_READABLE;
 
-       pdir[pdn] = SMMU_ADDR_TO_PDN(pa) << 10 | attrs;
+       pdir[pdn] = pa >> SMMU_PDE_SHIFT | attrs;
        trace_smmu_set_pte(as->asid, iova, pa, SZ_4M, attrs);
 
        FLUSH_CPU_DCACHE(&pdir[pdn], as->pdir_page, sizeof pdir[pdn]);
@@ -1204,7 +1204,7 @@ static size_t __smmu_iommu_iova_to_phys(struct smmu_as *as, dma_addr_t iova,
                bytes = PAGE_SIZE;
                *npte = *count;
        } else if (pdir[pdn]) {
-               *pa =  pdir[pdn] << SMMU_PDE_SHIFT;
+               *pa =  (phys_addr_t)pdir[pdn] << SMMU_PDE_SHIFT;
                *pa += iova & (SZ_4M - 1);
                bytes = SZ_4M;
        }