• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2022 Rockchip Electronics Co. Ltd.
4  */
5 #ifndef _LINUX_DMA_BUF_CACHE_H
6 #define _LINUX_DMA_BUF_CACHE_H
7 
8 #include <linux/dma-buf.h>
9 
10 extern void dma_buf_cache_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach);
11 
12 extern void dma_buf_cache_unmap_attachment(struct dma_buf_attachment *attach, struct sg_table *sg_table,
13                                            enum dma_data_direction direction);
14 
15 extern struct dma_buf_attachment *dma_buf_cache_attach(struct dma_buf *dmabuf, struct device *dev);
16 
17 extern struct sg_table *dma_buf_cache_map_attachment(struct dma_buf_attachment *attach,
18                                                      enum dma_data_direction direction);
19 
20 #ifdef CONFIG_DMABUF_CACHE
21 /* Replace dma-buf apis to cached apis */
22 #define dma_buf_attach dma_buf_cache_attach
23 #define dma_buf_detach dma_buf_cache_detach
24 #define dma_buf_map_attachment dma_buf_cache_map_attachment
25 #define dma_buf_unmap_attachment dma_buf_cache_unmap_attachment
26 #endif
27 
28 #endif /* _LINUX_DMA_BUF_CACHE_H */
29