Patchwork [2/2] virtio-s390: reset all qbuses too when writing to the status field

login
register
mail settings
Submitter Paolo Bonzini
Date Dec. 12, 2012, 2:26 p.m.
Message ID <1355322396-32026-3-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/205540/
State New
Headers show

Comments

Paolo Bonzini - Dec. 12, 2012, 2:26 p.m.
virtio-s390 devices do not perform a full reset when zero is written
to the status field.  The reset does not propagate down the qdev bus
hierarchy.  Because of this, a virtio reset does not cancel in-flight
I/O for virtio-scsi.

Reported-by: Bryan Venteicher <bryanv@daemoninthecloset.org>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/s390-virtio-bus.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch

diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
index e0ac2d1..91d5a3a 100644
--- a/hw/s390-virtio-bus.c
+++ b/hw/s390-virtio-bus.c
@@ -309,8 +309,14 @@  void s390_virtio_device_update_status(VirtIOS390Device *dev)
 {
     VirtIODevice *vdev = dev->vdev;
     uint32_t features;
+    unsigned char status;
 
-    virtio_set_status(vdev, ldub_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS));
+    status = ldub_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS);
+    if (status == 0) {
+        qdev_reset_all((DeviceState *)dev);
+    }
+
+    virtio_set_status(vdev, status);
 
     /* Update guest supported feature bitmap */