diff options
author | Andrey Gruzdev <andrey.gruzdev@virtuozzo.com> | 2021-01-29 13:14:04 +0300 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2021-02-08 11:19:51 +0000 |
commit | 0e9b5cd6b238b7ca9a3a50d957f50c37082705a0 (patch) | |
tree | e97bd85a81861d9885b274b6d6b48159a3502632 /include/qemu/userfaultfd.h | |
parent | 6e8c25b4c623f755f588893661fec77ae88e128a (diff) | |
download | qemu-0e9b5cd6b238b7ca9a3a50d957f50c37082705a0.zip qemu-0e9b5cd6b238b7ca9a3a50d957f50c37082705a0.tar.gz qemu-0e9b5cd6b238b7ca9a3a50d957f50c37082705a0.tar.bz2 |
migration: introduce UFFD-WP low-level interface helpers
Glue code to the userfaultfd kernel implementation.
Querying feature support, createing file descriptor, feature control,
memory region registration, IOCTLs on registered registered regions.
Signed-off-by: Andrey Gruzdev <andrey.gruzdev@virtuozzo.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20210129101407.103458-3-andrey.gruzdev@virtuozzo.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Fixed up range.start casting for 32bit
Diffstat (limited to 'include/qemu/userfaultfd.h')
-rw-r--r-- | include/qemu/userfaultfd.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/qemu/userfaultfd.h b/include/qemu/userfaultfd.h new file mode 100644 index 0000000..6b74f92 --- /dev/null +++ b/include/qemu/userfaultfd.h @@ -0,0 +1,35 @@ +/* + * Linux UFFD-WP support + * + * Copyright Virtuozzo GmbH, 2020 + * + * Authors: + * Andrey Gruzdev <andrey.gruzdev@virtuozzo.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ + +#ifndef USERFAULTFD_H +#define USERFAULTFD_H + +#include "qemu/osdep.h" +#include "exec/hwaddr.h" +#include <linux/userfaultfd.h> + +int uffd_query_features(uint64_t *features); +int uffd_create_fd(uint64_t features, bool non_blocking); +void uffd_close_fd(int uffd_fd); +int uffd_register_memory(int uffd_fd, void *addr, uint64_t length, + uint64_t mode, uint64_t *ioctls); +int uffd_unregister_memory(int uffd_fd, void *addr, uint64_t length); +int uffd_change_protection(int uffd_fd, void *addr, uint64_t length, + bool wp, bool dont_wake); +int uffd_copy_page(int uffd_fd, void *dst_addr, void *src_addr, + uint64_t length, bool dont_wake); +int uffd_zero_page(int uffd_fd, void *addr, uint64_t length, bool dont_wake); +int uffd_wakeup(int uffd_fd, void *addr, uint64_t length); +int uffd_read_events(int uffd_fd, struct uffd_msg *msgs, int count); +bool uffd_poll_events(int uffd_fd, int tmo); + +#endif /* USERFAULTFD_H */ |