aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2020-07-01 22:55:27 +0800
committerMichael S. Tsirkin <mst@redhat.com>2020-07-03 07:57:04 -0400
commitb2a5f62a2284a8933f6f6cda48797b7263b96970 (patch)
tree91f7c200775f4c44672db6d9d1a184910bfe7722 /hw/virtio
parent92fbc3e07eb924bd5e03d22764e637b2e02e46bd (diff)
virtio-bus: introduce queue_enabled method
This patch introduces queue_enabled() method which allows the transport to implement its own way to report whether or not a queue is enabled. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Cindy Lu <lulu@redhat.com> Message-Id: <20200701145538.22333-4-lulu@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/virtio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index cc9c9dc162..5bd2a2f621 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3286,6 +3286,12 @@ hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n)
bool virtio_queue_enabled(VirtIODevice *vdev, int n)
{
+ BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
+ VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+
+ if (k->queue_enabled) {
+ return k->queue_enabled(qbus->parent, n);
+ }
return virtio_queue_get_desc_addr(vdev, n) != 0;
}