From patchwork Thu Oct 13 17:58:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rishabh Bhatnagar X-Patchwork-Id: 2283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp424970wrs; Thu, 13 Oct 2022 11:42:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WrKb/6SsrXPlr9pIRosLOE4xiLUw433VYFe6KqiMm+EgCDAM+A0EiUAOz11YuTmA6lgaa X-Received: by 2002:a63:d0:0:b0:45b:b321:46d2 with SMTP id 199-20020a6300d0000000b0045bb32146d2mr1148646pga.250.1665686565744; Thu, 13 Oct 2022 11:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665686565; cv=none; d=google.com; s=arc-20160816; b=QVQ4n3xJ1oxjQNYibRSE5Uc/wri0wAOr7x9bCYschM3k0M2Ryc23H6CS8F1XxUw+KE H1p6H121Z31aKOWR+2euks9+4bwMR7vizwUMl1au0a1xVk9f9fdFXvms4VlXUtxuwtyY HjrcUOHby3n8uI0uDWaXX5rE/MHpo7/t1CR+qrRUubaooRbgjUrefX6Yvf8Q2BCO21Kn s5EePho6g63yDp5g5hsrrVi6QvMpZE5rS4RszozwY5iABOxzzl9AqkcrRGM8MqsGLyw0 cJ1uv615ErgvlV6K86GBF4QzwKUuXpuzV0yWa2J3qL7Yb9Ed7X585hLLotvNajQ9HoIJ +DhQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=dRzHuJsl8Os2tTS3OKSmaE2ICpxem2CI4kFUH6FmEv4=; b=ziCszjp7c6xXlblU7aNSYGh1WKbh1LH58EbMgpq2FBjMU5cmEymSDtLwIywMvmTXi8 0G0Otk+PTn2IV2MnJ192cazZnBhunQapA2D5rIO0/MFdwD9rUlSTI9sKIWEg1zyG9ibj /OpZndwcr2vO5ysbd8lh9Bt8OrCxz70321EHUcUpmEuaZXA7Pzje80hiSlNltw7gGEf1 nI95YZsN4BLj1pfTRILv7YvSQ1xGE0pfMTSLLt22gKaFEf3SPq6sEYITAXQr/OkSRp6g dInJHw8HXss8Y/B+iBq2ESpeNPA9exAh6NmxQexP/BCQHOFtBFfPAWewOfHjD3k9KnRw 4LeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=YSSMsaUp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a654283000000b00452a7b4f50bsi185006pgp.48.2022.10.13.11.42.31; Thu, 13 Oct 2022 11:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=YSSMsaUp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231895AbiJMSQs (ORCPT + 99 others); Thu, 13 Oct 2022 14:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232395AbiJMSOv (ORCPT ); Thu, 13 Oct 2022 14:14:51 -0400 Received: from smtp-fw-2101.amazon.com (smtp-fw-2101.amazon.com [72.21.196.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE07B162536; Thu, 13 Oct 2022 11:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1665684684; x=1697220684; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=dRzHuJsl8Os2tTS3OKSmaE2ICpxem2CI4kFUH6FmEv4=; b=YSSMsaUpJEmpBuoB5d+03iY2NyfPLIsBsEEcd/ffxmAE3xfydF/wBejE HJh/Yh8HQ9TBMRqOhL0pKOKI8dqg9tkf10PNPKObC2pNCzRmLNr+JNgQT fws1kIOUJY8Jlm8kCyRVXzJVDWqHnq74JkoBmO1+v8cjnu9sF3G+jt1Dz 4=; X-IronPort-AV: E=Sophos;i="5.95,182,1661817600"; d="scan'208";a="251701327" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-2a-6fd66c4a.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2022 17:58:39 +0000 Received: from EX13MTAUWC001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2a-6fd66c4a.us-west-2.amazon.com (Postfix) with ESMTPS id 38E75A2737; Thu, 13 Oct 2022 17:58:38 +0000 (UTC) Received: from EX19D002UWC004.ant.amazon.com (10.13.138.186) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 13 Oct 2022 17:58:36 +0000 Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX19D002UWC004.ant.amazon.com (10.13.138.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1118.12; Thu, 13 Oct 2022 17:58:36 +0000 Received: from dev-dsk-risbhat-2b-8bdc64cd.us-west-2.amazon.com (10.189.73.169) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 13 Oct 2022 17:58:36 +0000 Received: by dev-dsk-risbhat-2b-8bdc64cd.us-west-2.amazon.com (Postfix, from userid 22673075) id 812F22859; Thu, 13 Oct 2022 17:58:36 +0000 (UTC) From: Rishabh Bhatnagar To: , CC: , , Rishabh Bhatnagar Subject: [PATCH 5.15 5.10] nvme-pci: set min_align_mask before calculating max_hw_sectors Date: Thu, 13 Oct 2022 17:58:27 +0000 Message-ID: <20221013175827.25295-1-risbhat@amazon.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746598956290585963?= X-GMAIL-MSGID: =?utf-8?q?1746598956290585963?= commit 61ce339f19fabbc3e51237148a7ef6f2270e44fa upstream. If swiotlb is force enabled dma_max_mapping_size ends up calling swiotlb_max_mapping_size which takes into account the min align mask for the device. Set the min align mask for nvme driver before calling dma_max_mapping_size while calculating max hw sectors. Signed-off-by: Rishabh Bhatnagar Signed-off-by: Christoph Hellwig --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index d820131d39b2..e9f3701dda3f 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2732,6 +2732,8 @@ static void nvme_reset_work(struct work_struct *work) if (result) goto out_unlock; + dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1); + /* * Limit the max command size to prevent iod->sg allocations going * over a single page. @@ -2744,7 +2746,6 @@ static void nvme_reset_work(struct work_struct *work) * Don't limit the IOMMU merged segment size. */ dma_set_max_seg_size(dev->dev, 0xffffffff); - dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1); mutex_unlock(&dev->shutdown_lock);