Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1347758rwi; Thu, 13 Oct 2022 12:21:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Gdnyfv852wtledSOUL6MjlKEGKxmHZHY1DSC59G7iW/WKicEWN8BkEcCcq2NvcFIzCR7I X-Received: by 2002:a17:902:b68f:b0:178:627d:b38d with SMTP id c15-20020a170902b68f00b00178627db38dmr1396687pls.87.1665688918897; Thu, 13 Oct 2022 12:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665688918; cv=none; d=google.com; s=arc-20160816; b=YVWK9cHkQQs6YQEVxHzcoInFFJ6bJLmEh4y+hq+E/GoGl0yPlDH84+/GboKf23OFRQ EuGac1x1/oVj6PH3FzzUj5+Rfe7H3xrAW2m6dCoHfg9dZ23FHoSemuC7wkVFLGcO3C2D AbeSE3DT0D78z6kRgFgUXZ2RdAnZrGThzWKgn6E2aMPrxB+WEUOudCOAx0BlyGOVOQcG ebSz+7eVOflp0ricAF0AUyw9AoEMUzeVODVDl13N8iwcCLlnmmtrJoTm1Ish1yHDDpJB qOEamZNeN5a2V+rU7JsXkFWt2PAF853q2u12Dsn02V6KiK7LyhIrXGXgg6zGTN4o+/y7 ph/w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XxjXhrWHKuPUbWIkGQrYEY47pB2FGtQhMwG/QEXYx5U=; b=ck7yyq/H4tWZ9FaD9u6eyCLOIckRiS4ZNcMBKT4S7vlnagSPByghcIK8f/dXpz3vO1 W0eV/H+7lttlWXerZ7HbrNA747/vJwHNaCh46hk27Lsq+g5KwC2a6vPPrrUIGTpAKQLq YPaL7HTZT0ZoxdAHOHlb1aKsSwKCGbslME8WJ5WFA4BcZkOd0braUnndTsqliS8SzaFl CcUjFPAmq12Z6AgfCrOjpoWC5n5G2iepeB3no2Wx7SF25Wrz7DjqYMCBgaUSAz3VT+9f IKjJUIHyoZ/ps1ffoxJCfLRV0/D02lRYSHPIBzxdWQEnkjZ92+aTeX1ihzXIUdKstMLX hCXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=esBj9o9Q; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp8-20020a17090b190800b002057a08d66asi367897pjb.23.2022.10.13.12.21.42; Thu, 13 Oct 2022 12:21:58 -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=@linuxfoundation.org header.s=korg header.b=esBj9o9Q; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231828AbiJMSMu (ORCPT + 99 others); Thu, 13 Oct 2022 14:12:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231744AbiJMSMZ (ORCPT ); Thu, 13 Oct 2022 14:12:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63DEE16339A; Thu, 13 Oct 2022 11:09:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B3202B820BD; Thu, 13 Oct 2022 18:02:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1154CC433C1; Thu, 13 Oct 2022 18:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665684121; bh=7CXu2ISfdtjdID+KmuZSU74Aw/Of9Rg1gzLUSEkIXD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=esBj9o9QwKUYW3HxyTi29nz33ostwSdLa3vB14kPwL69+zk/aetx9Rbu8YDaVheZg 97V5emVVYhyb3u9AujXle0uovdOPVgm7+BcT2gxhu9d+rfxqMrWsSZX2PYfB8UhHDR DelxzRcHCvnK95Xf6VZkF5uuWE2TdB4muIQkeZ64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rishabh Bhatnagar , Christoph Hellwig Subject: [PATCH 6.0 05/34] nvme-pci: set min_align_mask before calculating max_hw_sectors Date: Thu, 13 Oct 2022 19:52:43 +0200 Message-Id: <20221013175146.661543716@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175146.507746257@linuxfoundation.org> References: <20221013175146.507746257@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Rishabh Bhatnagar 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 Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2834,6 +2834,8 @@ static void nvme_reset_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_ * 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);