aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-23 16:37:11 -0600
committerKevin Wolf <kwolf@redhat.com>2016-07-05 16:46:25 +0200
commitefaf4781a995aacd22b1dd521b14e4644bafae14 (patch)
tree84696f5958a407ea16775b5b0e9ed280f8261461
parentf9e95af0a6be281f56ecc8413ea4a3ac3545ce17 (diff)
downloadqemu-efaf4781a995aacd22b1dd521b14e4644bafae14.zip
qemu-efaf4781a995aacd22b1dd521b14e4644bafae14.tar.gz
qemu-efaf4781a995aacd22b1dd521b14e4644bafae14.tar.bz2
scsi: Advertise limits by blocksize, not 512
s->blocksize may be larger than 512, in which case our tweaks to max_xfer_len and opt_xfer_len must be scaled appropriately. CC: qemu-stable@nongnu.org Reported-by: Fam Zheng <famz@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--hw/scsi/scsi-generic.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 6a2d89a..75e227d 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -225,7 +225,8 @@ static void scsi_read_complete(void * opaque, int ret)
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);
+ uint32_t max_xfer_len = blk_get_max_transfer_length(s->conf.blk) /
+ (s->blocksize / BDRV_SECTOR_SIZE);
if (max_xfer_len) {
stl_be_p(&r->buf[8], max_xfer_len);
/* Also take care of the opt xfer len. */