media: vb2: replace iovmm api supported by ion
authorhyesoo.yu <hyesoo.yu@samsung.com>
Wed, 2 May 2018 07:12:25 +0000 (16:12 +0900)
committerJanghyuck Kim <janghyuck.kim@samsung.com>
Mon, 23 Jul 2018 05:39:20 +0000 (14:39 +0900)
The iovmm api doesn't support system MMU mapping
of protected buffer. It is supported in exynos ion side.
We replace iovmm api to support protected buffer.

Change-Id: Ie6fe3f0fc2c877b31f0b7be7f23fe4492049a019
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
drivers/media/v4l2-core/videobuf2-dma-sg.c

index 1b1a45224b4cc0114f336719593c5f0ea02d4513..3c36d19a1e355ccd60a35e636aa54521db7be02a 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/vmalloc.h>
 
 #include <linux/exynos_iovmm.h>
+#include <linux/ion_exynos.h>
 
 #include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-memops.h>
@@ -581,12 +582,12 @@ static int vb2_dma_sg_map_dmabuf(void *mem_priv)
                if (device_get_dma_attr(buf->dev) == DEV_DMA_COHERENT)
                        ioprot |= IOMMU_CACHE;
 
-               buf->iova = iovmm_map(buf->dev, sgt->sgl, 0, buf->size,
+               buf->iova = ion_iovmm_map(buf->db_attach, 0, buf->size,
                                      DMA_BIDIRECTIONAL, ioprot);
                if (IS_ERR_VALUE(buf->iova)) {
                        dma_buf_unmap_attachment(buf->db_attach,
                                                 sgt, buf->dma_dir);
-                       pr_err("Error from iovmm_map()=%pad\n", &buf->iova);
+                       pr_err("Error from ion_iovmm_map()=%pad\n", &buf->iova);
                        return (int)buf->iova;
                }
        }
@@ -629,7 +630,7 @@ static void vb2_dma_sg_detach_dmabuf(void *mem_priv)
        if (WARN_ON(buf->dma_sgt))
                vb2_dma_sg_unmap_dmabuf(buf);
 
-       iovmm_unmap(buf->dev, buf->iova);
+       ion_iovmm_unmap(buf->db_attach, buf->iova);
 
        /* detach this attachment */
        dma_buf_detach(buf->db_attach->dmabuf, buf->db_attach);