Message ID | 20200529140620.28759-4-lulu@redhat.com |
---|---|
State | New |
Headers | show |
Series | vDPA support in qemu | expand |
On 29/05/2020 16:06, Cindy Lu wrote: > 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> Cindy, you must add your signed-off-by on all the patch you send, after all the existing S-o-b. > > 0005-virtio-bus-introduce-queue_enabled-method.patch bad cut&paste? Thanks, Laurent
On Tue, Jun 16, 2020 at 3:50 PM Laurent Vivier <lvivier@redhat.com> wrote: > > On 29/05/2020 16:06, Cindy Lu wrote: > > 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> > > Cindy, you must add your signed-off-by on all the patch you send, after > all the existing S-o-b. > sure will fix this > > > > 0005-virtio-bus-introduce-queue_enabled-method.patch > will remove this part > bad cut&paste? > > Thanks, > Laurent >
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index b6c8ef5bc0..445a4ed760 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3285,6 +3285,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()?)