aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2015-09-04 18:47:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-04 19:54:41 -0400
commit1f1c6f075904c241f9e44eb37efa8777141fc938 (patch)
tree33c249c9d0db531b599eea07cb8c9aaa390bdeb4 /include/uapi/linux
parent1380fca084743fef8d17e59b273473393944ce58 (diff)
userfaultfd: UFFDIO_COPY|UFFDIO_ZEROPAGE uAPI
This implements the uABI of UFFDIO_COPY and UFFDIO_ZEROPAGE. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Pavel Emelyanov <xemul@parallels.com> Cc: Sanidhya Kashyap <sanidhya.gatech@gmail.com> Cc: zhang.zhanghailiang@huawei.com Cc: "Kirill A. Shutemov" <kirill@shutemov.name> Cc: Andres Lagar-Cavilla <andreslc@google.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Hugh Dickins <hughd@google.com> Cc: Peter Feiner <pfeiner@google.com> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: "Huangpeng (Peter)" <peter.huangpeng@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/userfaultfd.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h
index a5f8825381ef..df0e09bb7dd5 100644
--- a/include/uapi/linux/userfaultfd.h
+++ b/include/uapi/linux/userfaultfd.h
@@ -25,7 +25,9 @@
25 (__u64)1 << _UFFDIO_UNREGISTER | \ 25 (__u64)1 << _UFFDIO_UNREGISTER | \
26 (__u64)1 << _UFFDIO_API) 26 (__u64)1 << _UFFDIO_API)
27#define UFFD_API_RANGE_IOCTLS \ 27#define UFFD_API_RANGE_IOCTLS \
28 ((__u64)1 << _UFFDIO_WAKE) 28 ((__u64)1 << _UFFDIO_WAKE | \
29 (__u64)1 << _UFFDIO_COPY | \
30 (__u64)1 << _UFFDIO_ZEROPAGE)
29 31
30/* 32/*
31 * Valid ioctl command number range with this API is from 0x00 to 33 * Valid ioctl command number range with this API is from 0x00 to
@@ -38,6 +40,8 @@
38#define _UFFDIO_REGISTER (0x00) 40#define _UFFDIO_REGISTER (0x00)
39#define _UFFDIO_UNREGISTER (0x01) 41#define _UFFDIO_UNREGISTER (0x01)
40#define _UFFDIO_WAKE (0x02) 42#define _UFFDIO_WAKE (0x02)
43#define _UFFDIO_COPY (0x03)
44#define _UFFDIO_ZEROPAGE (0x04)
41#define _UFFDIO_API (0x3F) 45#define _UFFDIO_API (0x3F)
42 46
43/* userfaultfd ioctl ids */ 47/* userfaultfd ioctl ids */
@@ -50,6 +54,10 @@
50 struct uffdio_range) 54 struct uffdio_range)
51#define UFFDIO_WAKE _IOR(UFFDIO, _UFFDIO_WAKE, \ 55#define UFFDIO_WAKE _IOR(UFFDIO, _UFFDIO_WAKE, \
52 struct uffdio_range) 56 struct uffdio_range)
57#define UFFDIO_COPY _IOWR(UFFDIO, _UFFDIO_COPY, \
58 struct uffdio_copy)
59#define UFFDIO_ZEROPAGE _IOWR(UFFDIO, _UFFDIO_ZEROPAGE, \
60 struct uffdio_zeropage)
53 61
54/* read() structure */ 62/* read() structure */
55struct uffd_msg { 63struct uffd_msg {
@@ -126,4 +134,36 @@ struct uffdio_register {
126 __u64 ioctls; 134 __u64 ioctls;
127}; 135};
128 136
137struct uffdio_copy {
138 __u64 dst;
139 __u64 src;
140 __u64 len;
141 /*
142 * There will be a wrprotection flag later that allows to map
143 * pages wrprotected on the fly. And such a flag will be
144 * available if the wrprotection ioctl are implemented for the
145 * range according to the uffdio_register.ioctls.
146 */
147#define UFFDIO_COPY_MODE_DONTWAKE ((__u64)1<<0)
148 __u64 mode;
149
150 /*
151 * "copy" is written by the ioctl and must be at the end: the
152 * copy_from_user will not read the last 8 bytes.
153 */
154 __s64 copy;
155};
156
157struct uffdio_zeropage {
158 struct uffdio_range range;
159#define UFFDIO_ZEROPAGE_MODE_DONTWAKE ((__u64)1<<0)
160 __u64 mode;
161
162 /*
163 * "zeropage" is written by the ioctl and must be at the end:
164 * the copy_from_user will not read the last 8 bytes.
165 */
166 __s64 zeropage;
167};
168
129#endif /* _LINUX_USERFAULTFD_H */ 169#endif /* _LINUX_USERFAULTFD_H */