Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9176619pxu; Mon, 28 Dec 2020 08:29:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyA7jSKVtfch2iflTMF4syu2R1P23lhcyX3mFpqo8BZt7v2VndzOD5ja4xtx+KeNaqGRHfi X-Received: by 2002:a50:e84d:: with SMTP id k13mr41950694edn.154.1609172952612; Mon, 28 Dec 2020 08:29:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172952; cv=none; d=google.com; s=arc-20160816; b=etfIK/GLxzo6WFByZMKfH5aRapcOL40xr4kwjp46kKhaf2oqR+c4TW6jNMeg8343tO ILby/nwh6fyvTY8GHM4rLx+y4QikmxBHLIauKHpwHbqX7ckmnmLBuqsIDnu0GrnHo2tR R+SCMZqZui8ciXldTsyk07lJkRQB9r7OOuf+nypmrFT8s/zZDCoSFmvRFDP0T/yqsPpk Mr6WWozsDgAu5pxEEgPQRD6pEWQP95RVj9kjpytAc68yLr4mO+ZV+1D4dBmcgmHCZtNC LG8L+RaZk3ZWzrkxews3ydO5nrMflY/Ucsnbp2sXtrdKorHXMGO7ZLD2/2kBYI/xs+d0 Dn4Q== 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:dkim-signature; bh=gq5aslaKiw3Rn2LmqAUdZjMlZiFEDGEBS0zpCNOy3lA=; b=YV1Opd2Sa24UzAdAfMUNOIGjPs0k685z9M1P0SrLJ3jekwwbJdQ/Ns4sOIBUKml2JI zgM16oArf8mlvJV27i4UQW5QUgojn6knMC/bhcorfESBpjgkuZfRfqVe9WqHz99/h3b2 +lmLYkWU0AmFBWfOHherOeOsrMZAlnFXDv51YFzvV0unnUtux1cpMec26lwdtUWCgVRy pG+wi9DEz/xquGERHyBaSY2eMh+LbkMruBrVQ/1RhXO7TUpWIywii5A9mXJyOMulEz7A tFpvjMrcEwwP+bsq5Zy5aOMvHBBYfmsNX1xCgGPBqjwiuZHICuc5N8pbkvhB/hyP+7ui SYnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AgdvCQDV; 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=pass (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 r19si18312232ejz.538.2020.12.28.08.28.49; Mon, 28 Dec 2020 08:29:12 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AgdvCQDV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633435AbgL1Q1P (ORCPT + 99 others); Mon, 28 Dec 2020 11:27:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:35794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730931AbgL1NI3 (ORCPT ); Mon, 28 Dec 2020 08:08:29 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C40ED208D5; Mon, 28 Dec 2020 13:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160893; bh=Am9tqM0lKKD6uci1Da0JoZ1NLdJQ/cuTeKzWKF9NlJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgdvCQDVYeyJFgRk5ShOhNgfs0LcCjtM87MU/jyee47R0klIv2Zavvc1BMRWPDwMf 1cVQT5bJvufKjFWbVEuNhsKWMQi1N3rj8W7fXTSmlwwUgW3D/Cj//Hw+Kh7LfujBIV Dri6LHIhjDRRkIFU2hSTYvLSeNvCGD5Nrc1z4qqg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David C. Partridge" , Oliver Neukum Subject: [PATCH 4.14 030/242] USB: UAS: introduce a quirk to set no_write_same Date: Mon, 28 Dec 2020 13:47:15 +0100 Message-Id: <20201228124906.146699673@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 @@ -4750,6 +4750,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 @@ -874,6 +874,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 @@ -48,12 +48,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 @@ -557,6 +557,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 };