On Thu, 20 Oct 2016 18:53:31 +0200 Paolo Bonzini <pbonz...@redhat.com> wrote:
> No, it's because virtio-mmio can be created without a device > underneath. virtio_bus_start_ioeventfd in that case is wrong, but > virtio_bus_stop_ioeventfd should be a no-op. The fix is trivial: I tend to forget this virtio-mmio speciality... > > diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c > index 0479704..bf61f66 100644 > --- a/hw/virtio/virtio-bus.c > +++ b/hw/virtio/virtio-bus.c > @@ -172,12 +172,15 @@ int virtio_bus_start_ioeventfd(VirtioBusState *bus) > > void virtio_bus_stop_ioeventfd(VirtioBusState *bus) > { > - VirtIODevice *vdev = virtio_bus_get_device(bus); > - VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev); > + VirtIODevice *vdev; > + VirtioDeviceClass *vdc; > > if (!bus->ioeventfd_started) { > return; > } > + > + vdev = virtio_bus_get_device(bus); > + vdc = VIRTIO_DEVICE_GET_CLASS(vdev); > vdc->stop_ioeventfd(vdev); > bus->ioeventfd_started = false; > } Looks sane, and make check passes with this applied.