From 6019f3b966d5764fd655b57887599e5e2d544f73 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 21 Oct 2016 22:48:12 +0200 Subject: virtio: remove set_handler argument from set_host_notifier_internal Make virtio_device_start_ioeventfd_impl use the same logic as dataplane to set up the host notifier. This removes the need for the set_handler argument in set_host_notifier_internal. This is a first step towards using virtio_bus_set_host_notifier as the sole entry point to set up ioeventfds. At least now the functions have the same interface, but they still differ in that virtio_bus_set_host_notifier sets ioeventfd_disabled. Reviewed-by: Stefan Hajnoczi Reviewed-by: Cornelia Huck Signed-off-by: Paolo Bonzini Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'hw/virtio/virtio.c') diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5221abaee4..2ece690c56 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2152,11 +2152,21 @@ static int virtio_device_start_ioeventfd_impl(VirtIODevice *vdev) if (!virtio_queue_get_num(vdev, n)) { continue; } - r = set_host_notifier_internal(proxy, qbus, n, true, true); + r = set_host_notifier_internal(proxy, qbus, n, true); if (r < 0) { err = r; goto assign_error; } + virtio_queue_set_host_notifier_fd_handler(&vdev->vq[n], true, true); + } + + for (n = 0; n < VIRTIO_QUEUE_MAX; n++) { + /* Kick right away to begin processing requests already in vring */ + VirtQueue *vq = &vdev->vq[n]; + if (!vq->vring.num) { + continue; + } + event_notifier_set(&vq->host_notifier); } return 0; @@ -2166,7 +2176,7 @@ assign_error: continue; } - r = set_host_notifier_internal(proxy, qbus, n, false, false); + r = set_host_notifier_internal(proxy, qbus, n, false); assert(r >= 0); } return err; @@ -2190,7 +2200,7 @@ static void virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev) if (!virtio_queue_get_num(vdev, n)) { continue; } - r = set_host_notifier_internal(proxy, qbus, n, false, false); + r = set_host_notifier_internal(proxy, qbus, n, false); assert(r >= 0); } } -- cgit v1.2.3