Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2880514pxu; Sat, 19 Dec 2020 05:09:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJx58RdtaREJwqJ9ngDGkzVPsacg17nt4JSdJpg+xEjqJ/R393lMWqnxxHgFs/JgDWUdC8Ny X-Received: by 2002:a17:906:13da:: with SMTP id g26mr8256590ejc.285.1608383391409; Sat, 19 Dec 2020 05:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608383391; cv=none; d=google.com; s=arc-20160816; b=BVzzmbRNKP/VnRNkdBs6tiJMCpTGq0f626BnPNli5JjhCQDAapJOTfu6Lle8pFFw/U jA/PPFpopoLffeVoO8KRYFVMwSVHkhQ0umwHIKeyzJsY6DmGOWuw3GeUbdgUGEQuOEZg sEG68jSitSTQv+/2QcTGDHtrA5hjmDfntdhr6/YWOFB8PDsH7h4TPxjh7+uWNMDwmBOH PWjX4eRSX1yJqHLbDEQj12LGVxsnWOvzlXDmS24OvvWDj6eVmw8xI7G23E3Tk/o0eucF efw+iAVnEZ2eUyPTx4WVajQ2ygJp3n7DzyKiC1f9ddGvjbryVYQ30ATc6CBxhQDd1MAP UT9w== 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=ALe1VQWlX9lHakumCifCQKcN+0ULZwtuE3a/zehzC8c=; b=ptbweNJC1bloSh4W+Pc3Ngip50SPA8BOGjcVMvkQQTVlo33YTIICpAmUXCZbSwLkUH 4fBLVgmGLTU7RdCzxRs+MVoslS8pfrtZ2mELuTOfiEepLVP/6za7XtZJfEd+SETvJwP9 OD0W1u2rT0CUwhZ+vCUQBncDNlkDMgJwCJVAo94pMRceGNGKL82fTSyechtdxLVhriMu BdEK/e8uyh5PZ67fEl+Ze4pavHrE0yxmYAiawCsJTkeY/K5ao7PYMxM38oBGbLgi0clW yNV1AagwWeQHqSHztDHga2pOzk8dd+I3DMw0mL8ZEU8UXcXj19FiPK6Kk6QWS8hSeByd 586Q== 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 k9si8880950edv.493.2020.12.19.05.09.29; Sat, 19 Dec 2020 05:09:51 -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 S1728739AbgLSNHv (ORCPT + 99 others); Sat, 19 Dec 2020 08:07:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:44164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727129AbgLSM5e (ORCPT ); Sat, 19 Dec 2020 07:57:34 -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.10 13/16] USB: UAS: introduce a quirk to set no_write_same Date: Sat, 19 Dec 2020 13:57:20 +0100 Message-Id: <20201219125339.721605603@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125339.066340030@linuxfoundation.org> References: <20201219125339.066340030@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 @@ -5663,6 +5663,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 };