aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi/scsi-disk.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2021-02-24 19:14:50 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2021-03-06 11:42:57 +0100
commitf3126d65b393c015e8f87763fdccee99bb1119af (patch)
tree55e3593634cbaadde5e1a74f7c2d0e43c8001dd1 /hw/scsi/scsi-disk.c
parenta108557bbff8a3f44233982f015f996426411be8 (diff)
downloadqemu-f3126d65b393c015e8f87763fdccee99bb1119af.zip
qemu-f3126d65b393c015e8f87763fdccee99bb1119af.tar.gz
qemu-f3126d65b393c015e8f87763fdccee99bb1119af.tar.bz2
scsi: move host_status handling into SCSI drivers
Some SCSI drivers like virtio have an internal mapping for the host_status. This patch moves the host_status translation into the SCSI drivers to allow those drivers to set up the correct values. Signed-off-by: Hannes Reinecke <hare@suse.de>. [Added default handling to avoid touching all drivers. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi/scsi-disk.c')
-rw-r--r--hw/scsi/scsi-disk.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index ceaf78b..bd7103c 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2704,15 +2704,15 @@ static void scsi_block_sgio_complete(void *opaque, int ret)
SCSIDiskReq *r = &req->req;
SCSIDevice *s = r->req.dev;
sg_io_hdr_t *io_hdr = &req->io_header;
- SCSISense sense;
if (ret == 0) {
if (io_hdr->host_status != SCSI_HOST_OK) {
- ret = scsi_sense_from_host_status(io_hdr->host_status, &sense);
- if (ret == CHECK_CONDITION) {
- scsi_req_build_sense(&r->req, sense);
- }
- } else if (io_hdr->driver_status & SG_ERR_DRIVER_TIMEOUT) {
+ scsi_req_complete_failed(&r->req, io_hdr->host_status);
+ scsi_req_unref(&r->req);
+ return;
+ }
+
+ if (io_hdr->driver_status & SG_ERR_DRIVER_TIMEOUT) {
ret = BUSY;
} else {
ret = io_hdr->status;