SCSI changes for 2014-01-23
Anthony,
the following changes since commit 1cf892ca2689c84960b4ce4d2723b6bee453711c:
SPARC: Fix LEON3 power down instruction (2014-01-15 15:37:33 +1000)
are available in the git repository at:
git://github.com/bonzini/qemu.git scsi-next
for you to fetch changes up to 1cb27d9233d572826b45bd8498d2fab1b6f01df9:
scsi: Support TEST UNIT READY in the dummy LUN0 (2014-01-16 13:09:50 +0100)
Paolo
----------------------------------------------------------------
Eric Farman (2):
virtio-scsi: Cleanup of I/Os that never started
virtio-scsi: Prevent assertion on missed events
Jeff Cody (1):
block: add .bdrv_reopen_prepare() stub for iscsi
Paolo Bonzini (2):
scsi: Assign cancel_io vector for scsi_disk_emulate_ops
scsi: Support TEST UNIT READY in the dummy LUN0
block/iscsi.c | 9 +++++++++ hw/scsi/scsi-bus.c | 2 ++ hw/scsi/scsi-disk.c | 1 + hw/scsi/virtio-scsi.c | 6 +++++- 4 files changed, 17 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 2/5] virtio-scsi: Cleanup of I/Os that never started
From: Eric Farman <[email protected]>
There is still a small window that occurs when a cancel I/O affects an asynchronous I/O operation that hasn't started. In other words, when the residual data length equals the expected data length.
Today, the routine virtio_scsi_command_complete fails because the VirtIOSCSIReq pointer (from the hba_private field in SCSIRequest) was cleared earlier when virtio_scsi_complete_req was called by the virtio_scsi_request_cancelled routine. As a result, the virtio_scsi_command_complete routine needs to simply return when it is processing a SCSIRequest block that was marked canceled.
--- hw/scsi/virtio-scsi.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/scsi/virtio-scsi.c +4 -0
@@ -306,6 +306,10 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,VirtIOSCSIReq *req = r->hba_private;uint32_t sense_len; +if (r->io_canceled) { +return ; + } + req->resp.cmd->response =VIRTIO_SCSI_S_OK ; req->resp.cmd->status = status;if (req->resp.cmd->status ==GOOD ) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 1/5] scsi: Assign cancel_io vector for scsi_disk_emulate_ops
In reply to Paolo BonziniSome emulated disk operations (MODE SELECT, UNMAP, WRITE SAME) can trigger asynchronous I/Os. Provide the cancel_io callback to ensure that AIOCBs are properly cleaned up.
--- hw/scsi/scsi-disk.c | 1 + 1 file changed, 1 insertion(+)
hw/scsi/scsi-disk.c +1 -0
@@ -2306,6 +2306,7 @@ static const SCSIReqOps scsi_disk_emulate_reqops = { .send_command = scsi_disk_emulate_command, .read_data = scsi_disk_emulate_read_data, .write_data = scsi_disk_emulate_write_data, + .cancel_io = scsi_cancel_io, .get_buf = scsi_get_buf, };
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 3/5] virtio-scsi: Prevent assertion on missed events
In reply to Paolo BonziniFrom: Eric Farman <[email protected]>
In some cases, an unplug can cause events to be dropped, which leads to an assertion failure when preparing to notify the guest kernel.
--- hw/scsi/virtio-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/virtio-scsi.c +1 -1
@@ -520,7 +520,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, evt->event = event; evt->reason = reason;if (!dev) { -assert (event ==VIRTIO_SCSI_T_NO_EVENT ); +assert (event ==VIRTIO_SCSI_T_EVENTS_MISSED ); }else { evt->lun[0 ] =1 ; evt->lun[1 ] = dev->id;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 5/5] scsi: Support TEST UNIT READY in the dummy LUN0
In reply to Paolo BonziniSeaBIOS waits for LUN0 to respond to the TEST UNIT READY command in order to decide whether it should part of the boot sequence. If LUN0 does not respond to the command, boot is delayed by up to 5 seconds. This currently happens when there is no LUN0 on a target. Fix that by adding a trivial implementation of the command.
--- hw/scsi/scsi-bus.c | 2 ++ 1 file changed, 2 insertions(+)
hw/scsi/scsi-bus.c +2 -0
@@ -469,6 +469,8 @@ static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf) r->req.dev->sense_is_ua = false; }break ; +case TEST_UNIT_READY : +break ;default :scsi_req_build_sense (req,SENSE_CODE (LUN_NOT_SUPPORTED ));scsi_req_complete (req,CHECK_CONDITION );
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 4/5] block: add .bdrv_reopen_prepare() stub for iscsi
In reply to Paolo BonziniFrom: Jeff Cody <[email protected]>
To suppport reopen(), the .bdrv_reopen_prepare() stub must exist. iSCSI does not have anything that needs to be done to support reopen, so we can just implement the _prepare() stub.
--- block/iscsi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
block/iscsi.c +9 -0
@@ -1326,6 +1326,14 @@ static void iscsi_close(BlockDriverState *bs)memset (iscsilun,0 ,sizeof (IscsiLun)); } +/* We have nothing to do for iSCSI reopen, stub just returns +* success */ +static int iscsi_reopen_prepare (BDRVReopenState *state, +BlockReopenQueue *queue,Error **errp) +{ +return 0 ; +} +static int iscsi_truncate (BlockDriverState *bs,int64_t offset) {IscsiLun *iscsilun = bs->opaque;
@@ -1434,6 +1442,7 @@ static BlockDriver bdrv_iscsi = { .bdrv_close = iscsi_close, .bdrv_create = iscsi_create, .create_options = iscsi_create_options, + .bdrv_reopen_prepare = iscsi_reopen_prepare, .bdrv_getlength = iscsi_getlength, .bdrv_get_info = iscsi_get_info,
Signature · 1 line
1.8.3.1