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