Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2878896pxu; Sat, 19 Dec 2020 05:07:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDvIpVLpqpj7h5CphW4lE7h49Brz0yrr1/KvVc7ELP2tGW+ZMb6Fb8m+xvlcgIWYt8D8me X-Received: by 2002:a05:6402:a45:: with SMTP id bt5mr8768473edb.130.1608383242335; Sat, 19 Dec 2020 05:07:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608383242; cv=none; d=google.com; s=arc-20160816; b=g3TbUiS2cVHn24VKiL7fXwCKH8vuiVyKZ5y0XfExIRdLMIRiWJicnyb4ift9VE0q14 uspPdi6HA6q9t44WTstdkiz/neJiLux8Fpv5lBgcm4qBULmkoJvr6hziGULDs+vl/IcQ BogIj9jbsZokYsJ8clkJrqcGhrB0pio4tVGZje8kbjPTL91SSBblUxPuXn0vmGKOUhOw ieY4sARQf/x6kpn4gSCU5G6rZvouSalJsfh5399POn2feTAIx2YjXTMPMhSYlhx4Lu09 dfm7OfiXZuKG7esVVhCxous5Q4SnOjNi8Grt6p66AAWuj5YDXWFYoOCouTTacAiv9y+I Z3jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=GJofgj4WhT40KP8zPAMluqbjDO/r860HO2QiXj8jzww=; b=p/R7767Tm5vv5C/rzdhy13o5k5RkXwoKe9WCS0NUzQwMACMAdNCSYez03iMTYxUf6+ T7ORqZ+Nb8xR1uMSMJMEuA9/m0ONNsH9S25G64TrHhDXtls3eoZsJrBXz1O6Y82VXMKG ZWfA1adNtv3vLwXhUBRqqPbGnRFUjbEvx0FCAA6kwQJO+paBNL9YOxZwikrOcEMpWM0H vchGA9qioI+SihpmYi7/sreOu8FKCY/U2cf2ZdY+OSN29JpRlLqAWkS+DV9OzBGeDuGx BTAtyIBNKPPUMUwJUzsy2GQrprEhHw+TaMD/2GuUIYf2dA633wLOwGWjTadQd/8BP8pc A7wg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr6si6721969ejc.319.2020.12.19.05.06.59; Sat, 19 Dec 2020 05:07:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728380AbgLSNFT (ORCPT + 99 others); Sat, 19 Dec 2020 08:05:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:52452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728967AbgLSNE3 (ORCPT ); Sat, 19 Dec 2020 08:04:29 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David C. Partridge" , Oliver Neukum Subject: [PATCH 5.4 26/34] USB: UAS: introduce a quirk to set no_write_same Date: Sat, 19 Dec 2020 14:03:23 +0100 Message-Id: <20201219125342.681392977@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125341.384025953@linuxfoundation.org> References: <20201219125341.384025953@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oliver Neukum commit 8010622c86ca5bb44bc98492f5968726fc7c7a21 upstream. UAS does not share the pessimistic assumption storage is making that devices cannot deal with WRITE_SAME. A few devices supported by UAS, are reported to not deal well with WRITE_SAME. Those need a quirk. Add it to the device that needs it. Reported-by: David C. Partridge Signed-off-by: Oliver Neukum Cc: stable Link: https://lore.kernel.org/r/20201209152639.9195-1-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman --- Documentation/admin-guide/kernel-parameters.txt | 1 + drivers/usb/storage/uas.c | 3 +++ drivers/usb/storage/unusual_uas.h | 7 +++++-- drivers/usb/storage/usb.c | 3 +++ include/linux/usb_usual.h | 2 ++ 5 files changed, 14 insertions(+), 2 deletions(-) --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5151,6 +5151,7 @@ device); j = NO_REPORT_LUNS (don't use report luns command, uas only); + k = NO_SAME (do not use WRITE_SAME, uas only) l = NOT_LOCKABLE (don't try to lock and unlock ejectable media, not on uas); m = MAX_SECTORS_64 (don't transfer more --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -867,6 +867,9 @@ static int uas_slave_configure(struct sc if (devinfo->flags & US_FL_NO_READ_CAPACITY_16) sdev->no_read_capacity_16 = 1; + /* Some disks cannot handle WRITE_SAME */ + if (devinfo->flags & US_FL_NO_SAME) + sdev->no_write_same = 1; /* * Some disks return the total number of blocks in response * to READ CAPACITY rather than the highest block number. --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -35,12 +35,15 @@ UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_OPCODES), -/* Reported-by: Julian Groß */ +/* + * Initially Reported-by: Julian Groß + * Further reports David C. Partridge + */ UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999, "LaCie", "2Big Quadra USB3", USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_NO_REPORT_OPCODES), + US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), /* * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -541,6 +541,9 @@ void usb_stor_adjust_quirks(struct usb_d case 'j': f |= US_FL_NO_REPORT_LUNS; break; + case 'k': + f |= US_FL_NO_SAME; + break; case 'l': f |= US_FL_NOT_LOCKABLE; break; --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h @@ -84,6 +84,8 @@ /* Cannot handle REPORT_LUNS */ \ US_FLAG(ALWAYS_SYNC, 0x20000000) \ /* lies about caching, so always sync */ \ + US_FLAG(NO_SAME, 0x40000000) \ + /* Cannot handle WRITE_SAME */ \ #define US_FLAG(name, value) US_FL_##name = value , enum { US_DO_ALL_FLAGS };