linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Pierre Tomon <pierretom+12@ik.me>,
	USB mailing list <linux-usb@vger.kernel.org>,
	SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: [Bug 218890] reset SuperSpeed USB device number 2 using xhci_hcd
Date: Thu, 30 May 2024 21:44:13 -0400	[thread overview]
Message-ID: <yq1ikyueoz8.fsf@ca-mkp.ca.oracle.com> (raw)
In-Reply-To: <70dd7ae0-b6b1-48e1-bb59-53b7c7f18274@rowland.harvard.edu> (Alan Stern's message of "Thu, 30 May 2024 15:03:01 -0400")


Alan,

> This bug report was bisected down to your commit 321da3dc1f3c ("scsi:
> sd: usb_storage: uas: Access media prior to querying device
> properties"). Apparently the drive in question doesn't like READ(10)
> commands but it does work with READ(16).
>
> Can you provide a test patch that updates the new sd_read_block_zero()
> routine to issue READ(16) if the drive has more than 4G logical
> blocks?

Please try the following:

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 65cdc8b77e35..6759bd5af58a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3572,16 +3572,23 @@ static bool sd_validate_opt_xfer_size(struct scsi_disk *sdkp,
 
 static void sd_read_block_zero(struct scsi_disk *sdkp)
 {
-	unsigned int buf_len = sdkp->device->sector_size;
-	char *buffer, cmd[10] = { };
+	struct scsi_device *sdev = sdkp->device;
+	unsigned int buf_len = sdev->sector_size;
+	char *buffer, cmd[16] = { };
 
 	buffer = kmalloc(buf_len, GFP_KERNEL);
 	if (!buffer)
 		return;
 
-	cmd[0] = READ_10;
-	put_unaligned_be32(0, &cmd[2]); /* Logical block address 0 */
-	put_unaligned_be16(1, &cmd[7]);	/* Transfer 1 logical block */
+	if (sdev->use_16_for_rw) {
+		cmd[0] = READ_16;
+		put_unaligned_be64(0, &cmd[2]); /* Logical block address 0 */
+		put_unaligned_be32(1, &cmd[10]);/* Transfer 1 logical block */
+	} else {
+		cmd[0] = READ_10;
+		put_unaligned_be32(0, &cmd[2]); /* Logical block address 0 */
+		put_unaligned_be16(1, &cmd[7]);	/* Transfer 1 logical block */
+	}
 
 	scsi_execute_cmd(sdkp->device, cmd, REQ_OP_DRV_IN, buffer, buf_len,
 			 SD_TIMEOUT, sdkp->max_retries, NULL);

  reply	other threads:[~2024-05-31  1:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-25 10:02 [Bug 218890] New: reset SuperSpeed USB device number 2 using xhci_hcd bugzilla-daemon
2024-05-25 13:54 ` [Bug 218890] " bugzilla-daemon
2024-05-28  0:19 ` bugzilla-daemon
2024-05-28  1:08 ` bugzilla-daemon
2024-05-28  9:02 ` bugzilla-daemon
2024-05-29 10:40 ` bugzilla-daemon
2024-05-29 11:38 ` bugzilla-daemon
2024-05-29 11:39 ` bugzilla-daemon
2024-05-29 11:46 ` bugzilla-daemon
2024-05-29 15:39 ` bugzilla-daemon
2024-05-29 15:42 ` bugzilla-daemon
2024-05-30 11:44 ` bugzilla-daemon
2024-05-30 15:20 ` bugzilla-daemon
2024-05-30 15:28 ` bugzilla-daemon
2024-05-30 17:08 ` bugzilla-daemon
2024-05-30 19:03   ` Alan Stern
2024-05-31  1:44     ` Martin K. Petersen [this message]
2024-05-31  8:39       ` Pierre Tomon
2024-06-04 12:49         ` Mathias Nyman
2024-05-30 18:55 ` bugzilla-daemon
2024-06-20 13:56 ` bugzilla-daemon
2024-06-21 19:53 ` bugzilla-daemon

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=yq1ikyueoz8.fsf@ca-mkp.ca.oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pierretom+12@ik.me \
    --cc=stern@rowland.harvard.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).