[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v4 40/47] event_notifier: add event_notifier_get_wfd()
From: |
Michael S. Tsirkin |
Subject: |
[PULL v4 40/47] event_notifier: add event_notifier_get_wfd() |
Date: |
Mon, 7 Mar 2022 17:46:39 -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>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220304100854.14829-2-slp@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 v4 30/47] headers: Add pvpanic.h, (continued)
- [PULL v4 30/47] headers: Add pvpanic.h, Michael S. Tsirkin, 2022/03/07
- [PULL v4 31/47] hw/misc/pvpanic: Use standard headers instead, Michael S. Tsirkin, 2022/03/07
- [PULL v4 33/47] pci: expose TYPE_XIO3130_DOWNSTREAM name, Michael S. Tsirkin, 2022/03/07
- [PULL v4 35/47] pc: add option to disable PS/2 mouse/keyboard, Michael S. Tsirkin, 2022/03/07
- [PULL v4 34/47] acpi: pcihp: pcie: set power on cap on parent slot, Michael S. Tsirkin, 2022/03/07
- [PULL v4 32/47] pci: show id info when pci BDF conflict, Michael S. Tsirkin, 2022/03/07
- [PULL v4 36/47] vhost-vsock: detach the virqueue element in case of error, Michael S. Tsirkin, 2022/03/07
- [PULL v4 37/47] x86: cleanup unused compat_apic_id_mode, Michael S. Tsirkin, 2022/03/07
- [PULL v4 38/47] hw/smbios: Add table 4 parameter, "processor-id", Michael S. Tsirkin, 2022/03/07
- [PULL v4 39/47] pci: drop COMPAT_PROP_PCP for 2.0 machine types, Michael S. Tsirkin, 2022/03/07
- [PULL v4 40/47] event_notifier: add event_notifier_get_wfd(),
Michael S. Tsirkin <=
- [PULL v4 41/47] vhost: use wfd on functions setting vring call fd, Michael S. Tsirkin, 2022/03/07
- [PULL v4 42/47] configure, meson: allow enabling vhost-user on all POSIX systems, Michael S. Tsirkin, 2022/03/07
- [PULL v4 43/47] docs: vhost-user: add subsection for non-Linux platforms, Michael S. Tsirkin, 2022/03/07
- [PULL v4 44/47] tests/acpi: i386: allow FACP acpi table changes, Michael S. Tsirkin, 2022/03/07
- [PULL v4 45/47] hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table, Michael S. Tsirkin, 2022/03/07
- [PULL v4 46/47] tests/acpi: i386: update FACP table differences, Michael S. Tsirkin, 2022/03/07
- [PULL v4 47/47] hw/acpi/microvm: turn on 8042 bit in FADT boot architecture flags if present, Michael S. Tsirkin, 2022/03/07
- Re: [PULL v4 00/47] virtio,pc,pci: features, cleanups, fixes, Peter Maydell, 2022/03/09