From patchwork Thu Oct 20 18:03:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asutosh Das X-Patchwork-Id: 6340 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp252216wrr; Thu, 20 Oct 2022 11:08:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67vEKerPgZlJEd1ByA61ReDwmqdmuAzwYIbeGjyvbgcG9TyB/KR9YCpho1OJWBdkrIANLN X-Received: by 2002:a17:907:2bd4:b0:78d:48c9:29b0 with SMTP id gv20-20020a1709072bd400b0078d48c929b0mr11696164ejc.562.1666289292436; Thu, 20 Oct 2022 11:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666289292; cv=none; d=google.com; s=arc-20160816; b=OtCo0AETD/y6mQ4cvAtonNJW/Ga1hXQaVS0lPUZEW1pr2EMcbJk7sv1X7nojfH1sYf 9aJaAIC199C8W0BXqoKlBI7k230A/jPh03yRYYk6P0I9wJWcthg55mTOPPoegzmo/xDk 4GJf+Gf5PaOW/RqY9cqTtnVe/0/P+HbyDAo6v/MIh3jLWerEjbyH6ouSsHKX6XVbbNV1 fZqJnrNOmoWk3VO5droaDeoZl+YzgAJPnoP8hbyxMYkrwuM8+G2dQSY8xTAcZguUyyJS Vl6kcOnnLxIOYsq7mefOQ6N4w/mjI4xrvF9mF46yYi153aPmMrwdIbVyGr80xWq1AE62 CNFA== 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=9Mo5g065THCKYaFIi4id39nJkNqyHmJOnVVhpeetDFo=; b=xQrvQbDSasy4sceLCsL9D97cKQVfwq/aUtj9XzpniOfIWtUahpt5sFK11NArg6XZcw FjFdr4TPs60OadOJey3YvAAtbO4SrdSByEVgjUjqm/wg4WIpOnH/Wqd/pYpve7yioeWS gPrLZQC7YbhtSbHEHg/L0xdyjwuFQJ33H10h0kIvH5BlIlDtWI07IVeS7ODChTJxNjSV DKIjgGzDalrfGezoSNSZ5hOH0rVUy4jPcPvxXRFkIhOoC2W/ov7HIYKRYtCp3E3TGtdO bNLi6SGCX27axXfjpHZIQRLHGjHgfJ+bf8RCwT0vbNw17N/l0JDbTawjxKu1uZtPCrBJ heaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BD2Q9VgP; 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 r14-20020a170906704e00b00782b7157945si16218949ejj.377.2022.10.20.11.07.47; Thu, 20 Oct 2022 11:08:12 -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=@quicinc.com header.s=qcppdkim1 header.b=BD2Q9VgP; 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 S230208AbiJTSHZ (ORCPT + 99 others); Thu, 20 Oct 2022 14:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbiJTSHF (ORCPT ); Thu, 20 Oct 2022 14:07:05 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84E1511CB70; Thu, 20 Oct 2022 11:07:04 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29KHT8Ge021214; Thu, 20 Oct 2022 18:06: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=9Mo5g065THCKYaFIi4id39nJkNqyHmJOnVVhpeetDFo=; b=BD2Q9VgPQl2r2KCDyxOF3VJ24DlUC/dEJyJX/hwv+W1kriwQmfkCRSbywx5SGdh/sdOX zwStgfxqmksJOHUNfQUDr6URdgmEioXHkuAd6NKrwxwU11BxO7s7NEp1ZcPy9F4ljMwL ojF5Oec8MbVfOPhVLP99FpucxKk6Jwn/Qey1l+FMbFZsV71vZ/4OM/sh1xdY0lHnJYsP b9+tlWVGcQ2oEVFxzNrAuywQf9l/H8M9KJjJA9hU5yByhYnohjTS62JnRwYu/eKg/4Jv Ne9tGRHU1YgqosT5FYSu2mXrxQMtQMZzzw9ecENUn1WRW8fa6VsV3IZAH+QSQdi/+kp8 jQ== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kak1c32mf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Oct 2022 18:06:47 +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 29KI6km8011007 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Oct 2022 18:06: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; Thu, 20 Oct 2022 11:06:45 -0700 From: Asutosh Das To: , , CC: , , , , , , , , , , "Asutosh Das" , , Alim Akhtar , "James E.J. Bottomley" , Krzysztof Kozlowski , open list Subject: [PATCH v3 12/17] ufs: core: mcq: Find hardware queue to queue request Date: Thu, 20 Oct 2022 11:03:41 -0700 Message-ID: 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: Z9F74TdU_yf8doWTSKSt0Ija7IsrLseY X-Proofpoint-ORIG-GUID: Z9F74TdU_yf8doWTSKSt0Ija7IsrLseY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-20_09,2022-10-20_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 adultscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210200108 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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?1747230961258341980?= X-GMAIL-MSGID: =?utf-8?q?1747230961258341980?= Adds support to find the hardware queue on which the request would be queued. Since the very first queue is to serve device commands, an offset of 1 is added to the index of the hardware 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 | 22 ++++++++++++++++++++++ drivers/ufs/core/ufshcd-priv.h | 3 +++ drivers/ufs/core/ufshcd.c | 3 +++ 3 files changed, 28 insertions(+) diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c index aed6272..50bb594 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -94,6 +94,28 @@ static const struct ufshcd_res_info ufs_res_info[RES_MAX] = { }; /** + * ufshcd_mcq_req_to_hwq - find the hardware queue on which the + * request would be issued. + * @hba - per adapter instance + * @req - pointer to the request to be issued + * + * Returns the hardware queue instance on which the request would + * be queued. + */ +struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba, + struct request *req) +{ + u32 utag, hwq; + + utag = blk_mq_unique_tag(req); + hwq = blk_mq_unique_tag_to_hwq(utag); + + /* uhq[0] is to serve device commands */ + return &hba->uhq[hwq + UFSHCD_MCQ_IO_QUEUE_OFFSET]; +} + + +/** * ufshcd_mcq_decide_queue_depth - decide the queue depth * @hba - per adapter instance * diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h index 7df2d92..44ef266 100644 --- a/drivers/ufs/core/ufshcd-priv.h +++ b/drivers/ufs/core/ufshcd-priv.h @@ -56,7 +56,10 @@ int ufshcd_mcq_memory_alloc(struct ufs_hba *hba); void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba); void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds); void ufshcd_mcq_select_mcq_mode(struct ufs_hba *hba); +struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba, + struct request *req); +#define UFSHCD_MCQ_IO_QUEUE_OFFSET 1 #define SD_ASCII_STD true #define SD_RAW false int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index ba19e12..7b08123 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2888,6 +2888,9 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) goto out; } + if (is_mcq_enabled(hba)) + hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd)); + ufshcd_send_command(hba, tag, hwq); out: