Split out vq reset operation in its own function, as it may be called with ring reset.
Signed-off-by: Eugenio Pérez <epere...@redhat.com> --- hw/virtio/vhost-vdpa.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 6ae276ccde..df2515a247 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -547,6 +547,21 @@ int vhost_vdpa_set_vring_ready(struct vhost_vdpa *v, unsigned idx) return vhost_vdpa_set_vring_ready_internal(v, idx, true); } +/* TODO: Properly reorder static functions */ +static void vhost_vdpa_svq_stop(struct vhost_dev *dev, unsigned idx); +static void vhost_vdpa_reset_queue(struct vhost_dev *dev, int idx) +{ + struct vhost_vdpa *v = dev->opaque; + + if (dev->features & VIRTIO_F_RING_RESET) { + vhost_vdpa_set_vring_ready_internal(v, idx, false); + } + + if (v->shadow_vqs_enabled) { + vhost_vdpa_svq_stop(dev, idx - dev->vq_index); + } +} + /* * The use of this function is for requests that only need to be * applied once. Typically such request occurs at the beginning @@ -1543,4 +1558,5 @@ const VhostOps vdpa_ops = { .vhost_force_iommu = vhost_vdpa_force_iommu, .vhost_set_config_call = vhost_vdpa_set_config_call, .vhost_reset_status = vhost_vdpa_reset_status, + .vhost_reset_queue = vhost_vdpa_reset_queue, }; -- 2.39.3