Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4357569rwb; Tue, 20 Sep 2022 12:41:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZUvHL5+PuJW7or2ftSvVDw4TdeL0R/TFwuXju/ggYxG8TtYVHMyVRN+hF7aYxrh4kHfMX X-Received: by 2002:a17:906:8a6f:b0:780:96b4:d19e with SMTP id hy15-20020a1709068a6f00b0078096b4d19emr17189616ejc.624.1663702860243; Tue, 20 Sep 2022 12:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663702860; cv=none; d=google.com; s=arc-20160816; b=hTvN2lDJYptr9kN3cxhrwHWmcTVmL+KhrkI+azx+JmAcEq6LlxDE5pW3hxU2hc/1sJ fu3vcbMpEkqY2KRO1AySOQimaJyuaHS+iZqRDWVRyXZ3VKUmQIlS9l+0fEHDOV+sQ6nz ZZKgl2Bj7SGB2Z6hmXWbKto60+3Fs5TM569XG5mJouGyvB9cU5alGxkY2wgUM878WRuI TcdXXWVegF5Wsg/bFCGBQbT2u1fqx2esPoqG2doFI1y5H7POK+QIECPst1M/x2Jj1nBB qZMyMrckQsfeq9rIKz/9eyvTckzhavdjFUknByI7Bir+4KMQ3bqyOh1iqquj5LN3XEFe p0Fg== 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=LNbemxru3L2hFlqgo1T4V9ZdsALhlrWUh7qwjPGj19g=; b=V3zoe1i9F7U2X5npTUq3KFUV57Ix5HhLWJp7Ugb2ifBDKDASckPN1eeTC1zXIcHUE6 ooDu+Wdm7kYJD9u/VbphzUTNGPAhiEV0mDoRebrMhqhmlTq/ZprVEKUothXPU4soz+H9 r9zDPWdGya8f2xXK3Z8VByTDikBh2XD3fNnwsNzqCI8kJFOB21dKTOHOMv5ta+pIwp/f NZPYwD5QLDPY8IO/bPcJeiepJ6UPrm/FMWZaUwvfWqcpQObBOFeNZBNEd9L9pb0vB/n8 F4lRHV86B598ybS48MXJpjieuxJ2zZWqg6/0DU3I5q2hVQZIyhXRNsnpu+7Ek0zNoZYq sjMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="P7k/O1DE"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a170906975600b007313312730esi628399ejy.85.2022.09.20.12.40.34; Tue, 20 Sep 2022 12:41:00 -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="P7k/O1DE"; 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 S231168AbiITTTq (ORCPT + 99 others); Tue, 20 Sep 2022 15:19:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbiITTTm (ORCPT ); Tue, 20 Sep 2022 15:19:42 -0400 Received: from smtp-fw-9102.amazon.com (smtp-fw-9102.amazon.com [207.171.184.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A52D1903E for ; Tue, 20 Sep 2022 12:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1663701582; x=1695237582; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=LNbemxru3L2hFlqgo1T4V9ZdsALhlrWUh7qwjPGj19g=; b=P7k/O1DE4z31rvUR+e3RoCidFpivMkXRgmR7STICwRq3kRS5o9hLmXOq fpyXprPtaLdd7gp4rZXopZiic9uhLmIbbM807LpaJxkVJi+rrrIqiKB/2 Btzw6OW/yBAyGojhg4I1RrGOPbaQdCPVhYkZlOofzA3wQKvKa0Ws23fvv w=; 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-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H2,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 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