summaryrefslogtreecommitdiff
path: root/hw/virtio/virtio-bus.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-10-21 22:48:08 +0200
committerMichael S. Tsirkin <mst@redhat.com>2016-10-30 19:51:32 +0200
commit8e93cef14e6f32adf6914b30b096039e6264f0e3 (patch)
treeabf77c2c554b5efcda21167689f61c9e04f4a0b2 /hw/virtio/virtio-bus.c
parentff4c07df67f098234d9e49850435ccb49b8cbbdc (diff)
downloadqemu-8e93cef14e6f32adf6914b30b096039e6264f0e3.tar.gz
virtio: introduce virtio_device_ioeventfd_enabled
This will be used to forbid iothread configuration when the proxy does not allow using ioeventfd. To simplify the implementation, change the direction of the ioeventfd_disabled callback too. 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.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
index a8d2bd89c5..3ffec66d59 100644
--- a/hw/virtio/virtio-bus.c
+++ b/hw/virtio/virtio-bus.c
@@ -193,7 +193,7 @@ int virtio_bus_start_ioeventfd(VirtioBusState *bus)
VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
int r;
- if (!k->ioeventfd_assign || k->ioeventfd_disabled(proxy)) {
+ if (!k->ioeventfd_assign || !k->ioeventfd_enabled(proxy)) {
return -ENOSYS;
}
if (bus->ioeventfd_started || bus->ioeventfd_disabled) {
@@ -223,6 +223,14 @@ void virtio_bus_stop_ioeventfd(VirtioBusState *bus)
bus->ioeventfd_started = false;
}
+bool virtio_bus_ioeventfd_enabled(VirtioBusState *bus)
+{
+ VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(bus);
+ DeviceState *proxy = DEVICE(BUS(bus)->parent);
+
+ return k->ioeventfd_assign && k->ioeventfd_enabled(proxy);
+}
+
/*
* This function switches from/to the generic ioeventfd handler.
* assign==false means 'use generic ioeventfd handler'.