From patchwork Mon Oct 24 11:27:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp637287wru; Mon, 24 Oct 2022 13:24:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MmF9fXnrm2UXjVbgiDCmIzo69QBNvu7o+e3SS9B1RMgHZQsfy8+7U6PW/Zlb0knveSi51 X-Received: by 2002:aa7:d385:0:b0:461:8cd3:b38b with SMTP id x5-20020aa7d385000000b004618cd3b38bmr11523769edq.172.1666643039827; Mon, 24 Oct 2022 13:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643039; cv=none; d=google.com; s=arc-20160816; b=SqgVL5mEjQGb65xkb77FDZ8hBtOZTbqFVppDzH5WIUJyeflOyyYXR0Xw0aWJxzQuLX Ux5xk9GrAUb3O4Sb2cBqDJI0sWi19jd2FXsJvzDExx2jphYZjX5cFxYOwojk5GvYx+5x 9grSoANlnfqeyDFEk9KPwly13wSmic4a7ILEThovLQ0DzUQYG1OtxH1NVFHLqDBNXrln ap1hURDdEDibHa7gD6jddz1dyFIH0x09BkgUefDmG+r4vovVzq3yaBxKpqQ6Mf/AHaQc +60KXqPMTB/L6cgUaH3cYCuRq2rW0CwSiOupsXnK25vJaoDuTGxlLbpdUANFeTQdWKbO 3ISw== 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=hcGYiMlPvuQII6VixFbASPaNdGwELsqOqc7aw+edUhg=; b=GyAY+1zMLRA0Crl0betAKxWh+FihM1Zv8JzbIbwYl1gSn69oNdwN+RL2tv3qcHIbRq Pk5VzRXZ0eHFFaGLa3VZ+L38X9D5dvbp/1J2yhtkocxL/ex/taymkGh8NolftHlznsC2 BW8syoh4fZ8/kXHCQPPEZXx483JC09/9sCIawiFTR1sXaLLNjnD25ssS/5B9UHL991qP +qZdtbtD+k10fx117HxmzfC9uhyrapZANQlMwrf0U5vCBTlX3SWlNAtSQ9GcMX4glMgW 8LIbMuj5ep6n10hrjwv1zHNplUJMjWxcnJlnttOabO4Xy+WlCEE1Z7nwWi2SBqGR83uN XjQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OYCfn9UW; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a056402521200b0045ca15afe1csi626307edd.553.2022.10.24.13.23.32; Mon, 24 Oct 2022 13:23:59 -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=OYCfn9UW; 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 S233988AbiJXUOe (ORCPT + 99 others); Mon, 24 Oct 2022 16:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbiJXUNj (ORCPT ); Mon, 24 Oct 2022 16:13:39 -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 9849D981F6; Mon, 24 Oct 2022 11:32:00 -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 4CE73B81598; Mon, 24 Oct 2022 12:17:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A38CC433C1; Mon, 24 Oct 2022 12:17:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613853; bh=adJuxEBQxYEv/I8sxZnRSjADWw+N27RR7P06eLcjfnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYCfn9UWQVbvCwKwSQQWwSwDziR+BiKBJrh/yw8qaNwxsmy5Du7BlMFrrnWbhSSrG 8YCxkzfY29iEpGGMmgSjVwTLwRMV2VAv3Yt32kwXn3gN0qYp1wEphihTTtUYdtM/0w qhf5DVlNdDt/pIqe2zzirs8nAgti+phKJBUhoA44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rishabh Bhatnagar , Christoph Hellwig Subject: [PATCH 5.10 038/390] nvme-pci: set min_align_mask before calculating max_hw_sectors Date: Mon, 24 Oct 2022 13:27:15 +0200 Message-Id: <20221024113024.232587126@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601892289109655?= X-GMAIL-MSGID: =?utf-8?q?1747601892289109655?= 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 @@ -2624,6 +2624,8 @@ static void nvme_reset_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. @@ -2636,7 +2638,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);