All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sitsofe Wheeler <sitsofe@gmail.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: linux-scsi@vger.kernel.org,
	Haiyang Zhang <haiyangz@microsoft.com>,
	linux-kernel@vger.kernel.org,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	Hannes Reinecke <hare@suse.de>,
	devel@linuxdriverproject.org, Christoph Hellwig <hch@lst.de>
Subject: [PATCH 2/3] scsi: add try_rc16 blacklist flag
Date: Fri, 10 Oct 2014 08:52:51 +0100	[thread overview]
Message-ID: <20141010075251.GC32028@sucs.org> (raw)
In-Reply-To: <20141010074901.GA32028@sucs.org>

Microsoft Hyper-V virtual disks currently only claim SPC-2 compliance causing
the kernel skip checks for features such as thin provisioning even though the
virtual disk advertises them.

Add a blacklist flag that can allow such devices to quirk past READ
CAPACITY(16) guards.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
---
 drivers/scsi/scsi_scan.c    | 3 +++
 drivers/scsi/sd.c           | 3 +++
 include/scsi/scsi_device.h  | 1 +
 include/scsi/scsi_devinfo.h | 1 +
 4 files changed, 8 insertions(+)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index ba3f1e8..d3f6267 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -962,6 +962,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
 	else if (*bflags & BLIST_SKIP_VPD_PAGES)
 		sdev->skip_vpd_pages = 1;
 
