diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2015-06-04 12:34:15 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-06-10 18:15:04 +0200 |
commit | 0b352fd680e1ca7827ddea47b5e9b603320913b6 (patch) | |
tree | 2bceeeada8b354bac0e3be5de94fe5d07783d1d4 /hw/s390x/virtio-ccw.c | |
parent | 6c0196d702e8482a17638ee79f45ce27cdd1ef5d (diff) |
virtio: allow to fail setting status
virtio-1 allow setting of the FEATURES_OK status bit to fail if
the negotiated feature bits are inconsistent: let's fail
virtio_set_status() in that case and update virtio-ccw to post an
error to the guest.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/s390x/virtio-ccw.c')
-rw-r--r-- | hw/s390x/virtio-ccw.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index ef90feddea..3ef0055126 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -497,15 +497,19 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) if (!(status & VIRTIO_CONFIG_S_DRIVER_OK)) { virtio_ccw_stop_ioeventfd(dev); } - virtio_set_status(vdev, status); - if (vdev->status == 0) { - virtio_reset(vdev); - } - if (status & VIRTIO_CONFIG_S_DRIVER_OK) { - virtio_ccw_start_ioeventfd(dev); + if (virtio_set_status(vdev, status) == 0) { + if (vdev->status == 0) { + virtio_reset(vdev); + } + if (status & VIRTIO_CONFIG_S_DRIVER_OK) { + virtio_ccw_start_ioeventfd(dev); + } + sch->curr_status.scsw.count = ccw.count - sizeof(status); + ret = 0; + } else { + /* Trigger a command reject. */ + ret = -ENOSYS; } - sch->curr_status.scsw.count = ccw.count - sizeof(status); - ret = 0; } break; case CCW_CMD_SET_IND: |