qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 17/24] vhost: vhost-user: update vhost_dev_virtqueue_restart()


From: Kangjie Xu
Subject: [PATCH v2 17/24] vhost: vhost-user: update vhost_dev_virtqueue_restart()
Date: Tue, 16 Aug 2022 09:06:29 +0800

Update vhost_dev_virtqueue_restart() for vhost-user scenario.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
 hw/virtio/vhost.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index a0d6824353..bd90cfe13a 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1937,11 +1937,29 @@ int vhost_dev_virtqueue_restart(struct vhost_dev *hdev, 
VirtIODevice *vdev,
                                 int idx)
 {
     const VhostOps *vhost_ops = hdev->vhost_ops;
+    int r;
 
     assert(vhost_ops);
 
-    return vhost_virtqueue_start(hdev,
-                                 vdev,
-                                 hdev->vqs + idx,
-                                 hdev->vq_index + idx);
+    r = vhost_virtqueue_start(hdev,
+                              vdev,
+                              hdev->vqs + idx,
+                              hdev->vq_index + idx);
+    if (r < 0) {
+        goto err_start;
+    }
+
+    if (vhost_ops->vhost_set_single_vring_enable) {
+        r = vhost_ops->vhost_set_single_vring_enable(hdev,
+                                                     hdev->vq_index + idx,
+                                                     1);
+        if (r < 0) {
+            goto err_start;
+        }
+    }
+
+    return 0;
+
+err_start:
+    return r;
 }
-- 
2.32.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]