From c92b83f507340f3af451f04682348eff0d9b73ae Mon Sep 17 00:00:00 2001 From: "hyesoo.yu" Date: Mon, 25 Sep 2017 19:11:35 +0900 Subject: [PATCH] [COMMON] g2d: clear sharability attribute If the device doesn't support the sharablity, S bit should be cleared on system page table. Change-Id: I49d5e843d81e43ce5a176720823afbdf36de6681 Signed-off-by: hyesoo.yu --- drivers/gpu/exynos/g2d/g2d_uapi_process.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/exynos/g2d/g2d_uapi_process.c b/drivers/gpu/exynos/g2d/g2d_uapi_process.c index b363194a687b..ac0e09872e75 100644 --- a/drivers/gpu/exynos/g2d/g2d_uapi_process.c +++ b/drivers/gpu/exynos/g2d/g2d_uapi_process.c @@ -199,7 +199,10 @@ static int g2d_get_dmabuf(struct g2d_task *task, struct sg_table *sgt; dma_addr_t dma_addr; int ret = -EINVAL; - int prot = IOMMU_READ | IOMMU_CACHE; + int prot = IOMMU_READ; + + if (device_get_dma_attr(dev) == DEV_DMA_COHERENT) + prot |= IOMMU_CACHE; if (!IS_HWFC(task->flags) || (dir == DMA_TO_DEVICE)) { dmabuf = dma_buf_get(data->dmabuf.fd); @@ -333,7 +336,9 @@ static int g2d_get_userptr(struct g2d_task *task, prot |= IOMMU_WRITE; if (is_vma_cached(vma)) { task->total_cached_len += buffer->payload; - prot |= IOMMU_CACHE; + + if (device_get_dma_attr(dev) == DEV_DMA_COHERENT) + prot |= IOMMU_CACHE; } buffer->userptr.vma = tvma; -- 2.20.1