mirror of
https://github.com/torvalds/linux.git
synced 2024-10-31 01:01:52 +00:00
KVM: s390 allow virtio_ccw status writes to fail
Gracefully handle failure to write device status. We really should handle other errors as well, but this one is needed for virtio 1.0 compliance. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
d4674240f3
commit
485551366d
@ -862,7 +862,9 @@ static u8 virtio_ccw_get_status(struct virtio_device *vdev)
|
|||||||
static void virtio_ccw_set_status(struct virtio_device *vdev, u8 status)
|
static void virtio_ccw_set_status(struct virtio_device *vdev, u8 status)
|
||||||
{
|
{
|
||||||
struct virtio_ccw_device *vcdev = to_vc_device(vdev);
|
struct virtio_ccw_device *vcdev = to_vc_device(vdev);
|
||||||
|
u8 old_status = *vcdev->status;
|
||||||
struct ccw1 *ccw;
|
struct ccw1 *ccw;
|
||||||
|
int ret;
|
||||||
|
|
||||||
ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
|
ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
|
||||||
if (!ccw)
|
if (!ccw)
|
||||||
@ -874,7 +876,10 @@ static void virtio_ccw_set_status(struct virtio_device *vdev, u8 status)
|
|||||||
ccw->flags = 0;
|
ccw->flags = 0;
|
||||||
ccw->count = sizeof(status);
|
ccw->count = sizeof(status);
|
||||||
ccw->cda = (__u32)(unsigned long)vcdev->status;
|
ccw->cda = (__u32)(unsigned long)vcdev->status;
|
||||||
ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_STATUS);
|
ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_STATUS);
|
||||||
|
/* Write failed? We assume status is unchanged. */
|
||||||
|
if (ret)
|
||||||
|
*vcdev->status = old_status;
|
||||||
kfree(ccw);
|
kfree(ccw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user