MLIR-AIE
ion.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * drivers/staging/android/uapi/ion.h
4 *
5 * Copyright (C) 2011 Google, Inc.
6 */
7
8#ifndef _UAPI_LINUX_ION_H
9#define _UAPI_LINUX_ION_H
10
11#include <linux/ioctl.h>
12#include <linux/types.h>
13
14/**
15 * enum ion_heap_types - list of all possible types of heaps
16 * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc
17 * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
18 * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
19 * carveout heap, allocations are physically
20 * contiguous
21 * @ION_HEAP_TYPE_DMA: memory allocated via DMA API
22 * @ION_NUM_HEAPS: helper for iterating over heaps, a bit mask
23 * is used to identify the heaps, so only 32
24 * total heap types are supported
25 */
33 * must be last so device specific heaps always
34 * are at the end of this enum
35 */
36};
37
38#define ION_NUM_HEAP_IDS (sizeof(unsigned int) * 8)
39
40/**
41 * allocation flags - the lower 16 bits are used by core ion, the upper 16
42 * bits are reserved for use by the heaps themselves.
43 */
44
45/*
46 * mappings of this buffer should be cached, ion will do cache maintenance
47 * when the buffer is mapped for dma
48 */
49#define ION_FLAG_CACHED 1
50
51/**
52 * DOC: Ion Userspace API
53 *
54 * create a client by opening /dev/ion
55 * most operations handled via following ioctls
56 *
57 */
58
59/**
60 * struct ion_allocation_data - metadata passed from userspace for allocations
61 * @len: size of the allocation
62 * @heap_id_mask: mask of heap ids to allocate from
63 * @flags: flags passed to heap
64 * @handle: pointer that will be populated with a cookie to use to
65 * refer to this allocation
66 *
67 * Provided by userspace as an argument to the ioctl
68 */
70 __u64 len;
72 __u32 flags;
73 __u32 fd;
74 __u32 unused;
75};
76
77#define MAX_HEAP_NAME 32
78
79/**
80 * struct ion_heap_data - data about a heap
81 * @name - first 32 characters of the heap name
82 * @type - heap type
83 * @heap_id - heap id for the heap
84 */
87 __u32 type;
88 __u32 heap_id;
89 __u32 reserved0;
90 __u32 reserved1;
91 __u32 reserved2;
92};
93
94/**
95 * struct ion_heap_query - collection of data about all heaps
96 * @cnt - total number of heaps to be copied
97 * @heaps - buffer to copy heap data
98 */
100 __u32 cnt; /* Total number of heaps to be copied */
101 __u32 reserved0; /* align to 64bits */
102 __u64 heaps; /* buffer to be populated */
105};
106
107#define ION_IOC_MAGIC 'I'
108
109/**
110 * DOC: ION_IOC_ALLOC - allocate memory
111 *
112 * Takes an ion_allocation_data struct and returns it with the handle field
113 * populated with the opaque handle for the allocation.
114 */
115#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data)
116
117/**
118 * DOC: ION_IOC_HEAP_QUERY - information about available heaps
119 *
120 * Takes an ion_heap_query structure and populates information about
121 * available Ion heaps.
122 */
123#define ION_IOC_HEAP_QUERY _IOWR(ION_IOC_MAGIC, 8, struct ion_heap_query)
124
125#endif /* _UAPI_LINUX_ION_H */
#define MAX_HEAP_NAME
Definition ion.h:77
ion_heap_type
enum ion_heap_types - list of all possible types of heaps @ION_HEAP_TYPE_SYSTEM: memory allocated via...
Definition ion.h:26
@ ION_HEAP_TYPE_SYSTEM_CONTIG
Definition ion.h:28
@ ION_HEAP_TYPE_CARVEOUT
Definition ion.h:29
@ ION_HEAP_TYPE_CHUNK
Definition ion.h:30
@ ION_HEAP_TYPE_DMA
Definition ion.h:31
@ ION_HEAP_TYPE_CUSTOM
Definition ion.h:32
@ ION_HEAP_TYPE_SYSTEM
Definition ion.h:27
DOC: Ion Userspace API.
Definition ion.h:69
__u32 heap_id_mask
Definition ion.h:71
__u32 type
Definition ion.h:87
__u32 reserved2
Definition ion.h:91
__u32 reserved1
Definition ion.h:90
__u32 reserved0
Definition ion.h:89
char name[MAX_HEAP_NAME]
Definition ion.h:86
__u32 heap_id
Definition ion.h:88
struct ion_heap_query - collection of data about all heaps @cnt - total number of heaps to be copied ...
Definition ion.h:99
__u64 heaps
Definition ion.h:102
__u32 reserved0
Definition ion.h:101
__u32 reserved1
Definition ion.h:103
__u32 cnt
Definition ion.h:100
__u32 reserved2
Definition ion.h:104