Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3153093rwb; Wed, 30 Nov 2022 16:22:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf5CYSMr/XUgmV/PCApiDwo5V5m8qXAW7kwgn+FQdR08CMDHCIpP112SKagh02j6UPIT4lXI X-Received: by 2002:a17:907:918d:b0:78d:2eea:28c7 with SMTP id bp13-20020a170907918d00b0078d2eea28c7mr54840582ejb.266.1669854146156; Wed, 30 Nov 2022 16:22:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669854146; cv=none; d=google.com; s=arc-20160816; b=hva7FLCN9kv9vm530+9auejdJg5pcUzALQ6XEff2QYst9/cxL5P06dz8GD5dW7ghOL wDiotd9f8rpmcSEOcQNPW9tkX55w4Kb0dvjQM3ZxkNWW9bcxHuxdFOPYc7rSkgDrtURR GFoj3Nh3nvl3rAmdImL6YcxJfF1cA62T1mDwIGK/F99uR+hdupOmAzKTxpILNj8BpvVj Pv6hFdtc82bbJoPjPM/iAWfkHNLYfN5pEeK2ndEXB5R4/QA85OSndqNw/bmyuWG6hmU9 g8L1Kiu3M/PSK7wvRHe7Vf3tH9u3NdeovvLubOEQlNRy3+LgLKujkpIipFx271FWYRRb 28sg== 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=JJLSbebFw9qNK2ogzbe+/HZ6FO1nbhq42JbF/wiwgGA=; b=C7r5SQ64u7G2qLzXiOFN0d9mNtDMnNMlg6tdr36PPxh7Zpl3/j3ZNGp+BMyLXCTRyT Hh6sivEVddDIXqZEXTK0rqPR6mI3QSqr3SnXVDjIjnq8aRJbQWmhcSjDR5hUgcJ5gxvi WEgASh6/l3zWLkO9jx9bKb+63aCGcxz2v5wJN5sRVwWKs2kZGiOjHSFukuYhA5Ka+xwX OFI9QrUKN6CYUT13OyHafT9kLt7TuouU8EcuP2C6RHH5UKzIWMZahZBRDf/iAF0NAzZw PkZGJtN7D9UmFkQhuMZlSVcANP1yXSPkbBaTKbtFnhzL482WvBDM725Le23eeXPwhb7V D1mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=K2Qelnc6; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb19-20020a170907161300b007bd112b2764si2757195ejc.381.2022.11.30.16.22.06; Wed, 30 Nov 2022 16:22:26 -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=K2Qelnc6; 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 S230032AbiLAACj (ORCPT + 83 others); Wed, 30 Nov 2022 19:02:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbiLAAA6 (ORCPT ); Wed, 30 Nov 2022 19:00:58 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D33789306; Wed, 30 Nov 2022 16:00:51 -0800 (PST) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AUM2gqJ015055; Thu, 1 Dec 2022 00:00:33 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=JJLSbebFw9qNK2ogzbe+/HZ6FO1nbhq42JbF/wiwgGA=; b=K2Qelnc6jmlyOCK4t6Ubfx4AJqbrpTGSTjmAXFnVry+eE2ogpjtZr56UwXbdB4YF+kfA NGS2UoxklIZqATq0nSUlrthwSxIMjZF1WmZSY6km7qjcYutFGtpke7Aot23AueFXSc2t zThOKWk+/0Y0lGrV4ScMKt0VBNq8IvHgRrR309Af/tf0Y3si8jPe1ONsBzNP1s2e9tyb vYzHdAs+O6zKSMbCkyyRqxgz2BOViX+CXGwo6EHjSIHwlYyxVXQ6p7dE4kAILrN3oyDZ Bb4/SzpMDvqbCrF4DXuh5nPG/sXpXu4LIm3MWYkq5dllKqPYB98/bsWRtvYvUqbY2dec ng== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m65tbj2fg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Dec 2022 00:00:33 +0000 Received: from nasanex01a.na.qualcomm.com ([10.52.223.231]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B100WSl002211 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 1 Dec 2022 00:00:32 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; Wed, 30 Nov 2022 16:00:31 -0800 From: Asutosh Das To: , , CC: , , , , , , , , , Asutosh Das , , Alim Akhtar , "James E.J. Bottomley" , Jinyoung Choi , open list Subject: [PATCH v9 03/16] ufs: core: Introduce Multi-circular queue capability Date: Wed, 30 Nov 2022 15:50:35 -0800 Message-ID: <796a65f6f1a6e2d276b05fd76df27ad77c3c38cc.1669850856.git.quic_asutoshd@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain 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: bm69nPDvxMPYFtWWc3r6sjyhKYSvC84H X-Proofpoint-ORIG-GUID: bm69nPDvxMPYFtWWc3r6sjyhKYSvC84H 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-30_04,2022-11-30_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 mlxscore=0 malwarescore=0 mlxlogscore=999 impostorscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211300171 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Add support to check for MCQ capability in the UFSHC. Add a module parameter to disable MCQ if needed. 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/ufshcd.c | 26 ++++++++++++++++++++++++++ include/ufs/ufshcd.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 595fd3c..eca15b0 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -89,6 +89,28 @@ /* Polling time to wait for fDeviceInit */ #define FDEVICEINIT_COMPL_TIMEOUT 1500 /* millisecs */ +/* UFSHC 4.0 compliant HC support this mode, refer param_set_mcq_mode() */ +static bool use_mcq_mode = true; + +static int param_set_mcq_mode(const char *val, const struct kernel_param *kp) +{ + int ret; + + ret = param_set_bool(val, kp); + if (ret) + return ret; + + return 0; +} + +static const struct kernel_param_ops mcq_mode_ops = { + .set = param_set_mcq_mode, + .get = param_get_bool, +}; + +module_param_cb(use_mcq_mode, &mcq_mode_ops, &use_mcq_mode, 0644); +MODULE_PARM_DESC(use_mcq_mode, "Control MCQ mode for controllers starting from UFSHCI 4.0. 1 - enable MCQ, 0 - disable MCQ. MCQ is enabled by default"); + #define ufshcd_toggle_vreg(_dev, _vreg, _on) \ ({ \ int _ret; \ @@ -2258,6 +2280,10 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) if (err) dev_err(hba->dev, "crypto setup failed\n"); + hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities); + if (!hba->mcq_sup) + return err; + hba->mcq_capabilities = ufshcd_readl(hba, REG_MCQCAP); hba->ext_iid_sup = FIELD_GET(MASK_EXT_IID_SUPPORT, hba->mcq_capabilities); diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index aec37cb9..70c0f9f 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -832,6 +832,7 @@ struct ufs_hba_monitor { * @complete_put: whether or not to call ufshcd_rpm_put() from inside * ufshcd_resume_complete() * @ext_iid_sup: is EXT_IID is supported by UFSHC + * @mcq_sup: is mcq supported by UFSHC */ struct ufs_hba { void __iomem *mmio_base; @@ -982,6 +983,7 @@ struct ufs_hba { u32 luns_avail; bool complete_put; bool ext_iid_sup; + bool mcq_sup; }; /* Returns true if clocks can be gated. Otherwise false */ -- 2.7.4