xref: /OK3568_Linux_fs/kernel/drivers/crypto/rockchip/cryptodev_linux/zc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 
3 #ifndef ZC_H
4 # define ZC_H
5 
6 /* For zero copy */
7 int __cryptodev_get_userbuf(uint8_t __user *addr, uint32_t len, int write,
8 		unsigned int pgcount, struct page **pg, struct scatterlist *sg,
9 		struct task_struct *task, struct mm_struct *mm);
10 void cryptodev_release_user_pages(struct csession *ses);
11 
12 int cryptodev_get_userbuf(struct csession *ses,
13                 void *__user src, unsigned int src_len,
14                 void *__user dst, unsigned int dst_len,
15                 struct task_struct *task, struct mm_struct *mm,
16                 struct scatterlist **src_sg,
17                 struct scatterlist **dst_sg);
18 
19 /* buflen ? (last page - first page + 1) : 0 */
20 #define PAGECOUNT(buf, buflen) ((buflen) \
21 	? ((((unsigned long)(buf + buflen - 1)) >> PAGE_SHIFT) - \
22 	   (((unsigned long)(buf             )) >> PAGE_SHIFT) + 1) \
23 	: 0)
24 
25 #define DEFAULT_PREALLOC_PAGES 32
26 
27 #endif
28