summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/storvsc
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2016-08-08 07:09:40 +0000
committersephe <sephe@FreeBSD.org>2016-08-08 07:09:40 +0000
commit59daa2995eb19cafbae68936d86b4e16c6db288b (patch)
tree5575f5cbedea694f470d9b0938d34a05ed611076 /sys/dev/hyperv/storvsc
parentf3af2964a3b0e906db71eaa05653924efbbda00a (diff)
downloadFreeBSD-src-59daa2995eb19cafbae68936d86b4e16c6db288b.zip
FreeBSD-src-59daa2995eb19cafbae68936d86b4e16c6db288b.tar.gz
MFC 303737
hyperv/storvsc: Claim SPC-3 conformance, thus enable UNMAP support The Hyper-V on pre-win10 systems will only report SPC-2 conformance, but it actually conforms to SPC-3. The INQUIRY response is adjusted to propagate the SPC-3 version information to CAM. Submitted by: Hongjiang Zhang <honzhan microsoft com> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7405 Approved by: re (delphij)
Diffstat (limited to 'sys/dev/hyperv/storvsc')
-rw-r--r--sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
index 33a638c..8f3efef 100644
--- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
@@ -2062,8 +2062,8 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
* For more information about INQUIRY, please refer to:
* ftp://ftp.avc-pioneer.com/Mtfuji_7/Proposal/Jun09/INQUIRY.pdf
*/
- const struct scsi_inquiry_data *inq_data =
- (const struct scsi_inquiry_data *)csio->data_ptr;
+ struct scsi_inquiry_data *inq_data =
+ (struct scsi_inquiry_data *)csio->data_ptr;
uint8_t* resp_buf = (uint8_t*)csio->data_ptr;
/* Get the buffer length reported by host */
int resp_xfer_len = vm_srb->transfer_len;
@@ -2092,6 +2092,25 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
mtx_unlock(&sc->hs_lock);
}
} else {
+ char vendor[16];
+ cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor),
+ sizeof(vendor));
+ /**
+ * XXX: upgrade SPC2 to SPC3 if host is WIN8 or WIN2012 R2
+ * in order to support UNMAP feature
+ */
+ if (!strncmp(vendor,"Msft",4) &&
+ SID_ANSI_REV(inq_data) == SCSI_REV_SPC2 &&
+ (vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN8_1 ||
+ vmstor_proto_version== VMSTOR_PROTOCOL_VERSION_WIN8)) {
+ inq_data->version = SCSI_REV_SPC3;
+ if (bootverbose) {
+ mtx_lock(&sc->hs_lock);
+ xpt_print(ccb->ccb_h.path,
+ "storvsc upgrades SPC2 to SPC3\n");
+ mtx_unlock(&sc->hs_lock);
+ }
+ }
ccb->ccb_h.status |= CAM_REQ_CMP;
if (bootverbose) {
mtx_lock(&sc->hs_lock);
OpenPOWER on IntegriCloud