From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
linux390@de.ibm.com, Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
linux-s390@vger.kernel.org
Subject: [PATCH RFC v4 16/17] KVM: s390 allow virtio_ccw status writes to fail
Date: Thu, 23 Oct 2014 19:25:01 +0300 [thread overview]
Message-ID: <1414081380-14623-17-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1414081380-14623-1-git-send-email-mst@redhat.com>
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>
---
drivers/s390/kvm/virtio_ccw.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index a994078..26e737c 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -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)
{
struct virtio_ccw_device *vcdev = to_vc_device(vdev);
+ u8 old_status = vcdev->status;
struct ccw1 *ccw;
+ int ret;
ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
if (!ccw)
@@ -874,7 +876,10 @@ static void virtio_ccw_set_status(struct virtio_device *vdev, u8 status)
ccw->flags = 0;
ccw->count = sizeof(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);
}
--
MST
next prev parent reply other threads:[~2014-10-23 16:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1414081380-14623-1-git-send-email-mst@redhat.com>
2014-10-23 16:24 ` [PATCH RFC v4 03/17] virtio: use u32, not bitmap for struct virtio_device's features Michael S. Tsirkin
2014-10-23 16:24 ` [PATCH RFC v4 04/17] virtio: add support for 64 bit features Michael S. Tsirkin
2014-10-23 16:24 ` [PATCH RFC v4 14/17] KVM: s390: Set virtio-ccw transport revision Michael S. Tsirkin
2014-10-23 16:24 ` [PATCH RFC v4 15/17] KVM: s390: virtio-ccw revision 1 SET_VQ Michael S. Tsirkin
2014-10-23 16:25 ` Michael S. Tsirkin [this message]
2014-10-23 17:22 ` [PATCH RFC v4 16/17] KVM: s390 allow virtio_ccw status writes to fail Cornelia Huck
2014-10-23 16:25 ` [PATCH RFC v4 17/17] KVM: s390: enable virtio-ccw revision 1 Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414081380-14623-17-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux390@de.ibm.com \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox