ppc/xive: Always recompute the PIPR when pushing an OS context
[qemu.git] / util / aio-posix.h
blob80b927c7f4480601e16ca71897d6d8528cce1197
1 /*
2 * AioContext POSIX event loop implementation internal APIs
4 * Copyright IBM, Corp. 2008
5 * Copyright Red Hat, Inc. 2020
7 * Authors:
8 * Anthony Liguori <aliguori@us.ibm.com>
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
13 * Contributions after 2012-01-13 are licensed under the terms of the
14 * GNU GPL, version 2 or (at your option) any later version.
17 #ifndef AIO_POSIX_H
18 #define AIO_POSIX_H
20 #include "block/aio.h"
22 struct AioHandler {
23 GPollFD pfd;
24 IOHandler *io_read;
25 IOHandler *io_write;
26 AioPollFn *io_poll;
27 IOHandler *io_poll_ready;
28 IOHandler *io_poll_begin;
29 IOHandler *io_poll_end;
30 void *opaque;
31 QLIST_ENTRY(AioHandler) node;
32 QLIST_ENTRY(AioHandler) node_ready; /* only used during aio_poll() */
33 QLIST_ENTRY(AioHandler) node_deleted;
34 QLIST_ENTRY(AioHandler) node_poll;
35 #ifdef CONFIG_LINUX_IO_URING
36 QSLIST_ENTRY(AioHandler) node_submitted;
37 unsigned flags; /* see fdmon-io_uring.c */
38 #endif
39 int64_t poll_idle_timeout; /* when to stop userspace polling */
40 bool poll_ready; /* has polling detected an event? */
41 bool is_external;
44 /* Add a handler to a ready list */
45 void aio_add_ready_handler(AioHandlerList *ready_list, AioHandler *node,
46 int revents);
48 extern const FDMonOps fdmon_poll_ops;
50 #ifdef CONFIG_EPOLL_CREATE1
51 bool fdmon_epoll_try_upgrade(AioContext *ctx, unsigned npfd);
52 void fdmon_epoll_setup(AioContext *ctx);
53 void fdmon_epoll_disable(AioContext *ctx);
54 #else
55 static inline bool fdmon_epoll_try_upgrade(AioContext *ctx, unsigned npfd)
57 return false;
60 static inline void fdmon_epoll_setup(AioContext *ctx)
64 static inline void fdmon_epoll_disable(AioContext *ctx)
67 #endif /* !CONFIG_EPOLL_CREATE1 */
69 #ifdef CONFIG_LINUX_IO_URING
70 bool fdmon_io_uring_setup(AioContext *ctx);
71 void fdmon_io_uring_destroy(AioContext *ctx);
72 #else
73 static inline bool fdmon_io_uring_setup(AioContext *ctx)
75 return false;
78 static inline void fdmon_io_uring_destroy(AioContext *ctx)
81 #endif /* !CONFIG_LINUX_IO_URING */
83 #endif /* AIO_POSIX_H */