Index | Thread | Search

From:
Yamasaki Yuu <miagetegorann@gmail.com>
Subject:
[PATCH 3/7] hvs: use 10-byte commands with the Hyper-V virtual DVD drive
To:
tech@openbsd.org
Date:
Wed, 11 Nov 2026 11:46:48 +0900

Download raw body.

Thread
The virtual DVD drive reports ANSI version 0 in its INQUIRY data, so
cd(4) treats it as a pre-SCSI-2 device and reads with READ(6).  The
host fails every READ(6) with SRB_STATUS_INVALID_REQUEST and CHECK
CONDITION, with no sense data, so the drive can't be read.  Report
SCSI-2 for Microsoft CD-ROM devices, next to the existing SPC-3
fixup, so cd(4) uses READ(10).  VPD pages are left alone.
---
 sys/dev/pv/hvs.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git sys/dev/pv/hvs.c sys/dev/pv/hvs.c
index 2024adc75d6..568afb30203 100644
--- sys/dev/pv/hvs.c
+++ sys/dev/pv/hvs.c
@@ -613,6 +613,16 @@ fixup_inquiry(struct scsi_xfer *xs, struct hvs_srb *srb)
 		    (SID_ANSII_REV(inq) == SCSI_REV_SPC2) &&
 		    !strncmp(vendor, "Msft", 4))
 			inq->version = SCSI_REV_SPC3;
+
+		/*
+		 * The virtual DVD drive reports no SCSI version, so cd(4)
+		 * would use READ(6), which the host rejects.
+		 */
+		if (!ISSET(((struct scsi_inquiry *)&xs->cmd)->flags,
+		    SI_EVPD) && (inq->device & SID_TYPE) == T_CDROM &&
+		    SID_ANSII_REV(inq) < SCSI_REV_2 &&
+		    !strncmp(vendor, "Msft", 4))
+			inq->version = SCSI_REV_2;
 	}
 }