[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 27/31] scsi-generic: Merge block max xfer len in INQU
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 27/31] scsi-generic: Merge block max xfer len in INQUIRY response |
Date: |
Fri, 27 May 2016 12:06:40 +0200 |
From: Fam Zheng <address@hidden>
The rationale is similar to the above mode sense response interception:
this is practically the only channel to communicate restraints from
elsewhere such as host and block driver.
The scsi bus we attach onto can have a larger max xfer len than what is
accepted by the host file system (guarding between the host scsi LUN and
QEMU), in which case the SG_IO we generate would get -EINVAL.
Signed-off-by: Fam Zheng <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/scsi/scsi-generic.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 7459465..71372a8 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -222,6 +222,18 @@ static void scsi_read_complete(void * opaque, int ret)
r->buf[3] |= 0x80;
}
}
+ if (s->type == TYPE_DISK &&
+ r->req.cmd.buf[0] == INQUIRY &&
+ r->req.cmd.buf[2] == 0xb0) {
+ uint32_t max_xfer_len = blk_get_max_transfer_length(s->conf.blk);
+ if (max_xfer_len) {
+ stl_be_p(&r->buf[8], max_xfer_len);
+ /* Also take care of the opt xfer len. */
+ if (ldl_be_p(&r->buf[12]) > max_xfer_len) {
+ stl_be_p(&r->buf[12], max_xfer_len);
+ }
+ }
+ }
scsi_req_data(&r->req, len);
scsi_req_unref(&r->req);
}
--
2.5.5
- [Qemu-devel] [PULL 20/31] docs/atomics: update comparison with Linux, (continued)
- [Qemu-devel] [PULL 20/31] docs/atomics: update comparison with Linux, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 17/31] docs/atomics: update atomic_read/set comparison with Linux, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 16/31] bt: rewrite csrhci_write to avoid out-of-bounds writes, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 24/31] scsi-disk: add need_fua_emulation to SCSIDiskClass, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 19/31] atomics: do not emit consume barrier for atomic_rcu_read, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 21/31] xen-hvm: ignore background I/O sections, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 22/31] scsi-disk: introduce a common base class, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 25/31] scsi-disk: introduce scsi_disk_req_check_error, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 26/31] scsi-block: always use SG_IO, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 23/31] scsi-disk: introduce dma_readv and dma_writev, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 27/31] scsi-generic: Merge block max xfer len in INQUIRY response,
Paolo Bonzini <=
- [Qemu-devel] [PULL 31/31] exec: hide mr->ram_addr from qemu_get_ram_ptr users, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 29/31] exec: remove ram_addr argument from qemu_ram_block_from_host, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 28/31] memory: remove qemu_get_ram_fd, qemu_set_ram_fd, qemu_ram_block_host_ptr, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 30/31] memory: split memory_region_from_host from qemu_ram_addr_from_host, Paolo Bonzini, 2016/05/27
- Re: [Qemu-devel] [PULL 00/31] Misc changes for 2016-05-27, Peter Maydell, 2016/05/27