diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-01-24 19:24:26 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-01-24 19:24:26 +0000 |
commit | 834a336eb911db8a8ca00e760ee6a85faca19414 (patch) | |
tree | 164006825d183ae89b986b9f3585cc3b404a1ae4 /hw | |
parent | 82de978a8b01c37e57a4782012b88ce89e0fa4f6 (diff) | |
parent | e044c0f8dd028ea296396ad8066ba436e9acf350 (diff) |
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
virtio: quick fix
Fixes a regression in virtio that's causing issues
for many people.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Wed 24 Jan 2018 17:20:24 GMT
# gpg: using RSA key 0x281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg: aka "Michael S. Tsirkin <mst@redhat.com>"
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67
# Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469
* remotes/mst/tags/for_upstream:
Revert "qemu: add a cleanup callback function to EventNotifier"
Revert "virtio: postpone the execution of event_notifier_cleanup function"
Revert "virtio: improve virtio devices initialization time"
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/virtio/virtio-bus.c | 19 | ||||
-rw-r--r-- | hw/virtio/virtio.c | 5 |
2 files changed, 8 insertions, 16 deletions
diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index 8106346927..3042232daf 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -256,15 +256,6 @@ bool virtio_bus_ioeventfd_enabled(VirtioBusState *bus) return k->ioeventfd_assign && k->ioeventfd_enabled(proxy); } -static void virtio_bus_cleanup_event_notifier(EventNotifier *notifier) -{ - /* Test and clear notifier after disabling event, - * in case poll callback didn't have time to run. - */ - virtio_queue_host_notifier_read(notifier); - event_notifier_cleanup(notifier); -} - /* * This function switches ioeventfd on/off in the device. * The caller must set or clear the handlers for the EventNotifier. @@ -292,13 +283,19 @@ int virtio_bus_set_host_notifier(VirtioBusState *bus, int n, bool assign) r = k->ioeventfd_assign(proxy, notifier, n, true); if (r < 0) { error_report("%s: unable to assign ioeventfd: %d", __func__, r); - virtio_bus_cleanup_event_notifier(notifier); + goto cleanup_event_notifier; } + return 0; } else { - notifier->cleanup = virtio_bus_cleanup_event_notifier; k->ioeventfd_assign(proxy, notifier, n, false); } +cleanup_event_notifier: + /* Test and clear notifier after disabling event, + * in case poll callback didn't have time to run. + */ + virtio_queue_host_notifier_read(notifier); + event_notifier_cleanup(notifier); return r; } diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 3ac3491bee..d6002ee550 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2574,7 +2574,6 @@ static int virtio_device_start_ioeventfd_impl(VirtIODevice *vdev) VirtioBusState *qbus = VIRTIO_BUS(qdev_get_parent_bus(DEVICE(vdev))); int n, r, err; - memory_region_transaction_begin(); for (n = 0; n < VIRTIO_QUEUE_MAX; n++) { VirtQueue *vq = &vdev->vq[n]; if (!virtio_queue_get_num(vdev, n)) { @@ -2597,7 +2596,6 @@ static int virtio_device_start_ioeventfd_impl(VirtIODevice *vdev) } event_notifier_set(&vq->host_notifier); } - memory_region_transaction_commit(); return 0; assign_error: @@ -2611,7 +2609,6 @@ assign_error: r = virtio_bus_set_host_notifier(qbus, n, false); assert(r >= 0); } - memory_region_transaction_commit(); return err; } @@ -2628,7 +2625,6 @@ static void virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev) VirtioBusState *qbus = VIRTIO_BUS(qdev_get_parent_bus(DEVICE(vdev))); int n, r; - memory_region_transaction_begin(); for (n = 0; n < VIRTIO_QUEUE_MAX; n++) { VirtQueue *vq = &vdev->vq[n]; @@ -2639,7 +2635,6 @@ static void virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev) r = virtio_bus_set_host_notifier(qbus, n, false); assert(r >= 0); } - memory_region_transaction_commit(); } void virtio_device_stop_ioeventfd(VirtIODevice *vdev) |