xref: /linux/io_uring/memmap.h (revision e78f70bad29c5ae1e1076698b690b15794e9b81e)
1 #ifndef IO_URING_MEMMAP_H
2 #define IO_URING_MEMMAP_H
3 
4 #define IORING_MAP_OFF_PARAM_REGION		0x20000000ULL
5 #define IORING_MAP_OFF_ZCRX_REGION		0x30000000ULL
6 
7 #define IORING_OFF_ZCRX_SHIFT		16
8 
9 struct page **io_pin_pages(unsigned long uaddr, unsigned long len, int *npages);
10 
11 #ifndef CONFIG_MMU
12 unsigned int io_uring_nommu_mmap_capabilities(struct file *file);
13 #endif
14 unsigned long io_uring_get_unmapped_area(struct file *file, unsigned long addr,
15 					 unsigned long len, unsigned long pgoff,
16 					 unsigned long flags);
17 int io_uring_mmap(struct file *file, struct vm_area_struct *vma);
18 
19 void io_free_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr);
20 int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr,
21 		     struct io_uring_region_desc *reg,
22 		     unsigned long mmap_offset);
23 
24 int io_create_region_mmap_safe(struct io_ring_ctx *ctx,
25 				struct io_mapped_region *mr,
26 				struct io_uring_region_desc *reg,
27 				unsigned long mmap_offset);
28 
29 static inline void *io_region_get_ptr(struct io_mapped_region *mr)
30 {
31 	return mr->ptr;
32 }
33 
34 static inline bool io_region_is_set(struct io_mapped_region *mr)
35 {
36 	return !!mr->nr_pages;
37 }
38 
39 #endif
40