From patchwork Wed Dec 7 20:46:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asutosh Das X-Patchwork-Id: 31042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp397717wrr; Wed, 7 Dec 2022 12:50:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf45XFo8yPrfcNnolNJRSTrKhZYCuqTvFNdrNdJeX1v0GkR/ieccto64EHPX9M7TRpBjgHBF X-Received: by 2002:a17:902:ec04:b0:189:8c37:6f17 with SMTP id l4-20020a170902ec0400b001898c376f17mr48484044pld.67.1670446202567; Wed, 07 Dec 2022 12:50:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670446202; cv=none; d=google.com; s=arc-20160816; b=Rhcz3cfgf24QcHqqfHPqHVDpMeVcPbsFlZOgx05PPWn9jRFvf34jVCWklGdalK7DXi FvEYJxOaj1bHGODtMsrq3rMPz7eGkH/64idIgYMBx0URC6ZUxFRRO1Qsw6ZqGRvG5s41 Q7v8eGoWXJ+rCEN5eK9SbjiollfoHqi0A/3W5VP74DfBoxMPdw/UdQQpKR0cy9nStfKk If9NaqfMUZZrIv0GOjuL1rTP+29lpMJZF/DAvFE6la9fEDcpn3oap8/dRJBlaI6RVOvf R8ihxj+6EUkR0wJQONGZv9ayxS9cm/qyBHA1ChSH/PuQllU017TKzu+D7vvO9IkSRyjO 4AdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=v/zRX5brnhFn2VsvDnEdtw/cPH4pi8o8AfKrkRUJDVY=; b=dMu9fppLBOPf3cv72GnPpgnnNxuxoSOpSiObMnsAg2UsV8fL4WGCnN0FAOAz61Bm8u VMeWzSEaJykSEJH/WDOT6j8TeKtyZ//D8JqYDzBKkoYGP6+RlwIE3SfQZ5RaPIUPawB+ HvWtfYblL603qR5ZNsfCPPM6BQn7aOG2/wQArYMchdmOEyHOevYZLHX0sBiABaEn7XET JE38D8QsyTZXQ8LKV9xkIM2UW7q5bAXKL9r5aceu1IQ2ddZU0nZemNEHTowZCh6+NsGI SjeZzCBAGIu/y/oJSFjltlCn+j0qLepCwpYT5qmiKr1n5CRd0V/RceTm3ONQQMNt0cbo IlnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=eidgwvQ1; 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=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a170902a3c800b00189c99d6ae6si11999307plb.505.2022.12.07.12.49.49; Wed, 07 Dec 2022 12:50:02 -0800 (PST) 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=@quicinc.com header.s=qcdkim header.b=eidgwvQ1; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbiLGUtf (ORCPT + 99 others); Wed, 7 Dec 2022 15:49:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229928AbiLGUtE (ORCPT ); Wed, 7 Dec 2022 15:49:04 -0500 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C801D6E55F; Wed, 7 Dec 2022 12:48:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1670446109; x=1701982109; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=v/zRX5brnhFn2VsvDnEdtw/cPH4pi8o8AfKrkRUJDVY=; b=eidgwvQ1AcPaaFCdG0qRnx+I++rmqJDjgeKg3GlT6pCDMMdPA3UvLECj rYrGF6OuaMRrH+HNm40jIPlugV+EWm3UDVaVJp57Zdwr6BTxhD/JCZIuD 4rPEk4C2WIwoSbPCeDlYh78+g9WdLFhq1n9GMwLVTguMxd+9BxaXJADy5 g=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 07 Dec 2022 12:48:29 -0800 X-QCInternal: smtphost Received: from unknown (HELO nasanex01a.na.qualcomm.com) ([10.52.223.231]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2022 12:48:29 -0800 Received: from asutoshd-linux1.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 7 Dec 2022 12:48:29 -0800 From: Asutosh Das To: , , CC: , , , , , , , , , Asutosh Das , , Alim Akhtar , "James E.J. Bottomley" , Jinyoung Choi , open list Subject: [PATCH v10 10/16] ufs: core: mcq: Use shared tags for MCQ mode Date: Wed, 7 Dec 2022 12:46:21 -0800 Message-ID: <96084be6bc6259fb62ab61cfbc31159bba235bba.1670445699.git.quic_asutoshd@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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?1751589797280524597?= X-GMAIL-MSGID: =?utf-8?q?1751589797280524597?= Enable shared tags for MCQ. For UFS, this should not have a huge performance impact. It however simplifies the MCQ implementation and reuses most of the existing code in the issue and completion path. Also add multiple queue mapping to map_queue(). Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam --- drivers/ufs/core/ufs-mcq.c | 2 ++ drivers/ufs/core/ufshcd.c | 28 ++++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c index 496e2b6..8bf222f 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -280,6 +280,7 @@ void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba) int ufshcd_mcq_init(struct ufs_hba *hba) { + struct Scsi_Host *host = hba->host; struct ufs_hw_queue *hwq; int ret, i; @@ -315,5 +316,6 @@ int ufshcd_mcq_init(struct ufs_hba *hba) /* Give dev_cmd_queue the minimal number of entries */ hba->dev_cmd_queue->max_entries = MAX_DEV_CMD_ENTRIES; + host->host_tagset = 1; return 0; } diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 5d14d3f..21cfa37 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2763,24 +2763,28 @@ static inline bool is_device_wlun(struct scsi_device *sdev) */ static void ufshcd_map_queues(struct Scsi_Host *shost) { - int i; + struct ufs_hba *hba = shost_priv(shost); + int i, queue_offset = 0; + + if (!is_mcq_supported(hba)) { + hba->nr_queues[HCTX_TYPE_DEFAULT] = 1; + hba->nr_queues[HCTX_TYPE_READ] = 0; + hba->nr_queues[HCTX_TYPE_POLL] = 1; + hba->nr_hw_queues = 1; + } for (i = 0; i < shost->nr_maps; i++) { struct blk_mq_queue_map *map = &shost->tag_set.map[i]; - switch (i) { - case HCTX_TYPE_DEFAULT: - case HCTX_TYPE_POLL: - map->nr_queues = 1; - break; - case HCTX_TYPE_READ: - map->nr_queues = 0; + map->nr_queues = hba->nr_queues[i]; + if (!map->nr_queues) continue; - default: - WARN_ON_ONCE(true); - } - map->queue_offset = 0; + map->queue_offset = queue_offset; + if (i == HCTX_TYPE_POLL && !is_mcq_supported(hba)) + map->queue_offset = 0; + blk_mq_map_queues(map); + queue_offset += map->nr_queues; } }