[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/92] scsi-generic: Fix HM-zoned device scan
From: |
Paolo Bonzini |
Subject: |
[PULL 25/92] scsi-generic: Fix HM-zoned device scan |
Date: |
Thu, 24 Sep 2020 05:22:07 -0400 |
From: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Several important steps during device scan depend on SCSI type of the
device. For example, max_transfer property is only determined and
assigned if the device has the type of TYPE_DISK.
Host-managed ZBC disks retain most of the properties of regular SCSI
drives, but they have their own SCSI device type, 0x14. This prevents
the proper assignment of max_transfer property for HM-zoned devices in
scsi-generic driver leading to I/O errors if the maximum i/o size
calculated at the guest exceeds the host value.
To fix this, define TYPE_ZBC to have the standard value from SCSI ZBC
standard spec. Several scan steps that were previously done only for
TYPE_DISK devices, are now performed for the SCSI devices having
TYPE_ZBC too.
Reported-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Message-Id: <20200811225122.17342-3-dmitry.fomichev@wdc.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/scsi-generic.c | 10 ++++++----
include/scsi/constants.h | 1 +
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 86ed0a3822..2cb23ca891 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -162,7 +162,8 @@ static void scsi_handle_inquiry_reply(SCSIGenericReq *r,
SCSIDevice *s)
}
}
- if (s->type == TYPE_DISK && (r->req.cmd.buf[1] & 0x01)) {
+ if ((s->type == TYPE_DISK || s->type == TYPE_ZBC) &&
+ (r->req.cmd.buf[1] & 0x01)) {
page = r->req.cmd.buf[2];
if (page == 0xb0) {
uint32_t max_transfer =
@@ -299,10 +300,11 @@ static void scsi_read_complete(void * opaque, int ret)
}
blk_set_guest_block_size(s->conf.blk, s->blocksize);
- /* Patch MODE SENSE device specific parameters if the BDS is opened
+ /*
+ * Patch MODE SENSE device specific parameters if the BDS is opened
* readonly.
*/
- if ((s->type == TYPE_DISK || s->type == TYPE_TAPE) &&
+ if ((s->type == TYPE_DISK || s->type == TYPE_TAPE || s->type == TYPE_ZBC)
&&
blk_is_read_only(s->conf.blk) &&
(r->req.cmd.buf[0] == MODE_SENSE ||
r->req.cmd.buf[0] == MODE_SENSE_10) &&
@@ -617,7 +619,7 @@ static void
scsi_generic_read_device_identification(SCSIDevice *s)
void scsi_generic_read_device_inquiry(SCSIDevice *s)
{
scsi_generic_read_device_identification(s);
- if (s->type == TYPE_DISK) {
+ if (s->type == TYPE_DISK || s->type == TYPE_ZBC) {
scsi_generic_set_vpd_bl_emulation(s);
} else {
s->needs_vpd_bl_emulation = false;
diff --git a/include/scsi/constants.h b/include/scsi/constants.h
index 874176019e..2a32c08b5e 100644
--- a/include/scsi/constants.h
+++ b/include/scsi/constants.h
@@ -218,6 +218,7 @@
#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
#define TYPE_RBC 0x0e /* Simplified Direct-Access Device */
#define TYPE_OSD 0x11 /* Object-storage Device */
+#define TYPE_ZBC 0x14 /* Host-managed Zoned SCSI Device */
#define TYPE_WLUN 0x1e /* Well known LUN */
#define TYPE_NOT_PRESENT 0x1f
#define TYPE_INACTIVE 0x20
--
2.26.2
- [PULL 11/92] vhost-scsi: support inflight io track, (continued)
- [PULL 11/92] vhost-scsi: support inflight io track, Paolo Bonzini, 2020/09/24
- [PULL 14/92] doc: Cleanup "'-mem-path' fallback to RAM" deprecation text, Paolo Bonzini, 2020/09/24
- [PULL 13/92] numa: drop support for '-numa node' (without memory specified), Paolo Bonzini, 2020/09/24
- [PULL 17/92] hw/char/serial: Remove TYPE_SERIAL_IO, Paolo Bonzini, 2020/09/24
- [PULL 16/92] hw/mips/mipssim: Use MMIO serial device on fake ISA I/O, Paolo Bonzini, 2020/09/24
- [PULL 20/92] hw/char/serial: Replace commented DPRINTF() by trace event, Paolo Bonzini, 2020/09/24
- [PULL 19/92] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes, Paolo Bonzini, 2020/09/24
- [PULL 28/92] i386/cpu: Clear FEAT_XSAVE_COMP_{LO, HI} when XSAVE is not available, Paolo Bonzini, 2020/09/24
- [PULL 23/92] hw/char/serial: Make 'wakeup' property boolean, Paolo Bonzini, 2020/09/24
- [PULL 21/92] hw/char/serial: Remove old DEBUG_SERIAL commented code, Paolo Bonzini, 2020/09/24
- [PULL 25/92] scsi-generic: Fix HM-zoned device scan,
Paolo Bonzini <=
- [PULL 27/92] hw: megasas: consider 'iov_count=0' is an error in megasas_map_sgl, Paolo Bonzini, 2020/09/24
- [PULL 18/92] configure: rename QEMU_GA_MSI_ENABLED to CONFIG_QGA_MSI, Paolo Bonzini, 2020/09/24
- [PULL 29/92] meson: move libudev test, Paolo Bonzini, 2020/09/24
- [PULL 31/92] meson: extend libmpathpersist test for static linking, Paolo Bonzini, 2020/09/24
- [PULL 22/92] hw/char/serial: Rename I/O read/write trace events, Paolo Bonzini, 2020/09/24
- [PULL 30/92] meson: move libmpathpersist test, Paolo Bonzini, 2020/09/24
- [PULL 33/92] configure: fix --meson=/path/to/meson, Paolo Bonzini, 2020/09/24
- [PULL 32/92] configure: move malloc_trim/tcmalloc/jemalloc to meson, Paolo Bonzini, 2020/09/24
- [PULL 26/92] hw: megasas: return -1 when 'megasas_map_sgl' fails, Paolo Bonzini, 2020/09/24
- [PULL 35/92] configure: do not limit Hypervisor.framework test to Darwin, Paolo Bonzini, 2020/09/24