[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 09/27] vhost: Route host->guest notification through qemu
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH 09/27] vhost: Route host->guest notification through qemu |
Date: |
Fri, 20 Nov 2020 19:50:47 +0100 |
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-sw-lm-ring.c | 3 +++
hw/virtio/vhost.c | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/hw/virtio/vhost-sw-lm-ring.c b/hw/virtio/vhost-sw-lm-ring.c
index 0192e77831..cbf53965cd 100644
--- a/hw/virtio/vhost-sw-lm-ring.c
+++ b/hw/virtio/vhost-sw-lm-ring.c
@@ -50,6 +50,9 @@ VhostShadowVirtqueue *vhost_sw_lm_shadow_vq(struct vhost_dev
*dev, int idx)
r = dev->vhost_ops->vhost_set_vring_kick(dev, &file);
assert(r == 0);
+ vhost_virtqueue_mask(dev, dev->vdev, idx, true);
+ vhost_virtqueue_pending(dev, idx);
+
return svq;
}
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 1d55e26d45..9352c56bfa 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -960,12 +960,29 @@ static void handle_sw_lm_vq(VirtIODevice *vdev, VirtQueue
*vq)
vhost_vring_kick(svq);
}
+static void vhost_handle_call(EventNotifier *n)
+{
+ struct vhost_virtqueue *hvq = container_of(n,
+ struct vhost_virtqueue,
+ masked_notifier);
+ struct vhost_dev *vdev = hvq->dev;
+ int idx = vdev->vq_index + (hvq == &vdev->vqs[0] ? 0 : 1);
+ VirtQueue *vq = virtio_get_queue(vdev->vdev, idx);
+
+ if (event_notifier_test_and_clear(n)) {
+ virtio_queue_invalidate_signalled_used(vdev->vdev, idx);
+ virtio_notify_irqfd(vdev->vdev, vq);
+ }
+}
+
static int vhost_sw_live_migration_stop(struct vhost_dev *dev)
{
int idx;
vhost_dev_enable_notifiers(dev, dev->vdev);
for (idx = 0; idx < dev->nvqs; ++idx) {
+ vhost_virtqueue_mask(dev, dev->vdev, idx, false);
+ vhost_virtqueue_pending(dev, idx);
vhost_sw_lm_shadow_vq_free(dev->sw_lm_shadow_vq[idx]);
}
@@ -977,7 +994,10 @@ static int vhost_sw_live_migration_start(struct vhost_dev
*dev)
int idx;
for (idx = 0; idx < dev->nvqs; ++idx) {
+ struct vhost_virtqueue *vq = &dev->vqs[idx];
+
dev->sw_lm_shadow_vq[idx] = vhost_sw_lm_shadow_vq(dev, idx);
+ event_notifier_set_handler(&vq->masked_notifier, vhost_handle_call);
}
vhost_dev_disable_notifiers(dev, dev->vdev);
--
2.18.4
- [RFC PATCH 00/27] vDPA software assisted live migration, Eugenio Pérez, 2020/11/20
- [RFC PATCH 01/27] vhost: Add vhost_dev_can_log, Eugenio Pérez, 2020/11/20
- [RFC PATCH 02/27] vhost: Add device callback in vhost_migration_log, Eugenio Pérez, 2020/11/20
- [RFC PATCH 03/27] vhost: Move log resize/put to vhost_dev_set_log, Eugenio Pérez, 2020/11/20
- [RFC PATCH 04/27] vhost: add vhost_kernel_set_vring_enable, Eugenio Pérez, 2020/11/20
- [RFC PATCH 05/27] vhost: Add hdev->dev.sw_lm_vq_handler, Eugenio Pérez, 2020/11/20
- [RFC PATCH 06/27] virtio: Add virtio_queue_get_used_notify_split, Eugenio Pérez, 2020/11/20
- [RFC PATCH 07/27] vhost: Route guest->host notification through qemu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 08/27] vhost: Add a flag for software assisted Live Migration, Eugenio Pérez, 2020/11/20
- [RFC PATCH 09/27] vhost: Route host->guest notification through qemu,
Eugenio Pérez <=
- [RFC PATCH 10/27] vhost: Allocate shadow vring, Eugenio Pérez, 2020/11/20
- [RFC PATCH 11/27] virtio: const-ify all virtio_tswap* functions, Eugenio Pérez, 2020/11/20
- [RFC PATCH 12/27] virtio: Add virtio_queue_full, Eugenio Pérez, 2020/11/20
- [RFC PATCH 13/27] vhost: Send buffers to device, Eugenio Pérez, 2020/11/20
- [RFC PATCH 14/27] virtio: Remove virtio_queue_get_used_notify_split, Eugenio Pérez, 2020/11/20
- [RFC PATCH 15/27] vhost: Do not invalidate signalled used, Eugenio Pérez, 2020/11/20
- [RFC PATCH 16/27] virtio: Expose virtqueue_alloc_element, Eugenio Pérez, 2020/11/20
- [RFC PATCH 17/27] vhost: add vhost_vring_set_notification_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 18/27] vhost: add vhost_vring_poll_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 19/27] vhost: add vhost_vring_get_buf_rcu, Eugenio Pérez, 2020/11/20