[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 10/24] vhost: introduce vhost_dev_virtqueue_restart()
From: |
Kangjie Xu |
Subject: |
[PATCH v2 10/24] vhost: introduce vhost_dev_virtqueue_restart() |
Date: |
Tue, 16 Aug 2022 09:06:22 +0800 |
Introduce vhost_dev_virtqueue_restart(), which can restart the
virtqueue when the vhost has already started running.
Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
hw/virtio/vhost.c | 13 +++++++++++++
include/hw/virtio/vhost.h | 2 ++
2 files changed, 15 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 1bca9ff48d..fc3f550c76 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1913,3 +1913,16 @@ void vhost_dev_virtqueue_stop(struct vhost_dev *hdev,
VirtIODevice *vdev,
hdev->vqs + idx,
idx);
}
+
+int vhost_dev_virtqueue_restart(struct vhost_dev *hdev, VirtIODevice *vdev,
+ int idx)
+{
+ const VhostOps *vhost_ops = hdev->vhost_ops;
+
+ assert(vhost_ops);
+
+ return vhost_virtqueue_start(hdev,
+ vdev,
+ hdev->vqs + idx,
+ hdev->vq_index + idx);
+}
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 574888440c..b3394b6348 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -291,4 +291,6 @@ int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t
queue_size,
void vhost_dev_virtqueue_stop(struct vhost_dev *hdev, VirtIODevice *vdev,
int idx);
+int vhost_dev_virtqueue_restart(struct vhost_dev *hdev, VirtIODevice *vdev,
+ int idx);
#endif
--
2.32.0
- Re: [PATCH v2 07/24] virtio-pci: support queue enable, (continued)
[PATCH v2 04/24] virtio: introduce virtio_queue_enable(), Kangjie Xu, 2022/08/15
[PATCH v2 09/24] vhost: introduce vhost_dev_virtqueue_stop(), Kangjie Xu, 2022/08/15
[PATCH v2 10/24] vhost: introduce vhost_dev_virtqueue_restart(),
Kangjie Xu <=
[PATCH v2 11/24] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_stop(), Kangjie Xu, 2022/08/15
[PATCH v2 14/24] vhost-user: introduce vhost_reset_vring() interface, Kangjie Xu, 2022/08/15