Update vhost_dev_virtqueue_restart() for vhost-user scenario. Signed-off-by: Kangjie Xu <kangjie...@linux.alibaba.com> Signed-off-by: Xuan Zhuo <xuanz...@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