qemu-devel
[Top][All Lists]
Advanced

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

[RFC PATCH 8/9] vhost: Add vhost_svq_start_op


From: Eugenio Pérez
Subject: [RFC PATCH 8/9] vhost: Add vhost_svq_start_op
Date: Mon, 14 Feb 2022 20:16:34 +0100

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 hw/virtio/vhost-shadow-virtqueue.h | 4 +++-
 hw/virtio/vhost-shadow-virtqueue.c | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-shadow-virtqueue.h 
b/hw/virtio/vhost-shadow-virtqueue.h
index 767b0a82ba..8f2377bbc4 100644
--- a/hw/virtio/vhost-shadow-virtqueue.h
+++ b/hw/virtio/vhost-shadow-virtqueue.h
@@ -15,11 +15,13 @@
 #include "hw/virtio/vhost-iova-tree.h"
 
 typedef struct VhostShadowVirtqueue VhostShadowVirtqueue;
-
+typedef bool (*vhost_svq_start_op)(VhostShadowVirtqueue *svq,
+                                   VirtIODevice *vdev);
 typedef void (*VirtQueueElementCallback)(VirtIODevice *vdev,
                                          const VirtQueueElement *elem);
 
 typedef struct VhostShadowVirtqueueOps {
+    vhost_svq_start_op start;
     VirtQueueElementCallback used_elem_handler;
 } VhostShadowVirtqueueOps;
 
diff --git a/hw/virtio/vhost-shadow-virtqueue.c 
b/hw/virtio/vhost-shadow-virtqueue.c
index 26938b059c..18cdb35ea3 100644
--- a/hw/virtio/vhost-shadow-virtqueue.c
+++ b/hw/virtio/vhost-shadow-virtqueue.c
@@ -783,6 +783,10 @@ void vhost_svq_start(VhostShadowVirtqueue *svq, 
VirtIODevice *vdev,
     for (unsigned i = 0; i < svq->vring.num - 1; i++) {
         svq->vring.desc[i].next = cpu_to_le16(i + 1);
     }
+
+    if (svq->ops && svq->ops->start) {
+        svq->ops->start(svq, vdev);
+    }
 }
 
 /**
-- 
2.27.0




reply via email to

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