Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * DMABUF Heaps Userspace API
0004  *
0005  * Copyright (C) 2011 Google, Inc.
0006  * Copyright (C) 2019 Linaro Ltd.
0007  */
0008 #ifndef _UAPI_LINUX_DMABUF_POOL_H
0009 #define _UAPI_LINUX_DMABUF_POOL_H
0010 
0011 #include <linux/ioctl.h>
0012 #include <linux/types.h>
0013 
0014 /**
0015  * DOC: DMABUF Heaps Userspace API
0016  */
0017 
0018 /* Valid FD_FLAGS are O_CLOEXEC, O_RDONLY, O_WRONLY, O_RDWR */
0019 #define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE)
0020 
0021 /* Currently no heap flags */
0022 #define DMA_HEAP_VALID_HEAP_FLAGS (0)
0023 
0024 /**
0025  * struct dma_heap_allocation_data - metadata passed from userspace for
0026  *                                      allocations
0027  * @len:        size of the allocation
0028  * @fd:         will be populated with a fd which provides the
0029  *          handle to the allocated dma-buf
0030  * @fd_flags:       file descriptor flags used when allocating
0031  * @heap_flags:     flags passed to heap
0032  *
0033  * Provided by userspace as an argument to the ioctl
0034  */
0035 struct dma_heap_allocation_data {
0036     __u64 len;
0037     __u32 fd;
0038     __u32 fd_flags;
0039     __u64 heap_flags;
0040 };
0041 
0042 #define DMA_HEAP_IOC_MAGIC      'H'
0043 
0044 /**
0045  * DOC: DMA_HEAP_IOCTL_ALLOC - allocate memory from pool
0046  *
0047  * Takes a dma_heap_allocation_data struct and returns it with the fd field
0048  * populated with the dmabuf handle of the allocation.
0049  */
0050 #define DMA_HEAP_IOCTL_ALLOC    _IOWR(DMA_HEAP_IOC_MAGIC, 0x0,\
0051                       struct dma_heap_allocation_data)
0052 
0053 #endif /* _UAPI_LINUX_DMABUF_POOL_H */