[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 42/45] event_notifier: add event_notifier_get_wfd()
From: |
Michael S. Tsirkin |
Subject: |
[PULL 42/45] event_notifier: add event_notifier_get_wfd() |
Date: |
Fri, 4 Mar 2022 08:42:38 -0500 |
From: Sergio Lopez <slp@redhat.com>
event_notifier_get_fd(const EventNotifier *e) always returns
EventNotifier's read file descriptor (rfd). This is not a problem when
the EventNotifier is backed by a an eventfd, as a single file
descriptor is used both for reading and triggering events (rfd ==
wfd).
But, when EventNotifier is backed by a pipe pair, we have two file
descriptors, one that can only be used for reads (rfd), and the other
only for writes (wfd).
There's, at least, one known situation in which we need to obtain wfd
instead of rfd, which is when setting up the file that's going to be
sent to the peer in vhost's SET_VRING_CALL.
Add a new event_notifier_get_wfd(const EventNotifier *e) that can be
used to obtain wfd where needed.
Signed-off-by: Sergio Lopez <slp@redhat.com>
Message-Id: <20220303115911.20962-2-slp@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/qemu/event_notifier.h | 1 +
util/event_notifier-posix.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/include/qemu/event_notifier.h b/include/qemu/event_notifier.h
index b79add035d..8a4ff308e1 100644
--- a/include/qemu/event_notifier.h
+++ b/include/qemu/event_notifier.h
@@ -38,6 +38,7 @@ int event_notifier_test_and_clear(EventNotifier *);
#ifdef CONFIG_POSIX
void event_notifier_init_fd(EventNotifier *, int fd);
int event_notifier_get_fd(const EventNotifier *);
+int event_notifier_get_wfd(const EventNotifier *);
#else
HANDLE event_notifier_get_handle(EventNotifier *);
#endif
diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c
index 8307013c5d..16294e98d4 100644
--- a/util/event_notifier-posix.c
+++ b/util/event_notifier-posix.c
@@ -99,6 +99,11 @@ int event_notifier_get_fd(const EventNotifier *e)
return e->rfd;
}
+int event_notifier_get_wfd(const EventNotifier *e)
+{
+ return e->wfd;
+}
+
int event_notifier_set(EventNotifier *e)
{
static const uint64_t value = 1;
--
MST
- [PULL 32/45] pci-bridge/xio3130_upstream: Fix error handling, (continued)
- [PULL 32/45] pci-bridge/xio3130_upstream: Fix error handling, Michael S. Tsirkin, 2022/03/04
- [PULL 33/45] pci-bridge/xio3130_downstream: Fix error handling, Michael S. Tsirkin, 2022/03/04
- [PULL 34/45] headers: Add pvpanic.h, Michael S. Tsirkin, 2022/03/04
- [PULL 35/45] hw/misc/pvpanic: Use standard headers instead, Michael S. Tsirkin, 2022/03/04
- [PULL 36/45] pci: show id info when pci BDF conflict, Michael S. Tsirkin, 2022/03/04
- [PULL 37/45] pci: expose TYPE_XIO3130_DOWNSTREAM name, Michael S. Tsirkin, 2022/03/04
- [PULL 38/45] acpi: pcihp: pcie: set power on cap on parent slot, Michael S. Tsirkin, 2022/03/04
- [PULL 39/45] pc: add option to disable PS/2 mouse/keyboard, Michael S. Tsirkin, 2022/03/04
- [PULL 40/45] vhost-vsock: detach the virqueue element in case of error, Michael S. Tsirkin, 2022/03/04
- [PULL 41/45] x86: cleanup unused compat_apic_id_mode, Michael S. Tsirkin, 2022/03/04
- [PULL 42/45] event_notifier: add event_notifier_get_wfd(),
Michael S. Tsirkin <=
- [PULL 43/45] vhost: use wfd on functions setting vring call fd, Michael S. Tsirkin, 2022/03/04
- [PULL 44/45] configure, meson: allow enabling vhost-user on all POSIX systems, Michael S. Tsirkin, 2022/03/04
- [PULL 45/45] docs: vhost-user: add subsection for non-Linux platforms, Michael S. Tsirkin, 2022/03/04
- Re: [PULL 00/45] virtio,pc,pci: features, cleanups, fixes, Peter Maydell, 2022/03/04
- Re: [PULL 00/45] virtio,pc,pci: features, cleanups, fixes, Michael S. Tsirkin, 2022/03/06
- Re: [PULL 00/45] virtio,pc,pci: features, cleanups, fixes, Eric Auger, 2022/03/07