omap: iommu: avoid remapping if it's been mapped in MPU side
authorHiroshi DOYU <Hiroshi.DOYU@nokia.com>
Sun, 22 Nov 2009 18:11:02 +0000 (10:11 -0800)
committerTony Lindgren <tony@atomide.com>
Sun, 22 Nov 2009 18:24:32 +0000 (10:24 -0800)
MPU side (v)-(p) mapping is necessary only if IOVMF_MMIO is set in
"flags".

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/plat-omap/iovmm.c

index 0ce36bbef9d26f6a19350eac9a3f627693f6945f..577d8c03b8e193136bd5b77afc213b23894e1838 100644 (file)
@@ -617,7 +617,7 @@ u32 iommu_vmap(struct iommu *obj, u32 da, const struct sg_table *sgt,
                 u32 flags)
 {
        size_t bytes;
-       void *va;
+       void *va = NULL;
 
        if (!obj || !obj->dev || !sgt)
                return -EINVAL;
@@ -627,9 +627,11 @@ u32 iommu_vmap(struct iommu *obj, u32 da, const struct sg_table *sgt,
                return -EINVAL;
        bytes = PAGE_ALIGN(bytes);
 
-       va = vmap_sg(sgt);
-       if (IS_ERR(va))
-               return PTR_ERR(va);
+       if (flags & IOVMF_MMIO) {
+               va = vmap_sg(sgt);
+               if (IS_ERR(va))
+                       return PTR_ERR(va);
+       }
 
        flags &= IOVMF_HW_MASK;
        flags |= IOVMF_DISCONT;