[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 03/14] virtio-bus: introduce queue_enabled method
From: |
Cindy Lu |
Subject: |
[PATCH v4 03/14] virtio-bus: introduce queue_enabled method |
Date: |
Wed, 1 Jul 2020 22:55:27 +0800 |
From: Jason Wang <jasowang@redhat.com>
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>
---
hw/virtio/virtio.c | 6 ++++++
include/hw/virtio/virtio-bus.h | 4 ++++
2 files changed, 10 insertions(+)
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;
}
diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h
index 38c9399cd4..0f6f215925 100644
--- a/include/hw/virtio/virtio-bus.h
+++ b/include/hw/virtio/virtio-bus.h
@@ -83,6 +83,10 @@ typedef struct VirtioBusClass {
*/
int (*ioeventfd_assign)(DeviceState *d, EventNotifier *notifier,
int n, bool assign);
+ /*
+ * Whether queue number n is enabled.
+ */
+ bool (*queue_enabled)(DeviceState *d, int n);
/*
* Does the transport have variable vring alignment?
* (ie can it ever call virtio_queue_set_align()?)
--
2.21.1
- [PATCH v4 00/14]vDPA support in qemu, Cindy Lu, 2020/07/01
- [PATCH v4 01/14] net: introduce qemu_get_peer, Cindy Lu, 2020/07/01
- [PATCH v4 02/14] vhost_net: use the function qemu_get_peer, Cindy Lu, 2020/07/01
- [PATCH v4 03/14] virtio-bus: introduce queue_enabled method,
Cindy Lu <=
- [PATCH v4 04/14] virtio-pci: implement queue_enabled method, Cindy Lu, 2020/07/01
- [PATCH v4 05/14] vhost: check the existence of vhost_set_iotlb_callback, Cindy Lu, 2020/07/01
- [PATCH v4 06/14] vhost: introduce new VhostOps vhost_dev_start, Cindy Lu, 2020/07/01
- [PATCH v4 07/14] vhost: implement vhost_dev_start method, Cindy Lu, 2020/07/01
- [PATCH v4 08/14] vhost: introduce new VhostOps vhost_vq_get_addr, Cindy Lu, 2020/07/01
- [PATCH v4 09/14] vhost: implement vhost_vq_get_addr method, Cindy Lu, 2020/07/01
- [PATCH v4 10/14] vhost: introduce new VhostOps vhost_force_iommu, Cindy Lu, 2020/07/01
- [PATCH v4 11/14] vhost: implement vhost_force_iommu method, Cindy Lu, 2020/07/01
- [PATCH v4 12/14] vhost_net: introduce set_config & get_config, Cindy Lu, 2020/07/01
- [PATCH v4 14/14] vhost-vdpa: introduce vhost-vdpa net client, Cindy Lu, 2020/07/01