diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig index f46fe574bb1e..0b2d943ac59b 100644 --- a/drivers/dma-buf/Kconfig +++ b/drivers/dma-buf/Kconfig @@ -24,6 +24,17 @@ config RK_DMABUF_DEBUG_ADVANCED This option support to debug all the dmabuf on db_list, allows to attach and map a dmabuf who has no attachment. If not sure, say N +config DMABUF_PARTIAL + bool "Support for partial cache maintenance" + default y + help + In order to improve performance, allow dma-buf clients to + apply cache maintenance to only a subset of a dma-buf. + + Kernel clients will be able to use the dma_buf_begin_cpu_access_partial + and dma_buf_end_cpu_access_partial functions to only apply cache + maintenance to a range within the dma-buf. + config SYNC_FILE bool "Explicit Synchronization Framework" default n diff --git a/drivers/dma-buf/heaps/rk_cma_heap.c b/drivers/dma-buf/heaps/rk_cma_heap.c index 7631997e8e21..c93674c2a79c 100644 --- a/drivers/dma-buf/heaps/rk_cma_heap.c +++ b/drivers/dma-buf/heaps/rk_cma_heap.c @@ -135,7 +135,7 @@ static void cma_heap_unmap_dma_buf(struct dma_buf_attachment *attachment, dma_unmap_sgtable(attachment->dev, table, direction, attrs); } -static int +static int __maybe_unused cma_heap_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf, enum dma_data_direction direction, unsigned int offset, @@ -160,7 +160,7 @@ cma_heap_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf, return 0; } -static int +static int __maybe_unused cma_heap_dma_buf_end_cpu_access_partial(struct dma_buf *dmabuf, enum dma_data_direction direction, unsigned int offset, @@ -334,8 +334,10 @@ static const struct dma_buf_ops cma_heap_buf_ops = { .unmap_dma_buf = cma_heap_unmap_dma_buf, .begin_cpu_access = cma_heap_dma_buf_begin_cpu_access, .end_cpu_access = cma_heap_dma_buf_end_cpu_access, +#ifdef CONFIG_DMABUF_PARTIAL .begin_cpu_access_partial = cma_heap_dma_buf_begin_cpu_access_partial, .end_cpu_access_partial = cma_heap_dma_buf_end_cpu_access_partial, +#endif .mmap = cma_heap_mmap, .vmap = cma_heap_vmap, .vunmap = cma_heap_vunmap, diff --git a/drivers/dma-buf/heaps/rk_system_heap.c b/drivers/dma-buf/heaps/rk_system_heap.c index 2d29eec1a670..aa22fb8a015f 100644 --- a/drivers/dma-buf/heaps/rk_system_heap.c +++ b/drivers/dma-buf/heaps/rk_system_heap.c @@ -266,7 +266,7 @@ static int system_heap_sgl_sync_range(struct device *dev, return 0; } -static int +static int __maybe_unused system_heap_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf, enum dma_data_direction direction, unsigned int offset, @@ -296,7 +296,7 @@ system_heap_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf, return ret; } -static int +static int __maybe_unused system_heap_dma_buf_end_cpu_access_partial(struct dma_buf *dmabuf, enum dma_data_direction direction, unsigned int offset, @@ -479,8 +479,10 @@ static const struct dma_buf_ops system_heap_buf_ops = { .unmap_dma_buf = system_heap_unmap_dma_buf, .begin_cpu_access = system_heap_dma_buf_begin_cpu_access, .end_cpu_access = system_heap_dma_buf_end_cpu_access, +#ifdef CONFIG_DMABUF_PARTIAL .begin_cpu_access_partial = system_heap_dma_buf_begin_cpu_access_partial, .end_cpu_access_partial = system_heap_dma_buf_end_cpu_access_partial, +#endif .mmap = system_heap_mmap, .vmap = system_heap_vmap, .vunmap = system_heap_vunmap,