[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/31] vhost: Add vhost_svq_set_guest_call_notifier
From: |
Eugenio Pérez |
Subject: |
[PATCH 08/31] vhost: Add vhost_svq_set_guest_call_notifier |
Date: |
Fri, 21 Jan 2022 21:27:10 +0100 |
This allows the vhost-vdpa device to set SVQ -> guest notifier to SVQ.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-shadow-virtqueue.h | 1 +
hw/virtio/vhost-shadow-virtqueue.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/hw/virtio/vhost-shadow-virtqueue.h
b/hw/virtio/vhost-shadow-virtqueue.h
index a78234b52b..c9ffa11fce 100644
--- a/hw/virtio/vhost-shadow-virtqueue.h
+++ b/hw/virtio/vhost-shadow-virtqueue.h
@@ -16,6 +16,7 @@
typedef struct VhostShadowVirtqueue VhostShadowVirtqueue;
void vhost_svq_set_svq_kick_fd(VhostShadowVirtqueue *svq, int svq_kick_fd);
+void vhost_svq_set_guest_call_notifier(VhostShadowVirtqueue *svq, int call_fd);
const EventNotifier *vhost_svq_get_dev_kick_notifier(
const VhostShadowVirtqueue *svq);
const EventNotifier *vhost_svq_get_svq_call_notifier(
diff --git a/hw/virtio/vhost-shadow-virtqueue.c
b/hw/virtio/vhost-shadow-virtqueue.c
index 25fcdf16ec..9c2cf07fd9 100644
--- a/hw/virtio/vhost-shadow-virtqueue.c
+++ b/hw/virtio/vhost-shadow-virtqueue.c
@@ -29,6 +29,9 @@ typedef struct VhostShadowVirtqueue {
* So shadow virtqueue must not clean it, or we would lose VirtQueue one.
*/
EventNotifier svq_kick;
+
+ /* Guest's call notifier, where SVQ calls guest. */
+ EventNotifier svq_call;
} VhostShadowVirtqueue;
#define INVALID_SVQ_KICK_FD -1
@@ -67,6 +70,19 @@ const EventNotifier *vhost_svq_get_svq_call_notifier(
return &svq->hdev_call;
}
+/**
+ * Set the call notifier for the SVQ to call the guest
+ *
+ * @svq Shadow virtqueue
+ * @call_fd call notifier
+ *
+ * Called on BQL context.
+ */
+void vhost_svq_set_guest_call_notifier(VhostShadowVirtqueue *svq, int call_fd)
+{
+ event_notifier_init_fd(&svq->svq_call, call_fd);
+}
+
/**
* Set a new file descriptor for the guest to kick SVQ and notify for avail
*
--
2.27.0
- Re: [PATCH 04/31] vdpa: Add vhost_svq_set_svq_kick_fd, (continued)
- [PATCH 05/31] vhost: Add Shadow VirtQueue kick forwarding capabilities, Eugenio Pérez, 2022/01/21
- [PATCH 06/31] vhost: Route guest->host notification through shadow virtqueue, Eugenio Pérez, 2022/01/21
- [PATCH 07/31] vhost: dd vhost_svq_get_svq_call_notifier, Eugenio Pérez, 2022/01/21
- [PATCH 08/31] vhost: Add vhost_svq_set_guest_call_notifier,
Eugenio Pérez <=
- [PATCH 09/31] vhost-vdpa: Take into account SVQ in vhost_vdpa_set_vring_call, Eugenio Pérez, 2022/01/21
- [PATCH 10/31] vhost: Route host->guest notification through shadow virtqueue, Eugenio Pérez, 2022/01/21
- [PATCH 12/31] vhost: Add vhost_svq_valid_guest_features to shadow vq, Eugenio Pérez, 2022/01/21
- [PATCH 11/31] vhost: Add vhost_svq_valid_device_features to shadow vq, Eugenio Pérez, 2022/01/21
- [PATCH 13/31] vhost: Add vhost_svq_ack_guest_features to shadow vq, Eugenio Pérez, 2022/01/21
- [PATCH 14/31] virtio: Add vhost_shadow_vq_get_vring_addr, Eugenio Pérez, 2022/01/21