Commit b13d3962 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Michael S. Tsirkin
Browse files

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: default avatarStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 4ddcc2d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ 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->ioeventfd_started) {
    if (!k->set_guest_notifiers || !k->ioeventfd_assign) {
        error_setg(errp,
                   "device is incompatible with dataplane "
                   "(transport does not support notifiers)");
+0 −21
Original line number Diff line number Diff line
@@ -59,25 +59,6 @@ static void virtio_ccw_stop_ioeventfd(VirtioCcwDevice *dev)
    virtio_bus_stop_ioeventfd(&dev->bus);
}

static bool virtio_ccw_ioeventfd_started(DeviceState *d)
{
    VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);

    return dev->ioeventfd_started;
}

static void virtio_ccw_ioeventfd_set_started(DeviceState *d, bool started,
                                             bool err)
{
    VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);

    dev->ioeventfd_started = started;
    if (err) {
        /* Disable ioeventfd for this device. */
        dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD;
    }
}

static bool virtio_ccw_ioeventfd_disabled(DeviceState *d)
{
    VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
@@ -1608,8 +1589,6 @@ static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data)
    k->pre_plugged = virtio_ccw_pre_plugged;
    k->device_plugged = virtio_ccw_device_plugged;
    k->device_unplugged = virtio_ccw_device_unplugged;
    k->ioeventfd_started = virtio_ccw_ioeventfd_started;
    k->ioeventfd_set_started = virtio_ccw_ioeventfd_set_started;
    k->ioeventfd_disabled = virtio_ccw_ioeventfd_disabled;
    k->ioeventfd_assign = virtio_ccw_ioeventfd_assign;
}
+0 −1
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@ struct VirtioCcwDevice {
    int revision;
    uint32_t max_rev;
    VirtioBusState bus;
    bool ioeventfd_started;
    uint32_t flags;
    uint8_t thinint_isc;
    AdapterRoutes routes;
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ void virtio_scsi_set_iothread(VirtIOSCSI *s, IOThread *iothread)
    s->ctx = iothread_get_aio_context(vs->conf.iothread);

    /* Don't try if transport does not support notifiers. */
    if (!k->set_guest_notifiers || !k->ioeventfd_started) {
    if (!k->set_guest_notifiers || !k->ioeventfd_assign) {
        fprintf(stderr, "virtio-scsi: Failed to set iothread "
                   "(transport does not support notifiers)");
        exit(1);
+1 −1
Original line number Diff line number Diff line
@@ -1190,7 +1190,7 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
    int i, r, e;

    if (!k->ioeventfd_started) {
    if (!k->ioeventfd_assign) {
        error_report("binding does not support host notifiers");
        r = -ENOSYS;
        goto fail;
Loading