]> git.proxmox.com Git - mirror_qemu.git/blame - include/qemu/userfaultfd.h
Merge tag 'misc-fixes-20231113' of https://github.com/philmd/qemu into staging
[mirror_qemu.git] / include / qemu / userfaultfd.h
CommitLineData
0e9b5cd6
AG
1/*
2 * Linux UFFD-WP support
3 *
4 * Copyright Virtuozzo GmbH, 2020
5 *
6 * Authors:
7 * Andrey Gruzdev <andrey.gruzdev@virtuozzo.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2 or
10 * later. See the COPYING file in the top-level directory.
11 */
12
13#ifndef USERFAULTFD_H
14#define USERFAULTFD_H
15
d5890ea0
PX
16#ifdef CONFIG_LINUX
17
0e9b5cd6
AG
18#include "exec/hwaddr.h"
19#include <linux/userfaultfd.h>
20
d5890ea0
PX
21/**
22 * uffd_open(): Open an userfaultfd handle for current context.
23 *
24 * @flags: The flags we want to pass in when creating the handle.
25 *
26 * Returns: the uffd handle if >=0, or <0 if error happens.
27 */
28int uffd_open(int flags);
0e9b5cd6
AG
29int uffd_query_features(uint64_t *features);
30int uffd_create_fd(uint64_t features, bool non_blocking);
31void uffd_close_fd(int uffd_fd);
32int uffd_register_memory(int uffd_fd, void *addr, uint64_t length,
33 uint64_t mode, uint64_t *ioctls);
34int uffd_unregister_memory(int uffd_fd, void *addr, uint64_t length);
35int uffd_change_protection(int uffd_fd, void *addr, uint64_t length,
36 bool wp, bool dont_wake);
37int uffd_copy_page(int uffd_fd, void *dst_addr, void *src_addr,
38 uint64_t length, bool dont_wake);
39int uffd_zero_page(int uffd_fd, void *addr, uint64_t length, bool dont_wake);
40int uffd_wakeup(int uffd_fd, void *addr, uint64_t length);
41int uffd_read_events(int uffd_fd, struct uffd_msg *msgs, int count);
42bool uffd_poll_events(int uffd_fd, int tmo);
43
d5890ea0
PX
44#endif /* CONFIG_LINUX */
45
0e9b5cd6 46#endif /* USERFAULTFD_H */