提交 b2a5f62a 编写于 作者: J Jason Wang 提交者: Michael S. Tsirkin

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: NJason Wang <jasowang@redhat.com>
Signed-off-by: NCindy Lu <lulu@redhat.com>
Message-Id: <20200701145538.22333-4-lulu@redhat.com>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Acked-by: NJason Wang <jasowang@redhat.com>
上级 92fbc3e0
...@@ -3286,6 +3286,12 @@ hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n) ...@@ -3286,6 +3286,12 @@ hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n)
bool virtio_queue_enabled(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; return virtio_queue_get_desc_addr(vdev, n) != 0;
} }
......
...@@ -83,6 +83,10 @@ typedef struct VirtioBusClass { ...@@ -83,6 +83,10 @@ typedef struct VirtioBusClass {
*/ */
int (*ioeventfd_assign)(DeviceState *d, EventNotifier *notifier, int (*ioeventfd_assign)(DeviceState *d, EventNotifier *notifier,
int n, bool assign); int n, bool assign);
/*
* Whether queue number n is enabled.
*/
bool (*queue_enabled)(DeviceState *d, int n);
/* /*
* Does the transport have variable vring alignment? * Does the transport have variable vring alignment?
* (ie can it ever call virtio_queue_set_align()?) * (ie can it ever call virtio_queue_set_align()?)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册