]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: fix iommu mapping
authorDeepak Nibade <dnibade@nvidia.com>
Mon, 16 Dec 2013 14:06:03 +0000 (19:36 +0530)
committerHiroshi Doyu <hdoyu@nvidia.com>
Tue, 17 Dec 2013 09:04:24 +0000 (01:04 -0800)
- gk20a_get_phys_from_iova() directly calls archdata.mapping
- this gives compilation error with SMMU disabled
- use to_dma_iommu_mapping() instead of above
  which returns NULL if SMMU is disabled
- gk20a_get_phys_from_iova() now returns iova address as
  physical address if SMMU is disabled

Bug 1397647

Change-Id: Ie1fe7b88daffaee0c3519e6839898f166b0a3786
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/345860
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com>
Tested-by: Hiroshi Doyu <hdoyu@nvidia.com>
drivers/video/tegra/host/gk20a/mm_gk20a.c

index 9cd7bbf80d2d9ad646cb01e74a1e0b0a943e1aaf..06cbd1694428d5a4948f7c39da42e798dd5a4128 100644 (file)
@@ -1386,8 +1386,13 @@ phys_addr_t gk20a_get_phys_from_iova(struct device *d,
                                u64 dma_addr)
 {
        phys_addr_t phys;
-       struct dma_iommu_mapping *mapping = d->archdata.mapping;
-       u64 iova = dma_addr & PAGE_MASK;
+       u64 iova;
+
+       struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(d);
+       if (!mapping)
+               return dma_addr;
+
+       iova = dma_addr & PAGE_MASK;
        phys = iommu_iova_to_phys(mapping->domain, iova);
        return phys;
 }