• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2021 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,
11 				 struct dma_buf_attachment *attach);
12 
13 extern void dma_buf_cache_unmap_attachment(struct dma_buf_attachment *attach,
14 					   struct sg_table *sg_table,
15 					   enum dma_data_direction direction);
16 
17 extern struct dma_buf_attachment *
18 dma_buf_cache_attach(struct dma_buf *dmabuf, struct device *dev);
19 
20 extern struct sg_table *
21 dma_buf_cache_map_attachment(struct dma_buf_attachment *attach,
22 			     enum dma_data_direction direction);
23 
24 #ifdef CONFIG_DMABUF_CACHE
25 /* Replace dma-buf apis to cached apis */
26 #define dma_buf_attach dma_buf_cache_attach
27 #define dma_buf_detach dma_buf_cache_detach
28 #define dma_buf_map_attachment dma_buf_cache_map_attachment
29 #define dma_buf_unmap_attachment dma_buf_cache_unmap_attachment
30 #endif
31 
32 #endif /* _LINUX_DMA_BUF_CACHE_H */
33