Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2437342pxu; Sat, 28 Nov 2020 14:06:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJylRXi01hfFxf/k7vNhueSSR/eEW/FV7tqxoMjJOwu2bLAn1WQyuBa0aAklnTYzmenbpJMD X-Received: by 2002:a17:906:f196:: with SMTP id gs22mr6401530ejb.526.1606601216126; Sat, 28 Nov 2020 14:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606601216; cv=none; d=google.com; s=arc-20160816; b=ROevI8FQFOOUW42fpza41MU/EHK31vWWiydMfrAzXdhiFUIAqj/KOvz0w8Z1HXMLoa 2Uxxx2vF9hV9LBrxY2nlIDvaOadImK50wdV6XX2oAdNy6dpgO1aTQGsOQtxURKxHjWdq zs5w138tCjbhFiyfctsyDTukmtAc+YWa0xD5DxC7y82YAgZatGtW8RvHskPgimZ5WNvr MGI1ly3rjm2iJqmYbiUP1G451Gr8MzSPhxG+UygshlhyQEoq7je3DLh/LAzgMo3873IQ 5Nq4zSTz9JMk0Lvlpv23IefylHh8WiLZVZTaLgo+AhbNDl9Nv7Lj+KVUDUA/qtOWAkP4 AdTQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NbAVYycY6YOfQw07HUrLEWpQeZLRTY8vh8sqwjHNiYY=; b=UdY7zNTGZm29jIENGhGvheOHiSgeEaBsTek1wZKXckThs/t14EPbjHqUw7zrR8VYQ1 Ha7llT/3A4bS6iYvZ/yv7rMQdhAwAAavohbIvL8tNRL8/1O/za6TmlX8G83uwmVdM0nw CA9dgBskd8L6D8Y3fsaCL7IcX/oKL80NFuN0BrATt7x+FRZkCm0vmNVIHLr2qTEE/nit X7tlAhfvEphZ30L+aAsjHMGzp0xqQ3TqZvsF/asoCIKxqqS1Fa1x3v0qD5Fp5MQMUYSc 5C7g1y3SJlJW8YOXkRLDqi3dCjxZOVT1cLJXwLh+mTo5CI0Lwem8OG3RwcBFqeL7vykH 488Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DtROul4b; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si7598952ejz.538.2020.11.28.14.06.32; Sat, 28 Nov 2020 14:06:56 -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=@gmail.com header.s=20161025 header.b=DtROul4b; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732209AbgK1Vuj (ORCPT + 99 others); Sat, 28 Nov 2020 16:50:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733298AbgK1SR6 (ORCPT ); Sat, 28 Nov 2020 13:17:58 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E583AC0258E3; Sat, 28 Nov 2020 07:49:07 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id w6so7091854pfu.1; Sat, 28 Nov 2020 07:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NbAVYycY6YOfQw07HUrLEWpQeZLRTY8vh8sqwjHNiYY=; b=DtROul4bAe96EerB/u5UR8/qYs4S5tUL/0CAxmjLJHQNZu7mtMPSnynDuIWhq7jz6M MEpzCCOV5BDoML+9aa4z8ZDgQVrrVZIq6A8S+inZtG2XWw4AF5dHQ+iwbSjZRo2HMtw8 kNw52H7bxje5MRPxTo/J1uOUaCGhIN/Xekmn0Eg6XeDKOM5U98+tlsGv7RmwbVoaGc2n OovuXXNsucrO5GEQxA2bGRyfo0SoTyir4sLw9QrJTxcHNsyRsayfhr30k22vxg7NTle6 kI3Mmh0bkUc1wrwFaBWvbRfJS/eF2q7EjrDdWk0cojd6jDhcGZVWRqaXrua0iT+AwAah IKCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NbAVYycY6YOfQw07HUrLEWpQeZLRTY8vh8sqwjHNiYY=; b=pHmxm4GNnfs8alFm/TurbqONhVx5U7bl6/bLUJlU630HxXHFlgm1sf1LQqPd5uHvsw /2uy1JfE8cfPntEkSWv/pfsCnPOqWxCePnbQQTeX8hdt8gUOqnQGnXica5y4UJWAF4pt 7yS0qf53Lq9pcne8CTyrQg2borV91Pmj5ZHqfJcunS0fV58FbnSBjeAfaWesEW10/XkJ ujtFV1/H1KO3xhxgYziIMJ4YURDy7qZtO5D10JQ7tLxNT2FZrfbr6ZPGUIUN3ZHAwCM6 P8Kn5auFlf6TwhpqVc8dFN4LYsKOa33SFCo57kameDbzrgFCVt4+mc7e3HeWBsV2VjLf lpew== X-Gm-Message-State: AOAM531q0jMeBTZLK5yeNLyI1n+5HlK8gO0tXVvJIO0590Xjc7h1H2dK 5giUPlbKjby5UBTMAdI/h30= X-Received: by 2002:a17:90a:bc83:: with SMTP id x3mr16905963pjr.90.1606578547558; Sat, 28 Nov 2020 07:49:07 -0800 (PST) Received: from localhost.localdomain ([161.81.68.216]) by smtp.gmail.com with ESMTPSA id r15sm15633028pjp.51.2020.11.28.07.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Nov 2020 07:49:06 -0800 (PST) From: Tom Yan To: hdegoede@redhat.com, hch@lst.de, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org Cc: mathias.nyman@intel.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, baolu.lu@linux.intel.com, Tom Yan Subject: [PATCH 2/2] usb-storage: revert from scsi_add_host_with_dma() to scsi_add_host() Date: Sat, 28 Nov 2020 23:48:49 +0800 Message-Id: <20201128154849.3193-2-tom.ty89@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201128154849.3193-1-tom.ty89@gmail.com> References: <09992cec-65e4-2757-aae6-8fb02a42f961@redhat.com> <20201128154849.3193-1-tom.ty89@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While the change only seemed to have caused issue on uas drives, we probably want to avoid it in the usb-storage driver as well, until we are sure it is the right thing to do. Signed-off-by: Tom Yan --- drivers/usb/storage/scsiglue.c | 40 +++++++++++++++++----------------- drivers/usb/storage/usb.c | 3 +-- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 560efd1479ba..6539bae1c188 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -92,7 +92,7 @@ static int slave_alloc (struct scsi_device *sdev) static int slave_configure(struct scsi_device *sdev) { struct us_data *us = host_to_us(sdev->host); - struct device *dev = sdev->host->dma_dev; + struct device *dev = us->pusb_dev->bus->sysdev; /* * Many devices have trouble transferring more than 32KB at a time, @@ -120,6 +120,25 @@ static int slave_configure(struct scsi_device *sdev) * better throughput on most devices. */ blk_queue_max_hw_sectors(sdev->request_queue, 2048); + } else { + /* + * Limit the total size of a transfer to 120 KB. + * + * Some devices are known to choke with anything larger. It seems like + * the problem stems from the fact that original IDE controllers had + * only an 8-bit register to hold the number of sectors in one transfer + * and even those couldn't handle a full 256 sectors. + * + * Because we want to make sure we interoperate with as many devices as + * possible, we will maintain a 240 sector transfer size limit for USB + * Mass Storage devices. + * + * Tests show that other operating have similar limits with Microsoft + * Windows 7 limiting transfers to 128 sectors for both USB2 and USB3 + * and Apple Mac OS X 10.11 limiting transfers to 256 sectors for USB2 + * and 2048 for USB3 devices. + */ + blk_queue_max_hw_sectors(sdev->request_queue, 240); } /* @@ -627,25 +646,6 @@ static const struct scsi_host_template usb_stor_host_template = { .sg_tablesize = SG_MAX_SEGMENTS, - /* - * Limit the total size of a transfer to 120 KB. - * - * Some devices are known to choke with anything larger. It seems like - * the problem stems from the fact that original IDE controllers had - * only an 8-bit register to hold the number of sectors in one transfer - * and even those couldn't handle a full 256 sectors. - * - * Because we want to make sure we interoperate with as many devices as - * possible, we will maintain a 240 sector transfer size limit for USB - * Mass Storage devices. - * - * Tests show that other operating have similar limits with Microsoft - * Windows 7 limiting transfers to 128 sectors for both USB2 and USB3 - * and Apple Mac OS X 10.11 limiting transfers to 256 sectors for USB2 - * and 2048 for USB3 devices. - */ - .max_sectors = 240, - /* emulated HBA */ .emulated = 1, diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index c2ef367cf257..f177da4ff1bc 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -1050,8 +1050,7 @@ int usb_stor_probe2(struct us_data *us) usb_autopm_get_interface_no_resume(us->pusb_intf); snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", dev_name(dev)); - result = scsi_add_host_with_dma(us_to_host(us), dev, - us->pusb_dev->bus->sysdev); + result = scsi_add_host(us_to_host(us), dev); if (result) { dev_warn(dev, "Unable to add the scsi host\n"); -- 2.29.2