@@ -28,10 +28,14 @@ typedef struct SVQElement {
bool not_from_guest;
} SVQElement;
+typedef struct VhostShadowVirtqueue VhostShadowVirtqueue;
+typedef int (*ShadowVirtQueueStart)(VhostShadowVirtqueue *svq,
+ struct vhost_dev *dev);
typedef void (*VirtQueueElementCallback)(VirtIODevice *vdev,
const VirtQueueElement *elem);
typedef struct VhostShadowVirtqueueOps {
+ ShadowVirtQueueStart start;
VirtQueueElementCallback used_elem_handler;
} VhostShadowVirtqueueOps;
@@ -1141,6 +1141,20 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started)
if (unlikely(r)) {
return r;
}
+
+ if (v->shadow_vqs_enabled) {
+ for (unsigned i = 0; i < v->shadow_vqs->len; ++i) {
+ VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs,
+ i);
+ if (svq->ops && svq->ops->start) {
+ r = svq->ops->start(svq, dev);
+ if (unlikely(r)) {
+ return r;
+ }
+ }
+ }
+ }
+
vhost_vdpa_set_vring_ready(dev);
} else {
vhost_vdpa_reset_device(dev);
It allows to run commands at SVQ start. Signed-off-by: Eugenio PĂ©rez <eperezma@redhat.com> --- hw/virtio/vhost-shadow-virtqueue.h | 4 ++++ hw/virtio/vhost-vdpa.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+)