#include <linux/kernel.h>
#include <linux/io.h>
+#include <linux/property.h>
#include <asm/cacheflush.h>
G2D_JOBn_LAYER_SECURE_REG(task->sec.job_id));
}
+ if (device_get_dma_attr(g2d_dev->dev) != DEV_DMA_COHERENT)
+ __flush_dcache_area(page_address(task->cmd_page),
+ G2D_CMD_LIST_SIZE);
+
writel_relaxed(G2D_JOB_HEADER_DATA(task->sec.priority,
task->sec.job_id),
g2d_dev->reg + G2D_JOB_HEADER_REG);
{
bool self_prot = task->g2d_dev->caps & G2D_DEVICE_CAPS_SELF_PROTECTION;
struct scatterlist sgl;
+ int prot = IOMMU_READ;
if (!self_prot && IS_ENABLED(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION))
return 0;
+ if (device_get_dma_attr(task->g2d_dev->dev) == DEV_DMA_COHERENT)
+ prot |= IOMMU_CACHE;
+
/* mapping the command data */
sg_init_table(&sgl, 1);
sg_set_page(&sgl, task->cmd_page, G2D_CMD_LIST_SIZE, 0);
task->cmd_addr = iovmm_map(task->g2d_dev->dev, &sgl, 0,
- G2D_CMD_LIST_SIZE, DMA_TO_DEVICE,
- IOMMU_READ | IOMMU_CACHE);
+ G2D_CMD_LIST_SIZE, DMA_TO_DEVICE, prot);
if (IS_ERR_VALUE(task->cmd_addr)) {
dev_err(task->g2d_dev->dev,
goto err;
}
- if (dir != DMA_TO_DEVICE)
- prot |= IOMMU_WRITE;
-
if (ion_cached_dmabuf(dmabuf)) {
task->total_cached_len += buffer->payload;
goto err_map;
}
+ if (dir != DMA_TO_DEVICE)
+ prot |= IOMMU_WRITE;
+
+ if (device_get_dma_attr(dev) == DEV_DMA_COHERENT)
+ prot |= IOMMU_CACHE;
+
dma_addr = ion_iovmm_map(attachment, 0, buffer->payload, dir, prot);
if (IS_ERR_VALUE(dma_addr)) {
ret = (int)dma_addr;
vma->vm_ops->open(vma);
}
+ if (device_get_dma_attr(dev) == DEV_DMA_COHERENT)
+ prot |= IOMMU_CACHE;
+
buffer->dma_addr = exynos_iovmm_map_userptr(dev, data->userptr,
data->length, prot);
if (IS_ERR_VALUE(buffer->dma_addr)) {