<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 28df1417d3ff982298b9068327d3a908d3974249 Mon Sep 17 00:00:00 2001
From: "Michael S. Tsirkin" &lt;mst@redhat.com&gt;
Date: Mon, 16 Nov 2015 14:33:22 +0100
Subject: [PATCH 38/44] vhost: send SET_VRING_ENABLE at start/stop
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Message-id: &lt;1447684235-15638-32-git-send-email-mst@redhat.com&gt;
Patchwork-id: 68375
O-Subject: [PATCH RHEV 7.3/7.2.z v2 31/36] vhost: send SET_VRING_ENABLE at start/stop
Bugzilla: 1279388
RH-Acked-by: Xiao Wang &lt;jasowang@redhat.com&gt;
RH-Acked-by: Victor Kaplansky &lt;vkaplans@redhat.com&gt;
RH-Acked-by: Marcel Apfelbaum &lt;marcel@redhat.com&gt;
RH-Acked-by: Marc-AndrÃ© Lureau &lt;mlureau@redhat.com&gt;

From: Yuanhan Liu &lt;yuanhan.liu@linux.intel.com&gt;

Send SET_VRING_ENABLE at start/stop, to give the backend
an explicit sign of our state.

Signed-off-by: Yuanhan Liu &lt;yuanhan.liu@linux.intel.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
(cherry-picked from commit 3a12f32229a046f4d4ab0a3a52fb01d2d5a1ab76)

Signed-off-by: Miroslav Rezanina &lt;mrezanin@redhat.com&gt;
---
 hw/virtio/vhost.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 200ec45..7cfb2e0 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1194,6 +1194,11 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
         }
     }
 
+    if (hdev-&gt;vhost_ops-&gt;vhost_backend_set_vring_enable) {
+        /* only enable first vq pair by default */
+        hdev-&gt;vhost_ops-&gt;vhost_backend_set_vring_enable(hdev, hdev-&gt;vq_index == 0);
+    }
+
     return 0;
 fail_log:
     if (hdev-&gt;log_size) {
@@ -1226,6 +1231,10 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
                              hdev-&gt;vq_index + i);
     }
 
+    if (hdev-&gt;vhost_ops-&gt;vhost_backend_set_vring_enable) {
+        hdev-&gt;vhost_ops-&gt;vhost_backend_set_vring_enable(hdev, 0);
+    }
+
     vhost_log_put(hdev, true);
     hdev-&gt;started = false;
     hdev-&gt;log = NULL;
-- 
1.8.3.1

</pre></body></html>