From patchwork Wed Nov 9 19:41:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asutosh Das X-Patchwork-Id: 17785 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp528019wru; Wed, 9 Nov 2022 11:46:34 -0800 (PST) X-Google-Smtp-Source: AMsMyM5OsUNshr4mE7DwEaug1HvbK1LmgZgpsuDBD+jd2eQQCruG485U5vXCUFrgipWQlvvobBey X-Received: by 2002:a17:906:9be6:b0:7ad:a73b:40c7 with SMTP id de38-20020a1709069be600b007ada73b40c7mr58197656ejc.483.1668023193977; Wed, 09 Nov 2022 11:46:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668023193; cv=none; d=google.com; s=arc-20160816; b=HffMbgfJELLoVdOrH/XTByqdIoB5VLBz/l1U7T7z1y0l1ssf5AN/2gjOmiDCAC/pxH V645qO85X5On44MXMDvaotOoQUDU+nOfdskdmC/Kt4DPjJZicz6OhpbWP8Rgh5hecc63 XAzrmuZ2fN/abka0Xlf6D7PPjY+q+VoNxE/lbI8/4/fpczGiXDwfeBm4byBeXxETKR8l PLQYeBa6QX080QRzcHLWIiDOSCmrj5CB/Jwn9mEDRUzNhwT5iTBqWYIh9f2FUWEnuoqI x3XfffVkF+WrmgyBzJ67WnU9rdIbqqdpgW944oH+7gcuw236UyQul0gYW6R3Eiy2Zold PtzA== 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=QVBhoCoNhDZ6ImtlBU+muPv6ad4C/YQTP0bUuJvsKl0=; b=oXJ3QqITe56LBFWtA/cgpn9MxY3ThfbM6OuLiO2zqDTWNQaEtR3ojq5glTci18S6lp FzSRCNTs+UhBX/x543Q7Gm6sbh3jloMSzzRYVEBHqkGuEY6VD+LeVUqkDGxJ36slQheH ZXeZE0SvJCcJa6Q0PV8CsAZ/3D02apQTg9j5Az+VrioBkw0QHmABCpOZfbeHExkP6vRp V5vfS5hSxyGbsXXW9JUGBZyt1zo/I1z+AqLfbTy7JLaolRsLsgXqLV4vs3imElhV5HgV TFohCG+xcf4GGrkfaKuWTa/yKs5p8z2LhGTSMWYWse9bD1yrJiKXS6A6ASOskBTr7f0t O/EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Hodqje0N; 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 y9-20020a170906558900b007ae2368c8b7si12541021ejp.138.2022.11.09.11.46.10; Wed, 09 Nov 2022 11:46:33 -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=qcppdkim1 header.b=Hodqje0N; 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 S232068AbiKITpY (ORCPT + 99 others); Wed, 9 Nov 2022 14:45:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232007AbiKITo5 (ORCPT ); Wed, 9 Nov 2022 14:44:57 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C49ED2F384; Wed, 9 Nov 2022 11:44:56 -0800 (PST) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2A9HBMl5018928; Wed, 9 Nov 2022 19:44:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=QVBhoCoNhDZ6ImtlBU+muPv6ad4C/YQTP0bUuJvsKl0=; b=Hodqje0NsxGPOm2ulEHCKkcnmHnO7++Rwy71BzbF/WrgkhumaPs/boDo+/1UMCAp5aUc M2/92v+CJBY6BVnYXMX7RC/HLDt8BC93glK0LXIeJRlVA5xnFY6bNajx2iYUwFu5cNq6 8npDt9Z4CzvpB0tHsctlqIXmhmmZGrTr5DcCWHZqZEYNZ8dzWMsNeH9B70GN/pVtqCt1 HbEP3G29Oo1JAw9xpiCkAnpi0C4P5JmJ+LB55Oz66/YxpiJlExPSiRfiFc0twSPXqo+i w0LxGkxlDDtbGOuuHeehlqlnrKsigJdgvBxsw4iiFR/y61ohutSPBHj9ym0xI/2aPG4c 5w== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3krgbr0gp0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Nov 2022 19:44:46 +0000 Received: from nasanex01a.na.qualcomm.com (corens_vlan604_snip.qualcomm.com [10.53.140.1]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2A9JikuL011754 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 9 Nov 2022 19:44:46 GMT 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.29; Wed, 9 Nov 2022 11:44:45 -0800 From: Asutosh Das To: , , CC: , , , , , , , , , Asutosh Das , , Alim Akhtar , "James E.J. Bottomley" , Jinyoung Choi , open list Subject: [PATCH v4 10/16] ufs: core: mcq: Use shared tags for MCQ mode Date: Wed, 9 Nov 2022 11:41:35 -0800 Message-ID: <9f775b3efe9017c93c86a9879de063c90dfb3ef6.1668022680.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: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: JF53Y5mQSEc9sul_Ce_oAOTx30-V9TTH X-Proofpoint-ORIG-GUID: JF53Y5mQSEc9sul_Ce_oAOTx30-V9TTH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-09_06,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 malwarescore=0 clxscore=1015 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211090149 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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?1749049088405567805?= X-GMAIL-MSGID: =?utf-8?q?1749049088405567805?= 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 --- 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 3a0fe0c..c0fd5c0 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -364,6 +364,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; @@ -399,6 +400,7 @@ 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 af25046..95f1bb8 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; } }