1/*
2 * This header was generated from the Linux kernel headers by update_headers.py,
3 * to provide necessary information from kernel to userspace, such as constants,
4 * structures, and macros, and thus, contains no copyrightable information.
5 */
6#ifndef __LINUX_PUBLIC_GNTDEV_H__
7#define __LINUX_PUBLIC_GNTDEV_H__
8#include <linux/types.h>
9struct ioctl_gntdev_grant_ref {
10
11	__u32 domid;
12
13	__u32 ref;
14};
15#define IOCTL_GNTDEV_MAP_GRANT_REF \
16_IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))
17struct ioctl_gntdev_map_grant_ref {
18
19
20	__u32 count;
21	__u32 pad;
22
23
24	__u64 index;
25
26
27	struct ioctl_gntdev_grant_ref refs[1];
28};
29#define IOCTL_GNTDEV_UNMAP_GRANT_REF \
30_IOC(_IOC_NONE, 'G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref))
31struct ioctl_gntdev_unmap_grant_ref {
32
33
34	__u64 index;
35
36	__u32 count;
37	__u32 pad;
38};
39#define IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR \
40_IOC(_IOC_NONE, 'G', 2, sizeof(struct ioctl_gntdev_get_offset_for_vaddr))
41struct ioctl_gntdev_get_offset_for_vaddr {
42
43
44	__u64 vaddr;
45
46
47	__u64 offset;
48
49	__u32 count;
50	__u32 pad;
51};
52#define IOCTL_GNTDEV_SET_MAX_GRANTS \
53_IOC(_IOC_NONE, 'G', 3, sizeof(struct ioctl_gntdev_set_max_grants))
54struct ioctl_gntdev_set_max_grants {
55
56
57	__u32 count;
58};
59#define IOCTL_GNTDEV_SET_UNMAP_NOTIFY \
60_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntdev_unmap_notify))
61struct ioctl_gntdev_unmap_notify {
62
63
64	__u64 index;
65
66	__u32 action;
67
68	__u32 event_channel_port;
69};
70struct gntdev_grant_copy_segment {
71	union {
72		void __user *virt;
73		struct {
74			grant_ref_t ref;
75			__u16 offset;
76			domid_t domid;
77		} foreign;
78	} source, dest;
79	__u16 len;
80	__u16 flags;
81	__s16 status;
82};
83#define IOCTL_GNTDEV_GRANT_COPY \
84	_IOC(_IOC_NONE, 'G', 8, sizeof(struct ioctl_gntdev_grant_copy))
85struct ioctl_gntdev_grant_copy {
86	unsigned int count;
87	struct gntdev_grant_copy_segment __user *segments;
88};
89#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
90#define UNMAP_NOTIFY_SEND_EVENT 0x2
91#define GNTDEV_DMA_FLAG_WC		(1 << 0)
92#define GNTDEV_DMA_FLAG_COHERENT	(1 << 1)
93#define IOCTL_GNTDEV_DMABUF_EXP_FROM_REFS \
94	_IOC(_IOC_NONE, 'G', 9, \
95	     sizeof(struct ioctl_gntdev_dmabuf_exp_from_refs))
96struct ioctl_gntdev_dmabuf_exp_from_refs {
97
98
99	__u32 flags;
100
101	__u32 count;
102
103
104	__u32 fd;
105
106	__u32 domid;
107
108
109	__u32 refs[1];
110};
111#define IOCTL_GNTDEV_DMABUF_EXP_WAIT_RELEASED \
112	_IOC(_IOC_NONE, 'G', 10, \
113	     sizeof(struct ioctl_gntdev_dmabuf_exp_wait_released))
114struct ioctl_gntdev_dmabuf_exp_wait_released {
115
116	__u32 fd;
117	__u32 wait_to_ms;
118};
119#define IOCTL_GNTDEV_DMABUF_IMP_TO_REFS \
120	_IOC(_IOC_NONE, 'G', 11, \
121	     sizeof(struct ioctl_gntdev_dmabuf_imp_to_refs))
122struct ioctl_gntdev_dmabuf_imp_to_refs {
123
124
125	__u32 fd;
126
127	__u32 count;
128
129	__u32 domid;
130
131	__u32 reserved;
132
133
134	__u32 refs[1];
135};
136#define IOCTL_GNTDEV_DMABUF_IMP_RELEASE \
137	_IOC(_IOC_NONE, 'G', 12, \
138	     sizeof(struct ioctl_gntdev_dmabuf_imp_release))
139struct ioctl_gntdev_dmabuf_imp_release {
140
141	__u32 fd;
142	__u32 reserved;
143};
144#endif
145