+	if (*bflags & BLIST_TRY_RC16)
+		sdev->try_rc16 = 1;
+
 	transport_configure_device(&sdev->sdev_gendev);
 
 	if (sdev->host->hostt->slave_configure) {
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 0cb5c9f..0ccf372 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2143,6 +2143,9 @@ static int sd_try_rc16_first(struct scsi_device *sdp)
 		return 0;
 	if (sdp->scsi_level > SCSI_SPC_2)
 		return 1;
+	if (sdp->try_rc16) {
+		return 1;
+	}
 	if (scsi_device_protection(sdp))
 		return 1;
 	return 0;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 27ecee7..d6e2bd8 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -155,6 +155,7 @@ struct scsi_device {
 	unsigned skip_ms_page_3f:1;	/* do not use MODE SENSE page 0x3f */
 	unsigned skip_vpd_pages:1;	/* do not read VPD pages */
 	unsigned try_vpd_pages:1;	/* attempt to read VPD pages */
+	unsigned try_rc16:1;		/* attempt READ CAPACITY(16) */
 	unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
 	unsigned no_start_on_add:1;	/* do not issue start on add */
 	unsigned allow_restart:1; /* issue START_UNIT in error handler */
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index 183eaab..9431f5e 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -36,5 +36,6 @@
 					     for sequential scan */
 #define BLIST_TRY_VPD_PAGES	0x10000000 /* Attempt to read VPD pages */
 #define BLIST_NO_RSOC		0x20000000 /* don't try to issue RSOC */
+#define BLIST_TRY_RC16		0x40000000 /* Attempt READ CAPACITY(16) */
 
 #endif
-- 
1.9.3

WARNING: multiple messages have this Message-ID (diff)
From: Sitsofe Wheeler <sitsofe@gmail.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>,
	Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org,
	"James E.J. Bottomley" <JBottomley@parallels.com>
Subject: [PATCH 2/3] scsi: add try_rc16 blacklist flag
Date: Fri, 10 Oct 2014 08:52:51 +0100	[thread overview]
Message-ID: <20141010075251.GC32028@sucs.org> (raw)
In-Reply-To: <20141010074901.GA32028@sucs.org>

Microsoft Hyper-V virtual disks currently only claim SPC-2 compliance causing
the kernel skip checks for features such as thin provisioning even though the
virtual disk advertises them.

Add a blacklist flag that can allow such devices to quirk past READ
CAPACITY(16) guards.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
---
 drivers/scsi/scsi_scan.c    | 3 +++
 drivers/scsi/sd.c           | 3 +++
 include/scsi/scsi_device.h  | 1 +
 include/scsi/scsi_devinfo.h | 1 +
 4 files changed, 8 insertions(+)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index ba3f1e8..d3f6267 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -962,6 +962,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
 	else if (*bflags & BLIST_SKIP_VPD_PAGES)
 		sdev->skip_vpd_pages = 1;
 
+	if (*bflags & BLIST_TRY_RC16)
+		sdev->try_rc16 = 1;
+
 	transport_configure_device(&sdev->sdev_gendev);
 
 	if (sdev->host->hostt->slave_configure) {
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 0cb5c9f..0ccf372 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2143,6 +2143,9 @@ static int sd_try_rc16_first(struct scsi_device *sdp)
 		return 0;
 	if (sdp->scsi_level > SCSI_SPC_2)
 		return 1;
+	if (sdp->try_rc16) {
+		return 1;
+	}
 	if (scsi_device_protection(sdp))
 		return 1;
 	return 0;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 27ecee7..d6e2bd8 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -155,6 +155,7 @@ struct scsi_device {
 	unsigned skip_ms_page_3f:1;	/* do not use MODE SENSE page 0x3f */
 	unsigned skip_vpd_pages:1;	/* do not read VPD pages */
 	unsigned try_vpd_pages:1;	/* attempt to read VPD pages */
+	unsigned try_rc16:1;		/* attempt READ CAPACITY(16) */
 	unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
 	unsigned no_start_on_add:1;	/* do not issue start on add */
 	unsigned allow_restart:1; /* issue START_UNIT in error handler */
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index 183eaab..9431f5e 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -36,5 +36,6 @@
 					     for sequential scan */
 #define BLIST_TRY_VPD_PAGES	0x10000000 /* Attempt to read VPD pages */
 #define BLIST_NO_RSOC		0x20000000 /* don't try to issue RSOC */
+#define BLIST_TRY_RC16		0x40000000 /* Attempt READ CAPACITY(16) */
 
 #endif
-- 
1.9.3


  parent reply	other threads:[~2014-10-10  7:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-10  7:49 [PATCH 0/3] scsi: Add Hyper-V logical block provisioning quirks Sitsofe Wheeler
2014-10-10  7:49 ` Sitsofe Wheeler
2014-10-10  7:51 ` [PATCH 1/3] Revert "Drivers: add blist flags" Sitsofe Wheeler
2014-10-10  7:51   ` Sitsofe Wheeler
2014-10-10  7:52 ` Sitsofe Wheeler [this message]
2014-10-10  7:52   ` [PATCH 2/3] scsi: add try_rc16 blacklist flag Sitsofe Wheeler
2014-10-15  1:08   ` Martin K. Petersen
2014-10-15  1:08     ` Martin K. Petersen
2014-10-15  2:07     ` KY Srinivasan
2014-10-21  4:21     ` Sitsofe Wheeler
2014-10-21  4:21       ` Sitsofe Wheeler
2014-10-23  1:46       ` Martin K. Petersen
2014-10-23  1:46         ` Martin K. Petersen
2014-10-10  7:55 ` [PATCH 3/3] scsi: Use try_rc16 and try_vpd_pages quirks on Hyper-V virtual disks Sitsofe Wheeler
2014-10-10  7:55   ` Sitsofe Wheeler
2014-10-11 17:39 ` [PATCH 0/3] scsi: Add Hyper-V logical block provisioning quirks Christoph Hellwig
2014-10-11 17:41   ` James Bottomley
2014-10-11 17:41     ` James Bottomley
2014-10-11 19:48     ` KY Srinivasan
2014-10-11 19:48       ` KY Srinivasan
2014-10-11 20:22       ` Jeff Leung
2014-10-11 20:22         ` Jeff Leung
2014-10-12  1:21         ` KY Srinivasan
2014-10-12  1:21           ` KY Srinivasan
2014-10-21  4:45           ` Sitsofe Wheeler
2014-10-21  4:45             ` Sitsofe Wheeler
2014-10-21  5:19             ` Jeff Leung
2014-10-21  5:19               ` Jeff Leung
2014-10-21 18:30             ` KY Srinivasan
2014-10-21 18:30               ` KY Srinivasan
2014-10-15  1:06 ` Martin K. Petersen
2014-10-15  1:06   ` Martin K. Petersen
2014-10-21  4:17   ` Sitsofe Wheeler
2014-10-21  4:17     ` Sitsofe Wheeler
2014-10-23  1:50     ` Martin K. Petersen
2014-10-23  1:50       ` Martin K. Petersen
2014-10-23  9:03       ` Sitsofe Wheeler
2014-10-23  9:03         ` Sitsofe Wheeler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141010075251.GC32028@sucs.org \
    --to=sitsofe@gmail.com \
    --cc=JBottomley@parallels.com \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.