1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * DMABUF Heaps Userspace API 4 * 5 * Copyright (C) 2011 Google, Inc. 6 * Copyright (C) 2019 Linaro Ltd. 7 * Copyright (C) 2022 Rockchip Electronics Co. Ltd. 8 * Author: Simon Xue <xxm@rock-chips.com> 9 */ 10 #ifndef _UAPI_LINUX_DMABUF_POOL_H 11 #define _UAPI_LINUX_DMABUF_POOL_H 12 13 #include <linux/ioctl.h> 14 #include <linux/types.h> 15 16 /** 17 * DOC: DMABUF Heaps Userspace API 18 */ 19 20 /* Valid FD_FLAGS are O_CLOEXEC, O_RDONLY, O_WRONLY, O_RDWR */ 21 #define RK_DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE) 22 23 /* Currently no heap flags */ 24 #define RK_DMA_HEAP_VALID_HEAP_FLAGS (0) 25 26 /** 27 * struct rk_dma_heap_allocation_data - metadata passed from userspace for 28 * allocations 29 * @len: size of the allocation 30 * @fd: will be populated with a fd which provides the 31 * handle to the allocated dma-buf 32 * @fd_flags: file descriptor flags used when allocating 33 * @heap_flags: flags passed to heap 34 * 35 * Provided by userspace as an argument to the ioctl 36 */ 37 struct rk_dma_heap_allocation_data { 38 __u64 len; 39 __u32 fd; 40 __u32 fd_flags; 41 __u64 heap_flags; 42 }; 43 44 #define RK_DMA_HEAP_IOC_MAGIC 'R' 45 46 /** 47 * DOC: RK_DMA_HEAP_IOCTL_ALLOC - allocate memory from pool 48 * 49 * Takes a rk_dma_heap_allocation_data struct and returns it with the fd field 50 * populated with the dmabuf handle of the allocation. 51 */ 52 #define RK_DMA_HEAP_IOCTL_ALLOC _IOWR(RK_DMA_HEAP_IOC_MAGIC, 0x0,\ 53 struct rk_dma_heap_allocation_data) 54 55 #endif /* _UAPI_LINUX_DMABUF_POOL_H */ 56