Commit faf4506f authored by Andrea Arcangeli's avatar Andrea Arcangeli

userfaultfd: UFFDIO_REMAP uABI

This implements the uABI of UFFDIO_REMAP.

Notably one mode bitflag is also forwarded (and in turn known) by the
lowlevel remap_pages method.
parent b3d3df5a
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
#define UFFD_API_RANGE_IOCTLS \ #define UFFD_API_RANGE_IOCTLS \
((__u64)1 << _UFFDIO_WAKE | \ ((__u64)1 << _UFFDIO_WAKE | \
(__u64)1 << _UFFDIO_COPY | \ (__u64)1 << _UFFDIO_COPY | \
(__u64)1 << _UFFDIO_ZEROPAGE) (__u64)1 << _UFFDIO_ZEROPAGE | \
(__u64)1 << _UFFDIO_REMAP)
/* /*
* Valid ioctl command number range with this API is from 0x00 to * Valid ioctl command number range with this API is from 0x00 to
...@@ -38,6 +39,7 @@ ...@@ -38,6 +39,7 @@
#define _UFFDIO_WAKE (0x02) #define _UFFDIO_WAKE (0x02)
#define _UFFDIO_COPY (0x03) #define _UFFDIO_COPY (0x03)
#define _UFFDIO_ZEROPAGE (0x04) #define _UFFDIO_ZEROPAGE (0x04)
#define _UFFDIO_REMAP (0x05)
#define _UFFDIO_API (0x3F) #define _UFFDIO_API (0x3F)
/* userfaultfd ioctl ids */ /* userfaultfd ioctl ids */
...@@ -54,6 +56,8 @@ ...@@ -54,6 +56,8 @@
struct uffdio_copy) struct uffdio_copy)
#define UFFDIO_ZEROPAGE _IOWR(UFFDIO, _UFFDIO_ZEROPAGE, \ #define UFFDIO_ZEROPAGE _IOWR(UFFDIO, _UFFDIO_ZEROPAGE, \
struct uffdio_zeropage) struct uffdio_zeropage)
#define UFFDIO_REMAP _IOWR(UFFDIO, _UFFDIO_REMAP, \
struct uffdio_remap)
/* read() structure */ /* read() structure */
struct uffd_msg { struct uffd_msg {
...@@ -158,4 +162,23 @@ struct uffdio_zeropage { ...@@ -158,4 +162,23 @@ struct uffdio_zeropage {
__s64 zeropage; __s64 zeropage;
}; };
struct uffdio_remap {
__u64 dst;
__u64 src;
__u64 len;
/*
* Especially if used to atomically remove memory from the
* address space the wake on the dst range is not needed.
*/
#define UFFDIO_REMAP_MODE_DONTWAKE ((__u64)1<<0)
#define UFFDIO_REMAP_MODE_ALLOW_SRC_HOLES ((__u64)1<<1)
__u64 mode;
/*
* "remap" is written by the ioctl and must be at the end: the
* copy_from_user will not read the last 8 bytes.
*/
__s64 remap;
};
#endif /* _LINUX_USERFAULTFD_H */ #endif /* _LINUX_USERFAULTFD_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment