From patchwork Wed Nov 23 04:10:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asutosh Das X-Patchwork-Id: 24694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2583697wrr; Tue, 22 Nov 2022 20:16:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Koa8AY0S8kAtUVlinfTom4JBhURxX6NkwYshxojQQHxm7xSZeQGts+DUzWbBonjM/A1dr X-Received: by 2002:a17:907:2143:b0:7ae:27ed:e90e with SMTP id rk3-20020a170907214300b007ae27ede90emr21877037ejb.224.1669177002347; Tue, 22 Nov 2022 20:16:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669177002; cv=none; d=google.com; s=arc-20160816; b=l6nEofj3iaTAT+A/5pcBOQhJoN7d2ZMhL8kjJ4cuh9DVf9vwi2Fv/aE7cxADwkujM+ MukaB4PC04cgKDEKU8paOEdEL6VYpPFT42EeOB4FtmSlbKViw/Cmh+pLx34Zi6lIjwfC +xgtPbC9vJfXpw+6nuyX+7qhjwGdxCd/X+qiQRSYER6ZMoLVjyZGDAMXRATqZRPN3TGd dpmn2cQ1WjiYdRZxBLGmBh1zEoeVkgoduKL1yKGzJzCRJLp3XeI/ROFm7/oLmQk02kGP wnMpbSFvd9vCtqYFN0a81yj90zKM6m09yuqMd4q0afCJK5PB/vkNzd435FD7Hp0PKvum c4kA== 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=MpzJ6DUILypkakOu3W0Plg/shM6e7HUh+fLScGDYyJc=; b=roMlmthZgRrfBUD4d0xM5RFbMToEZ5ykPdMQNmzwhMlcU0/59hNobNG2MeiRo1Mw0K AWa0zMamWUILBDWybp+uWfjQ6KAFvaAq8A5ElWEKFCwjettJQvDZ+dZMGyupwW60uq+G euLMpsgNnT+ZBuBn6hRHgMnBCreX3D2FISAgh8wdfIHgOQpIjeWjoQcJYbKSEIhq0wpB 2IVbIz2vpUZK6S82r2E0IaoeB8IL/QBpKzJ/v+jk8vK0uj2J5IHGc7p4B+QTZ3J32N+m uzEhtv33dy/Cif1uiBxBBj8LRO+5XdZN22Cvy2lF3iWX+RDT7UoqLWN/yTdmDJESLQHN AzYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CyFOrEnn; 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 q18-20020a056402519200b0045a1dbedd92si9340758edd.35.2022.11.22.20.16.16; Tue, 22 Nov 2022 20:16:42 -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=CyFOrEnn; 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 S235850AbiKWEPN (ORCPT + 99 others); Tue, 22 Nov 2022 23:15:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235802AbiKWEOn (ORCPT ); Tue, 22 Nov 2022 23:14:43 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62988EC0B3; Tue, 22 Nov 2022 20:13:34 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AN4A0Bb026447; Wed, 23 Nov 2022 04:13:22 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=MpzJ6DUILypkakOu3W0Plg/shM6e7HUh+fLScGDYyJc=; b=CyFOrEnno9GYevEY6cRQZkQjbhSD8eOqxVzcAXYwe9exv/QTOGOkdKEPSjeJnRmCY809 h2DIanjiU7mJd9VHG2roda0v98/TjjD3zs05+gr8FL+ob/pe5oByJheH27+/9NvX7/2l HXnZYRnt0mGshTRFzxdtlYaZYvXnmV3D7SEQ9FS55JMZ/SbcRXuNDCRgl19Bqdr+RBrc exmT2uuN1PR2CjxS5yglbzg26t7cLFmPeyNjm58mRmIkx3GDr04Ctl1h/rtJ9kOjI8WW epI7A0YvOlTR9NG4ZUHaQg3217mnXUc9QvVd7VKPzgxiwaE81bY39ZJGs2Cgv9+0CG3B pA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m0twqac45-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 04:13:21 +0000 Received: from nasanex01a.na.qualcomm.com (corens_vlan604_snip.qualcomm.com [10.53.140.1]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2AN4DKbd025050 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 04:13:20 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.36; Tue, 22 Nov 2022 20:13:20 -0800 From: Asutosh Das To: , , CC: , , , , , , , , , Asutosh Das , , Alim Akhtar , "James E.J. Bottomley" , Jinyoung Choi , open list Subject: [PATCH v5 10/16] ufs: core: mcq: Use shared tags for MCQ mode Date: Tue, 22 Nov 2022 20:10:23 -0800 Message-ID: <0b6e722a1376e0811cb1a3b2afe23e4fbc3e5326.1669176158.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-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: gRRsrEFTDd0MCfBECARimrTSiPzoRkBh X-Proofpoint-ORIG-GUID: gRRsrEFTDd0MCfBECARimrTSiPzoRkBh 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-23_01,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211230030 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?1750258944347923010?= X-GMAIL-MSGID: =?utf-8?q?1750258944347923010?= 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 ebecc47..e4ddb90 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -376,6 +376,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; @@ -411,6 +412,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 042ecf04..d61e99f 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; } }