]> git.ipfire.org Git - thirdparty/qemu.git/blobdiff - linux-headers/linux/userfaultfd.h
linux-headers: update to v6.5-rc1
[thirdparty/qemu.git] / linux-headers / linux / userfaultfd.h
index ba5d0df52fb8c1074a7eb3d602690b873abc9600..14e402263a8afa474b6aabed7bc1472524dd562c 100644 (file)
@@ -38,7 +38,8 @@
                           UFFD_FEATURE_MINOR_HUGETLBFS |       \
                           UFFD_FEATURE_MINOR_SHMEM |           \
                           UFFD_FEATURE_EXACT_ADDRESS |         \
-                          UFFD_FEATURE_WP_HUGETLBFS_SHMEM)
+                          UFFD_FEATURE_WP_HUGETLBFS_SHMEM |    \
+                          UFFD_FEATURE_WP_UNPOPULATED)
 #define UFFD_API_IOCTLS                                \
        ((__u64)1 << _UFFDIO_REGISTER |         \
         (__u64)1 << _UFFDIO_UNREGISTER |       \
@@ -203,6 +204,12 @@ struct uffdio_api {
         *
         * UFFD_FEATURE_WP_HUGETLBFS_SHMEM indicates that userfaultfd
         * write-protection mode is supported on both shmem and hugetlbfs.
+        *
+        * UFFD_FEATURE_WP_UNPOPULATED indicates that userfaultfd
+        * write-protection mode will always apply to unpopulated pages
+        * (i.e. empty ptes).  This will be the default behavior for shmem
+        * & hugetlbfs, so this flag only affects anonymous memory behavior
+        * when userfault write-protection mode is registered.
         */
 #define UFFD_FEATURE_PAGEFAULT_FLAG_WP         (1<<0)
 #define UFFD_FEATURE_EVENT_FORK                        (1<<1)
@@ -217,6 +224,7 @@ struct uffdio_api {
 #define UFFD_FEATURE_MINOR_SHMEM               (1<<10)
 #define UFFD_FEATURE_EXACT_ADDRESS             (1<<11)
 #define UFFD_FEATURE_WP_HUGETLBFS_SHMEM                (1<<12)
+#define UFFD_FEATURE_WP_UNPOPULATED            (1<<13)
        __u64 features;
 
        __u64 ioctls;
@@ -297,6 +305,13 @@ struct uffdio_writeprotect {
 struct uffdio_continue {
        struct uffdio_range range;
 #define UFFDIO_CONTINUE_MODE_DONTWAKE          ((__u64)1<<0)
+       /*
+        * UFFDIO_CONTINUE_MODE_WP will map the page write protected on
+        * the fly.  UFFDIO_CONTINUE_MODE_WP is available only if the
+        * write protected ioctl is implemented for the range
+        * according to the uffdio_register.ioctls.
+        */
+#define UFFDIO_CONTINUE_MODE_WP                        ((__u64)1<<1)
        __u64 mode;
 
        /*