1dd873966SEric Auger /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2c1fcf220SDr. David Alan Gilbert /*
3c1fcf220SDr. David Alan Gilbert  *  include/linux/userfaultfd.h
4c1fcf220SDr. David Alan Gilbert  *
5c1fcf220SDr. David Alan Gilbert  *  Copyright (C) 2007  Davide Libenzi <davidel@xmailserver.org>
6c1fcf220SDr. David Alan Gilbert  *  Copyright (C) 2015  Red Hat, Inc.
7c1fcf220SDr. David Alan Gilbert  *
8c1fcf220SDr. David Alan Gilbert  */
9c1fcf220SDr. David Alan Gilbert 
10c1fcf220SDr. David Alan Gilbert #ifndef _LINUX_USERFAULTFD_H
11c1fcf220SDr. David Alan Gilbert #define _LINUX_USERFAULTFD_H
12c1fcf220SDr. David Alan Gilbert 
13c1fcf220SDr. David Alan Gilbert #include <linux/types.h>
14c1fcf220SDr. David Alan Gilbert 
15c1fcf220SDr. David Alan Gilbert /*
163a5eb5b4SPaolo Bonzini  * If the UFFDIO_API is upgraded someday, the UFFDIO_UNREGISTER and
173a5eb5b4SPaolo Bonzini  * UFFDIO_WAKE ioctls should be defined as _IOW and not as _IOR.  In
183a5eb5b4SPaolo Bonzini  * userfaultfd.h we assumed the kernel was reading (instead _IOC_READ
193a5eb5b4SPaolo Bonzini  * means the userland is reading).
20c1fcf220SDr. David Alan Gilbert  */
213a5eb5b4SPaolo Bonzini #define UFFD_API ((__u64)0xAA)
22278f064eSEduardo Habkost #define UFFD_API_REGISTER_MODES (UFFDIO_REGISTER_MODE_MISSING |	\
23278f064eSEduardo Habkost 				 UFFDIO_REGISTER_MODE_WP |	\
24278f064eSEduardo Habkost 				 UFFDIO_REGISTER_MODE_MINOR)
25dc6f8d45SCornelia Huck #define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP |	\
26dc6f8d45SCornelia Huck 			   UFFD_FEATURE_EVENT_FORK |		\
273a5eb5b4SPaolo Bonzini 			   UFFD_FEATURE_EVENT_REMAP |		\
2874c98e20SCornelia Huck 			   UFFD_FEATURE_EVENT_REMOVE |		\
2974c98e20SCornelia Huck 			   UFFD_FEATURE_EVENT_UNMAP |		\
303a5eb5b4SPaolo Bonzini 			   UFFD_FEATURE_MISSING_HUGETLBFS |	\
31d4083f50SAlexey Perevalov 			   UFFD_FEATURE_MISSING_SHMEM |		\
32d4083f50SAlexey Perevalov 			   UFFD_FEATURE_SIGBUS |		\
33278f064eSEduardo Habkost 			   UFFD_FEATURE_THREAD_ID |		\
34*327d4b7fSBharata B Rao 			   UFFD_FEATURE_MINOR_HUGETLBFS |	\
35*327d4b7fSBharata B Rao 			   UFFD_FEATURE_MINOR_SHMEM)
36c1fcf220SDr. David Alan Gilbert #define UFFD_API_IOCTLS				\
37c1fcf220SDr. David Alan Gilbert 	((__u64)1 << _UFFDIO_REGISTER |		\
38c1fcf220SDr. David Alan Gilbert 	 (__u64)1 << _UFFDIO_UNREGISTER |	\
39c1fcf220SDr. David Alan Gilbert 	 (__u64)1 << _UFFDIO_API)
40c1fcf220SDr. David Alan Gilbert #define UFFD_API_RANGE_IOCTLS			\
41c1fcf220SDr. David Alan Gilbert 	((__u64)1 << _UFFDIO_WAKE |		\
42c1fcf220SDr. David Alan Gilbert 	 (__u64)1 << _UFFDIO_COPY |		\
43dc6f8d45SCornelia Huck 	 (__u64)1 << _UFFDIO_ZEROPAGE |		\
44278f064eSEduardo Habkost 	 (__u64)1 << _UFFDIO_WRITEPROTECT |	\
45278f064eSEduardo Habkost 	 (__u64)1 << _UFFDIO_CONTINUE)
463a5eb5b4SPaolo Bonzini #define UFFD_API_RANGE_IOCTLS_BASIC		\
473a5eb5b4SPaolo Bonzini 	((__u64)1 << _UFFDIO_WAKE |		\
48278f064eSEduardo Habkost 	 (__u64)1 << _UFFDIO_COPY |		\
49278f064eSEduardo Habkost 	 (__u64)1 << _UFFDIO_CONTINUE)
50c1fcf220SDr. David Alan Gilbert 
51c1fcf220SDr. David Alan Gilbert /*
52c1fcf220SDr. David Alan Gilbert  * Valid ioctl command number range with this API is from 0x00 to
53c1fcf220SDr. David Alan Gilbert  * 0x3F.  UFFDIO_API is the fixed number, everything else can be
54c1fcf220SDr. David Alan Gilbert  * changed by implementing a different UFFD_API. If sticking to the
55c1fcf220SDr. David Alan Gilbert  * same UFFD_API more ioctl can be added and userland will be aware of
56c1fcf220SDr. David Alan Gilbert  * which ioctl the running kernel implements through the ioctl command
57c1fcf220SDr. David Alan Gilbert  * bitmask written by the UFFDIO_API.
58c1fcf220SDr. David Alan Gilbert  */
59c1fcf220SDr. David Alan Gilbert #define _UFFDIO_REGISTER		(0x00)
60c1fcf220SDr. David Alan Gilbert #define _UFFDIO_UNREGISTER		(0x01)
61c1fcf220SDr. David Alan Gilbert #define _UFFDIO_WAKE			(0x02)
62c1fcf220SDr. David Alan Gilbert #define _UFFDIO_COPY			(0x03)
63c1fcf220SDr. David Alan Gilbert #define _UFFDIO_ZEROPAGE		(0x04)
64dc6f8d45SCornelia Huck #define _UFFDIO_WRITEPROTECT		(0x06)
65278f064eSEduardo Habkost #define _UFFDIO_CONTINUE		(0x07)
66c1fcf220SDr. David Alan Gilbert #define _UFFDIO_API			(0x3F)
67c1fcf220SDr. David Alan Gilbert 
68c1fcf220SDr. David Alan Gilbert /* userfaultfd ioctl ids */
69c1fcf220SDr. David Alan Gilbert #define UFFDIO 0xAA
70c1fcf220SDr. David Alan Gilbert #define UFFDIO_API		_IOWR(UFFDIO, _UFFDIO_API,	\
71c1fcf220SDr. David Alan Gilbert 				      struct uffdio_api)
72c1fcf220SDr. David Alan Gilbert #define UFFDIO_REGISTER		_IOWR(UFFDIO, _UFFDIO_REGISTER, \
73c1fcf220SDr. David Alan Gilbert 				      struct uffdio_register)
74c1fcf220SDr. David Alan Gilbert #define UFFDIO_UNREGISTER	_IOR(UFFDIO, _UFFDIO_UNREGISTER,	\
75c1fcf220SDr. David Alan Gilbert 				     struct uffdio_range)
76c1fcf220SDr. David Alan Gilbert #define UFFDIO_WAKE		_IOR(UFFDIO, _UFFDIO_WAKE,	\
77c1fcf220SDr. David Alan Gilbert 				     struct uffdio_range)
78c1fcf220SDr. David Alan Gilbert #define UFFDIO_COPY		_IOWR(UFFDIO, _UFFDIO_COPY,	\
79c1fcf220SDr. David Alan Gilbert 				      struct uffdio_copy)
80c1fcf220SDr. David Alan Gilbert #define UFFDIO_ZEROPAGE		_IOWR(UFFDIO, _UFFDIO_ZEROPAGE,	\
81c1fcf220SDr. David Alan Gilbert 				      struct uffdio_zeropage)
82dc6f8d45SCornelia Huck #define UFFDIO_WRITEPROTECT	_IOWR(UFFDIO, _UFFDIO_WRITEPROTECT, \
83dc6f8d45SCornelia Huck 				      struct uffdio_writeprotect)
84*327d4b7fSBharata B Rao #define UFFDIO_CONTINUE		_IOWR(UFFDIO, _UFFDIO_CONTINUE,	\
85278f064eSEduardo Habkost 				      struct uffdio_continue)
86c1fcf220SDr. David Alan Gilbert 
87c1fcf220SDr. David Alan Gilbert /* read() structure */
88c1fcf220SDr. David Alan Gilbert struct uffd_msg {
89c1fcf220SDr. David Alan Gilbert 	__u8	event;
90c1fcf220SDr. David Alan Gilbert 
91c1fcf220SDr. David Alan Gilbert 	__u8	reserved1;
92c1fcf220SDr. David Alan Gilbert 	__u16	reserved2;
93c1fcf220SDr. David Alan Gilbert 	__u32	reserved3;
94c1fcf220SDr. David Alan Gilbert 
95c1fcf220SDr. David Alan Gilbert 	union {
96c1fcf220SDr. David Alan Gilbert 		struct {
97c1fcf220SDr. David Alan Gilbert 			__u64	flags;
98c1fcf220SDr. David Alan Gilbert 			__u64	address;
99d4083f50SAlexey Perevalov 			union {
100d4083f50SAlexey Perevalov 				__u32 ptid;
101d4083f50SAlexey Perevalov 			} feat;
102c1fcf220SDr. David Alan Gilbert 		} pagefault;
103c1fcf220SDr. David Alan Gilbert 
104c1fcf220SDr. David Alan Gilbert 		struct {
1053a5eb5b4SPaolo Bonzini 			__u32	ufd;
1063a5eb5b4SPaolo Bonzini 		} fork;
1073a5eb5b4SPaolo Bonzini 
1083a5eb5b4SPaolo Bonzini 		struct {
1093a5eb5b4SPaolo Bonzini 			__u64	from;
1103a5eb5b4SPaolo Bonzini 			__u64	to;
1113a5eb5b4SPaolo Bonzini 			__u64	len;
1123a5eb5b4SPaolo Bonzini 		} remap;
1133a5eb5b4SPaolo Bonzini 
1143a5eb5b4SPaolo Bonzini 		struct {
1153a5eb5b4SPaolo Bonzini 			__u64	start;
1163a5eb5b4SPaolo Bonzini 			__u64	end;
11774c98e20SCornelia Huck 		} remove;
1183a5eb5b4SPaolo Bonzini 
1193a5eb5b4SPaolo Bonzini 		struct {
120c1fcf220SDr. David Alan Gilbert 			/* unused reserved fields */
121c1fcf220SDr. David Alan Gilbert 			__u64	reserved1;
122c1fcf220SDr. David Alan Gilbert 			__u64	reserved2;
123c1fcf220SDr. David Alan Gilbert 			__u64	reserved3;
124c1fcf220SDr. David Alan Gilbert 		} reserved;
125c1fcf220SDr. David Alan Gilbert 	} arg;
126b89485a5SPaolo Bonzini } __attribute__((packed));
127c1fcf220SDr. David Alan Gilbert 
128c1fcf220SDr. David Alan Gilbert /*
129c1fcf220SDr. David Alan Gilbert  * Start at 0x12 and not at 0 to be more strict against bugs.
130c1fcf220SDr. David Alan Gilbert  */
131c1fcf220SDr. David Alan Gilbert #define UFFD_EVENT_PAGEFAULT	0x12
132c1fcf220SDr. David Alan Gilbert #define UFFD_EVENT_FORK		0x13
1333a5eb5b4SPaolo Bonzini #define UFFD_EVENT_REMAP	0x14
13474c98e20SCornelia Huck #define UFFD_EVENT_REMOVE	0x15
13574c98e20SCornelia Huck #define UFFD_EVENT_UNMAP	0x16
136c1fcf220SDr. David Alan Gilbert 
137c1fcf220SDr. David Alan Gilbert /* flags for UFFD_EVENT_PAGEFAULT */
138c1fcf220SDr. David Alan Gilbert #define UFFD_PAGEFAULT_FLAG_WRITE	(1<<0)	/* If this was a write fault */
139c1fcf220SDr. David Alan Gilbert #define UFFD_PAGEFAULT_FLAG_WP		(1<<1)	/* If reason is VM_UFFD_WP */
140278f064eSEduardo Habkost #define UFFD_PAGEFAULT_FLAG_MINOR	(1<<2)	/* If reason is VM_UFFD_MINOR */
141c1fcf220SDr. David Alan Gilbert 
142c1fcf220SDr. David Alan Gilbert struct uffdio_api {
143c1fcf220SDr. David Alan Gilbert 	/* userland asks for an API number and the features to enable */
144c1fcf220SDr. David Alan Gilbert 	__u64 api;
145c1fcf220SDr. David Alan Gilbert 	/*
146c1fcf220SDr. David Alan Gilbert 	 * Kernel answers below with the all available features for
147c1fcf220SDr. David Alan Gilbert 	 * the API, this notifies userland of which events and/or
148c1fcf220SDr. David Alan Gilbert 	 * which flags for each event are enabled in the current
149c1fcf220SDr. David Alan Gilbert 	 * kernel.
150c1fcf220SDr. David Alan Gilbert 	 *
151c1fcf220SDr. David Alan Gilbert 	 * Note: UFFD_EVENT_PAGEFAULT and UFFD_PAGEFAULT_FLAG_WRITE
152c1fcf220SDr. David Alan Gilbert 	 * are to be considered implicitly always enabled in all kernels as
153c1fcf220SDr. David Alan Gilbert 	 * long as the uffdio_api.api requested matches UFFD_API.
1543a5eb5b4SPaolo Bonzini 	 *
1553a5eb5b4SPaolo Bonzini 	 * UFFD_FEATURE_MISSING_HUGETLBFS means an UFFDIO_REGISTER
1563a5eb5b4SPaolo Bonzini 	 * with UFFDIO_REGISTER_MODE_MISSING mode will succeed on
1573a5eb5b4SPaolo Bonzini 	 * hugetlbfs virtual memory ranges. Adding or not adding
1583a5eb5b4SPaolo Bonzini 	 * UFFD_FEATURE_MISSING_HUGETLBFS to uffdio_api.features has
1593a5eb5b4SPaolo Bonzini 	 * no real functional effect after UFFDIO_API returns, but
1603a5eb5b4SPaolo Bonzini 	 * it's only useful for an initial feature set probe at
1613a5eb5b4SPaolo Bonzini 	 * UFFDIO_API time. There are two ways to use it:
1623a5eb5b4SPaolo Bonzini 	 *
1633a5eb5b4SPaolo Bonzini 	 * 1) by adding UFFD_FEATURE_MISSING_HUGETLBFS to the
1643a5eb5b4SPaolo Bonzini 	 *    uffdio_api.features before calling UFFDIO_API, an error
1653a5eb5b4SPaolo Bonzini 	 *    will be returned by UFFDIO_API on a kernel without
1663a5eb5b4SPaolo Bonzini 	 *    hugetlbfs missing support
1673a5eb5b4SPaolo Bonzini 	 *
1683a5eb5b4SPaolo Bonzini 	 * 2) the UFFD_FEATURE_MISSING_HUGETLBFS can not be added in
1693a5eb5b4SPaolo Bonzini 	 *    uffdio_api.features and instead it will be set by the
1703a5eb5b4SPaolo Bonzini 	 *    kernel in the uffdio_api.features if the kernel supports
1713a5eb5b4SPaolo Bonzini 	 *    it, so userland can later check if the feature flag is
1723a5eb5b4SPaolo Bonzini 	 *    present in uffdio_api.features after UFFDIO_API
1733a5eb5b4SPaolo Bonzini 	 *    succeeded.
1743a5eb5b4SPaolo Bonzini 	 *
1753a5eb5b4SPaolo Bonzini 	 * UFFD_FEATURE_MISSING_SHMEM works the same as
1763a5eb5b4SPaolo Bonzini 	 * UFFD_FEATURE_MISSING_HUGETLBFS, but it applies to shmem
1773a5eb5b4SPaolo Bonzini 	 * (i.e. tmpfs and other shmem based APIs).
178d4083f50SAlexey Perevalov 	 *
179d4083f50SAlexey Perevalov 	 * UFFD_FEATURE_SIGBUS feature means no page-fault
180d4083f50SAlexey Perevalov 	 * (UFFD_EVENT_PAGEFAULT) event will be delivered, instead
181d4083f50SAlexey Perevalov 	 * a SIGBUS signal will be sent to the faulting process.
182d4083f50SAlexey Perevalov 	 *
183d4083f50SAlexey Perevalov 	 * UFFD_FEATURE_THREAD_ID pid of the page faulted task_struct will
184d4083f50SAlexey Perevalov 	 * be returned, if feature is not requested 0 will be returned.
185278f064eSEduardo Habkost 	 *
186278f064eSEduardo Habkost 	 * UFFD_FEATURE_MINOR_HUGETLBFS indicates that minor faults
187278f064eSEduardo Habkost 	 * can be intercepted (via REGISTER_MODE_MINOR) for
188278f064eSEduardo Habkost 	 * hugetlbfs-backed pages.
189*327d4b7fSBharata B Rao 	 *
190*327d4b7fSBharata B Rao 	 * UFFD_FEATURE_MINOR_SHMEM indicates the same support as
191*327d4b7fSBharata B Rao 	 * UFFD_FEATURE_MINOR_HUGETLBFS, but for shmem-backed pages instead.
192c1fcf220SDr. David Alan Gilbert 	 */
193c1fcf220SDr. David Alan Gilbert #define UFFD_FEATURE_PAGEFAULT_FLAG_WP		(1<<0)
194c1fcf220SDr. David Alan Gilbert #define UFFD_FEATURE_EVENT_FORK			(1<<1)
1953a5eb5b4SPaolo Bonzini #define UFFD_FEATURE_EVENT_REMAP		(1<<2)
19674c98e20SCornelia Huck #define UFFD_FEATURE_EVENT_REMOVE		(1<<3)
1973a5eb5b4SPaolo Bonzini #define UFFD_FEATURE_MISSING_HUGETLBFS		(1<<4)
1983a5eb5b4SPaolo Bonzini #define UFFD_FEATURE_MISSING_SHMEM		(1<<5)
19974c98e20SCornelia Huck #define UFFD_FEATURE_EVENT_UNMAP		(1<<6)
200d4083f50SAlexey Perevalov #define UFFD_FEATURE_SIGBUS			(1<<7)
201d4083f50SAlexey Perevalov #define UFFD_FEATURE_THREAD_ID			(1<<8)
202278f064eSEduardo Habkost #define UFFD_FEATURE_MINOR_HUGETLBFS		(1<<9)
203*327d4b7fSBharata B Rao #define UFFD_FEATURE_MINOR_SHMEM		(1<<10)
204c1fcf220SDr. David Alan Gilbert 	__u64 features;
205c1fcf220SDr. David Alan Gilbert 
206c1fcf220SDr. David Alan Gilbert 	__u64 ioctls;
207c1fcf220SDr. David Alan Gilbert };
208c1fcf220SDr. David Alan Gilbert 
209c1fcf220SDr. David Alan Gilbert struct uffdio_range {
210c1fcf220SDr. David Alan Gilbert 	__u64 start;
211c1fcf220SDr. David Alan Gilbert 	__u64 len;
212c1fcf220SDr. David Alan Gilbert };
213c1fcf220SDr. David Alan Gilbert 
214c1fcf220SDr. David Alan Gilbert struct uffdio_register {
215c1fcf220SDr. David Alan Gilbert 	struct uffdio_range range;
216c1fcf220SDr. David Alan Gilbert #define UFFDIO_REGISTER_MODE_MISSING	((__u64)1<<0)
217c1fcf220SDr. David Alan Gilbert #define UFFDIO_REGISTER_MODE_WP		((__u64)1<<1)
218278f064eSEduardo Habkost #define UFFDIO_REGISTER_MODE_MINOR	((__u64)1<<2)
219c1fcf220SDr. David Alan Gilbert 	__u64 mode;
220c1fcf220SDr. David Alan Gilbert 
221c1fcf220SDr. David Alan Gilbert 	/*
222c1fcf220SDr. David Alan Gilbert 	 * kernel answers which ioctl commands are available for the
223c1fcf220SDr. David Alan Gilbert 	 * range, keep at the end as the last 8 bytes aren't read.
224c1fcf220SDr. David Alan Gilbert 	 */
225c1fcf220SDr. David Alan Gilbert 	__u64 ioctls;
226c1fcf220SDr. David Alan Gilbert };
227c1fcf220SDr. David Alan Gilbert 
228c1fcf220SDr. David Alan Gilbert struct uffdio_copy {
229c1fcf220SDr. David Alan Gilbert 	__u64 dst;
230c1fcf220SDr. David Alan Gilbert 	__u64 src;
231c1fcf220SDr. David Alan Gilbert 	__u64 len;
232c1fcf220SDr. David Alan Gilbert #define UFFDIO_COPY_MODE_DONTWAKE		((__u64)1<<0)
233dc6f8d45SCornelia Huck 	/*
234dc6f8d45SCornelia Huck 	 * UFFDIO_COPY_MODE_WP will map the page write protected on
235dc6f8d45SCornelia Huck 	 * the fly.  UFFDIO_COPY_MODE_WP is available only if the
236dc6f8d45SCornelia Huck 	 * write protected ioctl is implemented for the range
237dc6f8d45SCornelia Huck 	 * according to the uffdio_register.ioctls.
238dc6f8d45SCornelia Huck 	 */
239dc6f8d45SCornelia Huck #define UFFDIO_COPY_MODE_WP			((__u64)1<<1)
240c1fcf220SDr. David Alan Gilbert 	__u64 mode;
241c1fcf220SDr. David Alan Gilbert 
242c1fcf220SDr. David Alan Gilbert 	/*
243c1fcf220SDr. David Alan Gilbert 	 * "copy" is written by the ioctl and must be at the end: the
244c1fcf220SDr. David Alan Gilbert 	 * copy_from_user will not read the last 8 bytes.
245c1fcf220SDr. David Alan Gilbert 	 */
246c1fcf220SDr. David Alan Gilbert 	__s64 copy;
247c1fcf220SDr. David Alan Gilbert };
248c1fcf220SDr. David Alan Gilbert 
249c1fcf220SDr. David Alan Gilbert struct uffdio_zeropage {
250c1fcf220SDr. David Alan Gilbert 	struct uffdio_range range;
251c1fcf220SDr. David Alan Gilbert #define UFFDIO_ZEROPAGE_MODE_DONTWAKE		((__u64)1<<0)
252c1fcf220SDr. David Alan Gilbert 	__u64 mode;
253c1fcf220SDr. David Alan Gilbert 
254c1fcf220SDr. David Alan Gilbert 	/*
255c1fcf220SDr. David Alan Gilbert 	 * "zeropage" is written by the ioctl and must be at the end:
256c1fcf220SDr. David Alan Gilbert 	 * the copy_from_user will not read the last 8 bytes.
257c1fcf220SDr. David Alan Gilbert 	 */
258c1fcf220SDr. David Alan Gilbert 	__s64 zeropage;
259c1fcf220SDr. David Alan Gilbert };
260c1fcf220SDr. David Alan Gilbert 
261dc6f8d45SCornelia Huck struct uffdio_writeprotect {
262dc6f8d45SCornelia Huck 	struct uffdio_range range;
263dc6f8d45SCornelia Huck /*
264dc6f8d45SCornelia Huck  * UFFDIO_WRITEPROTECT_MODE_WP: set the flag to write protect a range,
265dc6f8d45SCornelia Huck  * unset the flag to undo protection of a range which was previously
266dc6f8d45SCornelia Huck  * write protected.
267dc6f8d45SCornelia Huck  *
268dc6f8d45SCornelia Huck  * UFFDIO_WRITEPROTECT_MODE_DONTWAKE: set the flag to avoid waking up
269dc6f8d45SCornelia Huck  * any wait thread after the operation succeeds.
270dc6f8d45SCornelia Huck  *
271dc6f8d45SCornelia Huck  * NOTE: Write protecting a region (WP=1) is unrelated to page faults,
272dc6f8d45SCornelia Huck  * therefore DONTWAKE flag is meaningless with WP=1.  Removing write
273dc6f8d45SCornelia Huck  * protection (WP=0) in response to a page fault wakes the faulting
274dc6f8d45SCornelia Huck  * task unless DONTWAKE is set.
275dc6f8d45SCornelia Huck  */
276dc6f8d45SCornelia Huck #define UFFDIO_WRITEPROTECT_MODE_WP		((__u64)1<<0)
277dc6f8d45SCornelia Huck #define UFFDIO_WRITEPROTECT_MODE_DONTWAKE	((__u64)1<<1)
278dc6f8d45SCornelia Huck 	__u64 mode;
279dc6f8d45SCornelia Huck };
280dc6f8d45SCornelia Huck 
281278f064eSEduardo Habkost struct uffdio_continue {
282278f064eSEduardo Habkost 	struct uffdio_range range;
283278f064eSEduardo Habkost #define UFFDIO_CONTINUE_MODE_DONTWAKE		((__u64)1<<0)
284278f064eSEduardo Habkost 	__u64 mode;
285278f064eSEduardo Habkost 
286278f064eSEduardo Habkost 	/*
287278f064eSEduardo Habkost 	 * Fields below here are written by the ioctl and must be at the end:
288278f064eSEduardo Habkost 	 * the copy_from_user will not read past here.
289278f064eSEduardo Habkost 	 */
290278f064eSEduardo Habkost 	__s64 mapped;
291278f064eSEduardo Habkost };
292278f064eSEduardo Habkost 
293b3c818a4SEric Farman /*
294b3c818a4SEric Farman  * Flags for the userfaultfd(2) system call itself.
295b3c818a4SEric Farman  */
296b3c818a4SEric Farman 
297b3c818a4SEric Farman /*
298b3c818a4SEric Farman  * Create a userfaultfd that can handle page faults only in user mode.
299b3c818a4SEric Farman  */
300b3c818a4SEric Farman #define UFFD_USER_MODE_ONLY 1
301b3c818a4SEric Farman 
302c1fcf220SDr. David Alan Gilbert #endif /* _LINUX_USERFAULTFD_H */
303