29b115
From fdbf66e4c70de16ab36d70ea591322b1b24df591 Mon Sep 17 00:00:00 2001
29b115
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
29b115
Date: Thu, 21 Jul 2022 15:38:55 +0200
29b115
Subject: [PATCH 11/32] vhost: Reorder vhost_svq_kick
29b115
MIME-Version: 1.0
29b115
Content-Type: text/plain; charset=UTF-8
29b115
Content-Transfer-Encoding: 8bit
29b115
29b115
RH-Author: Eugenio Pérez <eperezma@redhat.com>
29b115
RH-MergeRequest: 108: Net Control Virtqueue shadow Support
29b115
RH-Commit: [11/27] 1d08b97eb3960a0f85f2dd48c3331b803f7ea205 (eperezmartin/qemu-kvm)
29b115
RH-Bugzilla: 1939363
29b115
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
29b115
RH-Acked-by: Cindy Lu <lulu@redhat.com>
29b115
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
29b115
29b115
Bugzilla: https://bugzilla.redhat.com/1939363
29b115
29b115
Upstream Status: git://git.qemu.org/qemu.git
29b115
29b115
commit d93a2405ca6efa9dc1c420cee5a34bd8242818d0
29b115
Author: Eugenio Pérez <eperezma@redhat.com>
29b115
Date:   Wed Jul 20 08:59:30 2022 +0200
29b115
29b115
    vhost: Reorder vhost_svq_kick
29b115
29b115
    Future code needs to call it from vhost_svq_add.
29b115
29b115
    No functional change intended.
29b115
29b115
    Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
29b115
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
29b115
    Signed-off-by: Jason Wang <jasowang@redhat.com>
29b115
29b115
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
29b115
---
29b115
 hw/virtio/vhost-shadow-virtqueue.c | 28 ++++++++++++++--------------
29b115
 1 file changed, 14 insertions(+), 14 deletions(-)
29b115
29b115
diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c
29b115
index 9c46c3a8fa..05cd39d1eb 100644
29b115
--- a/hw/virtio/vhost-shadow-virtqueue.c
29b115
+++ b/hw/virtio/vhost-shadow-virtqueue.c
29b115
@@ -215,6 +215,20 @@ static bool vhost_svq_add_split(VhostShadowVirtqueue *svq,
29b115
     return true;
29b115
 }
29b115
 
29b115
+static void vhost_svq_kick(VhostShadowVirtqueue *svq)
29b115
+{
29b115
+    /*
29b115
+     * We need to expose the available array entries before checking the used
29b115
+     * flags
29b115
+     */
29b115
+    smp_mb();
29b115
+    if (svq->vring.used->flags & VRING_USED_F_NO_NOTIFY) {
29b115
+        return;
29b115
+    }
29b115
+
29b115
+    event_notifier_set(&svq->hdev_kick);
29b115
+}
29b115
+
29b115
 /**
29b115
  * Add an element to a SVQ.
29b115
  *
29b115
@@ -235,20 +249,6 @@ static bool vhost_svq_add(VhostShadowVirtqueue *svq, VirtQueueElement *elem)
29b115
     return true;
29b115
 }
29b115
 
29b115
-static void vhost_svq_kick(VhostShadowVirtqueue *svq)
29b115
-{
29b115
-    /*
29b115
-     * We need to expose the available array entries before checking the used
29b115
-     * flags
29b115
-     */
29b115
-    smp_mb();
29b115
-    if (svq->vring.used->flags & VRING_USED_F_NO_NOTIFY) {
29b115
-        return;
29b115
-    }
29b115
-
29b115
-    event_notifier_set(&svq->hdev_kick);
29b115
-}
29b115
-
29b115
 /**
29b115
  * Forward available buffers.
29b115
  *
29b115
-- 
29b115
2.31.1
29b115