From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEEBCC4332F for ; Thu, 13 Oct 2022 18:16:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231843AbiJMSQZ (ORCPT ); Thu, 13 Oct 2022 14:16:25 -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 Content-Transfer-Encoding: 8bit Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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); -- 2.37.1