diff options
author | Cornelia Huck | 2016-06-10 11:04:10 +0200 |
---|---|---|
committer | Michael S. Tsirkin | 2016-06-24 07:47:35 +0200 |
commit | b1f0a33d808fc3eb27faa93b7e032eb70c58802f (patch) | |
tree | b1cbf0774b08727ebbcde843750901410ab8179e /hw/block/dataplane | |
parent | virtio-bus: common ioeventfd infrastructure (diff) | |
download | qemu-b1f0a33d808fc3eb27faa93b7e032eb70c58802f.tar.gz qemu-b1f0a33d808fc3eb27faa93b7e032eb70c58802f.tar.xz qemu-b1f0a33d808fc3eb27faa93b7e032eb70c58802f.zip |
virtio-bus: have callers tolerate new host notifier api
Have vhost and dataplane use the new api for transports that
have been converted.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/block/dataplane')
-rw-r--r-- | hw/block/dataplane/virtio-blk.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 2073f9a270..fdf5fd1190 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -79,7 +79,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf, } /* Don't try if transport does not support notifiers. */ - if (!k->set_guest_notifiers || !k->set_host_notifier) { + if (!k->set_guest_notifiers || + (!k->set_host_notifier && !k->ioeventfd_started)) { error_setg(errp, "device is incompatible with dataplane " "(transport does not support notifiers)"); @@ -157,7 +158,10 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) s->guest_notifier = virtio_queue_get_guest_notifier(s->vq); /* Set up virtqueue notify */ - r = k->set_host_notifier(qbus->parent, 0, true); + r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), 0, true); + if (r == -ENOSYS) { + r = k->set_host_notifier(qbus->parent, 0, true); + } if (r != 0) { fprintf(stderr, "virtio-blk failed to set host notifier (%d)\n", r); goto fail_host_notifier; @@ -193,6 +197,7 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); + int r; if (!vblk->dataplane_started || s->stopping) { return; @@ -217,7 +222,10 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) aio_context_release(s->ctx); - k->set_host_notifier(qbus->parent, 0, false); + r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), 0, false); + if (r == -ENOSYS) { + k->set_host_notifier(qbus->parent, 0, false); + } /* Clean up guest notifier (irq) */ k->set_guest_notifiers(qbus->parent, 1, false); |