From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Alexander Graf <agraf@suse.de>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
qemu-devel@nongnu.org, Dominik Dingel <dingel@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 3/4] s390-ccw.img: Rudimentary error checking.
Date: Tue, 23 Apr 2013 14:37:13 +0200 [thread overview]
Message-ID: <1366720634-13184-4-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1366720634-13184-1-git-send-email-cornelia.huck@de.ibm.com>
Try to handle at least some of the errors that may happen.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
pc-bios/s390-ccw/virtio.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index 2a132f8..8e37dce 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -90,7 +90,9 @@ static int run_ccw(struct subchannel_id schid, int cmd, void *ptr, int len)
* assume that a simple tsch will have finished the CCW processing,
* but the architecture allows for asynchronous operation
*/
- drain_irqs(schid);
+ if (!r) {
+ r = drain_irqs(schid);
+ }
return r;
}
@@ -98,7 +100,9 @@ static void virtio_set_status(struct subchannel_id schid,
unsigned long dev_addr)
{
unsigned char status = dev_addr;
- run_ccw(schid, CCW_CMD_WRITE_STATUS, &status, sizeof(status));
+ if (run_ccw(schid, CCW_CMD_WRITE_STATUS, &status, sizeof(status))) {
+ virtio_panic("Could not write status to host!\n");
+ }
}
static void virtio_reset(struct subchannel_id schid)
@@ -197,6 +201,7 @@ static int virtio_read_many(ulong sector, void *load_addr, int sec_num)
{
struct virtio_blk_outhdr out_hdr;
u8 status;
+ int r;
/* Tell the host we want to read */
out_hdr.type = VIRTIO_BLK_T_IN;
@@ -217,8 +222,11 @@ static int virtio_read_many(ulong sector, void *load_addr, int sec_num)
/* Now we can tell the host to read */
vring_wait_reply(&block, 0);
- drain_irqs(block.schid);
-
+ r = drain_irqs(block.schid);
+ if (r) {
+ /* Well, whatever status is supposed to contain... */
+ status = 1;
+ }
return status;
}
@@ -266,8 +274,9 @@ void virtio_setup_block(struct subchannel_id schid)
info.num = 128;
block.schid = schid;
- run_ccw(schid, CCW_CMD_SET_VQ, &info, sizeof(info));
- virtio_set_status(schid, VIRTIO_CONFIG_S_DRIVER_OK);
+ if (!run_ccw(schid, CCW_CMD_SET_VQ, &info, sizeof(info))) {
+ virtio_set_status(schid, VIRTIO_CONFIG_S_DRIVER_OK);
+ }
}
bool virtio_is_blk(struct subchannel_id schid)
--
1.7.12.4
next prev parent reply other threads:[~2013-04-23 12:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-23 12:37 [Qemu-devel] [PATCH 0/4] s390-ccw.img: Some more updates Cornelia Huck
2013-04-23 12:37 ` [Qemu-devel] [PATCH 1/4] s390-ccw.img: Detect devices with stsch Cornelia Huck
2013-04-23 12:37 ` [Qemu-devel] [PATCH 2/4] s390-ccw.img: Enhance drain_irqs() Cornelia Huck
2013-04-23 12:37 ` Cornelia Huck [this message]
2013-04-23 12:37 ` [Qemu-devel] [PATCH 4/4] s390-ccw.img: Get queue config from host Cornelia Huck
2013-04-24 18:08 ` [Qemu-devel] [PATCH 0/4] s390-ccw.img: Some more updates Alexander Graf
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=1366720634-13184-4-git-send-email-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=dingel@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).