summaryrefslogtreecommitdiff
path: root/pc-bios/s390-ccw/scsi.h
diff options
context:
space:
mode:
authorEric Farman <farman@linux.vnet.ibm.com>2017-05-10 17:53:57 +0200
committerCornelia Huck <cornelia.huck@de.ibm.com>2017-05-19 12:29:01 +0200
commitfe921fc8b7e92020bb140079a9f47f14fb8e9075 (patch)
treeb40bd42284828ff0b2908e692369d2f0e84ce29c /pc-bios/s390-ccw/scsi.h
parent8edfe85bef669d676ad17cd84b4e3dce43b110e4 (diff)
downloadqemu-fe921fc8b7e92020bb140079a9f47f14fb8e9075.tar.gz
pc-bios/s390-ccw: Get Block Limits VPD device data
The "Block Limits" Inquiry VPD page is optional for any SCSI device, but if it's supported it provides a hint of the maximum I/O transfer length for this particular device. If this page is supported by the disk, let's issue that Inquiry and use the minimum of it and the SCSI controller limit. That will cover this scenario: qemu-system-s390x ... -device virtio-scsi-ccw,id=scsi0,max_sectors=32768 ... -drive file=/dev/sda,if=none,id=drive0,format=raw ... -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0, drive=drive0,id=disk0,max_io_size=1048576 controller: 32768 sectors x 512 bytes/sector = 16777216 bytes disk: 1048576 bytes Now that we have a limit for a virtio-scsi disk, compare that with the limit for the virtio-scsi controller when we actually build the I/O. The minimum of these two limits should be the one we use. Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com> Message-Id: <20170510155359.32727-7-farman@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'pc-bios/s390-ccw/scsi.h')
-rw-r--r--pc-bios/s390-ccw/scsi.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/pc-bios/s390-ccw/scsi.h b/pc-bios/s390-ccw/scsi.h
index 803eff8ae3..fe3fd5ac05 100644
--- a/pc-bios/s390-ccw/scsi.h
+++ b/pc-bios/s390-ccw/scsi.h
@@ -33,6 +33,7 @@
/* SCSI Inquiry Pages */
#define SCSI_INQUIRY_STANDARD_NONE 0x00U
#define SCSI_INQUIRY_EVPD_SUPPORTED_PAGES 0x00U
+#define SCSI_INQUIRY_EVPD_BLOCK_LIMITS 0xb0U
union ScsiLun {
uint64_t v64; /* numeric shortcut */
@@ -87,6 +88,19 @@ struct ScsiInquiryEvpdPages {
} __attribute__((packed));
typedef struct ScsiInquiryEvpdPages ScsiInquiryEvpdPages;
+struct ScsiInquiryEvpdBl {
+ uint8_t peripheral_qdt; /* b0, use (b0 & 0x1f) to get SCSI_INQ_RDT */
+ uint8_t page_code;
+ uint16_t page_length;
+ uint8_t b4;
+ uint8_t b5;
+ uint16_t b6;
+ uint32_t max_transfer; /* b8 */
+ uint32_t b12[7]; /* b12..b43 (defined fields) */
+ uint32_t b44[5]; /* b44..b63 (reserved fields) */
+} __attribute__((packed));
+typedef struct ScsiInquiryEvpdBl ScsiInquiryEvpdBl;
+
struct ScsiCdbInquiry {
uint8_t command; /* b0, == 0x12 */
uint8_t b1; /* b1, |= 0x01 (evpd) */