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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9A45C6FA82 for ; Tue, 20 Sep 2022 19:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=LNbemxru3L2hFlqgo1T4V9ZdsALhlrWUh7qwjPGj19g=; b=DmARmPCxpoGdU6qB+q0/7nXVqa SFerhd2gb9gviK6DMcjAz3euG8t3lMY9BiCaqk8xKrjht/LWWra3yvWFIIVuB5lNTXcnKfx8ITeix P39rgr84y1P6TBbWeKFIjNgX2wX4hoQJpROwCxTYCz/grqKSsVwGRo6cDJiYmEP75umIeCwUIXbAZ Hg8PMXzLq+QcTnyWPulv5uthNfljchHe6r4Ev5iFLmwRkUAF0LHraiar415d385xD0TOAztbkIapc OgRuTqaf/iTAUv/M3cF3cGc1xHLttjIzdUlqQq/MgogdL+rEOJC6B5DMJZYIt2Gr0Lqb8bFQvY8FI TfbG/tMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaimb-005ys9-Jw; Tue, 20 Sep 2022 19:19:49 +0000 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaimY-005ypT-S7 for linux-nvme@lists.infradead.org; Tue, 20 Sep 2022 19:19:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1663701587; x=1695237587; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=LNbemxru3L2hFlqgo1T4V9ZdsALhlrWUh7qwjPGj19g=; b=cOsTlUhxiPlIkMYsukvmpLLcBQW9Fvwvz3Ya8XT30BZjrAwB2qQ0ecM+ 9esO1Wr9wLfUQDQygEisoCoP7j6eIUhAkIX+43sAD2BAORyreT7BPS1em bTIHmtwbZbZkBGhggDu5C8FFXmi9AmzM3s7DkvoGt2l5A2T266sVKFX4o A=; X-IronPort-AV: E=Sophos;i="5.93,331,1654560000"; d="scan'208";a="261342312" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-pdx-2c-90419278.us-west-2.amazon.com) ([10.25.36.210]) by smtp-border-fw-9102.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2022 19:19:41 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2c-90419278.us-west-2.amazon.com (Postfix) with ESMTPS id 2177645A76; Tue, 20 Sep 2022 19:19:40 +0000 (UTC) Received: from EX19D002UWA002.ant.amazon.com (10.13.138.246) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Tue, 20 Sep 2022 19:19:35 +0000 Received: from EX13MTAUEB002.ant.amazon.com (10.43.60.12) by EX19D002UWA002.ant.amazon.com (10.13.138.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1118.12; Tue, 20 Sep 2022 19:19:35 +0000 Received: from dev-dsk-risbhat-2b-8bdc64cd.us-west-2.amazon.com (10.189.73.169) by mail-relay.amazon.com (10.43.60.234) with Microsoft SMTP Server id 15.0.1497.38 via Frontend Transport; Tue, 20 Sep 2022 19:19:34 +0000 Received: by dev-dsk-risbhat-2b-8bdc64cd.us-west-2.amazon.com (Postfix, from userid 22673075) id 6D6402743; Tue, 20 Sep 2022 19:19:33 +0000 (UTC) From: Rishabh Bhatnagar To: , CC: , , , , , Rishabh Bhatnagar Subject: [PATCH] nvme-pci: Set min align mask before calculating max_hw_sectors Date: Tue, 20 Sep 2022 19:19:32 +0000 Message-ID: <20220920191932.22797-1-risbhat@amazon.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220920_121946_994780_D92F23B8 X-CRM114-Status: GOOD ( 11.96 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org 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 --- 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 98864b853eef..30e71e41a0a2 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2834,6 +2834,8 @@ static void nvme_reset_work(struct work_struct *work) nvme_start_admin_queue(&dev->ctrl); } + 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. @@ -2846,7 +2848,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