diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-10-21 22:48:06 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-10-30 19:51:32 +0200 |
commit | b13d39622703ae7449f769c14da7a90f20f2c25c (patch) | |
tree | 1b1598e226b141372692c7d24efb95b965313bf6 /hw/virtio/virtio-bus.c | |
parent | 4ddcc2d5cb8f14d43a4ed31beaad982557a418fd (diff) | |
download | qemu-b13d39622703ae7449f769c14da7a90f20f2c25c.zip |
virtio: move ioeventfd_started flag to VirtioBusState
This simplifies the code and removes the ioeventfd_started
and ioeventfd_set_started callback. The only difference is
in how virtio-ccw handles an error---it doesn't disable
ioeventfd forever anymore. It was the only backend to do
so, and if desired this behavior should be implemented in
virtio-bus.c.
Instead of ioeventfd_started, the ioeventfd_assign callback now
determines whether the virtio bus supports host notifiers.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/virtio-bus.c')
-rw-r--r-- | hw/virtio/virtio-bus.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index 3607c29585..97cdb11de7 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -192,10 +192,10 @@ void virtio_bus_start_ioeventfd(VirtioBusState *bus) VirtIODevice *vdev; int n, r; - if (!k->ioeventfd_started || k->ioeventfd_started(proxy)) { + if (!k->ioeventfd_assign || k->ioeventfd_disabled(proxy)) { return; } - if (bus->ioeventfd_disabled || k->ioeventfd_disabled(proxy)) { + if (bus->ioeventfd_started || bus->ioeventfd_disabled) { return; } vdev = virtio_bus_get_device(bus); @@ -208,7 +208,7 @@ void virtio_bus_start_ioeventfd(VirtioBusState *bus) goto assign_error; } } - k->ioeventfd_set_started(proxy, true, false); + bus->ioeventfd_started = true; return; assign_error: @@ -220,18 +220,16 @@ assign_error: r = set_host_notifier_internal(proxy, bus, n, false, false); assert(r >= 0); } - k->ioeventfd_set_started(proxy, false, true); error_report("%s: failed. Fallback to userspace (slower).", __func__); } void virtio_bus_stop_ioeventfd(VirtioBusState *bus) { - VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(bus); DeviceState *proxy = DEVICE(BUS(bus)->parent); VirtIODevice *vdev; int n, r; - if (!k->ioeventfd_started || !k->ioeventfd_started(proxy)) { + if (!bus->ioeventfd_started) { return; } vdev = virtio_bus_get_device(bus); @@ -242,7 +240,7 @@ void virtio_bus_stop_ioeventfd(VirtioBusState *bus) r = set_host_notifier_internal(proxy, bus, n, false, false); assert(r >= 0); } - k->ioeventfd_set_started(proxy, false, false); + bus->ioeventfd_started = false; } /* @@ -254,7 +252,7 @@ int virtio_bus_set_host_notifier(VirtioBusState *bus, int n, bool assign) VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(bus); DeviceState *proxy = DEVICE(BUS(bus)->parent); - if (!k->ioeventfd_started) { + if (!k->ioeventfd_assign) { return -ENOSYS; } bus->ioeventfd_disabled = assign; |