Signed-off-by: Eugenio Pérez <epere...@redhat.com> --- include/hw/virtio/virtio.h | 2 ++ hw/virtio/virtio.c | 5 +++++ 2 files changed, 7 insertions(+)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 9988c6d5c9..9013c03424 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -399,6 +399,8 @@ static inline bool virtio_device_disabled(VirtIODevice *vdev) return unlikely(vdev->disabled || vdev->broken); } +unsigned virtio_queue_get_idx(const VirtIODevice *vdev, const VirtQueue *vq); + bool virtio_legacy_allowed(VirtIODevice *vdev); bool virtio_legacy_check_disabled(VirtIODevice *vdev); diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index ebb780fb42..3d14b0ef74 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -500,6 +500,11 @@ void virtio_queue_set_notification(VirtQueue *vq, int enable) } } +unsigned virtio_queue_get_idx(const VirtIODevice *vdev, const VirtQueue *vq) +{ + return vq - vdev->vq; +} + int virtio_queue_ready(VirtQueue *vq) { return vq->vring.avail != 0; -- 2.27.0