Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6833526rwb; Tue, 22 Nov 2022 20:44:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Gr0aEox1NWX0ngPfqMEPZsJBgO67lJwneFu1biAMN9mKBPYPbQEiXy3pGwTRjIC16S4+K X-Received: by 2002:aa7:c9d1:0:b0:461:4ab3:97ca with SMTP id i17-20020aa7c9d1000000b004614ab397camr8049040edt.211.1669178680083; Tue, 22 Nov 2022 20:44:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669178680; cv=none; d=google.com; s=arc-20160816; b=HBuzh00qsmpM8LJX08pWOtypv7BMzSdnDwyud97N/i8/aNfbxL8aTB2Swj189rhRcI kNAxmbJk2vZDBjEFSQ/g4rCQ90tOF/5v2k5B2doGsoTAwNYFZ5oesfoIP1coB2EOZQsM MglH2lv7CjkzRTOo1RGDwrWR9q5Kk2M3/eakShudc/NL6TyAB8mFA0c1mBjAeHflosxG EFMNjtAmNASGG5wBPQxGHl41cTO/kNpZ7NUbxZgCqFhAgzwrkdBpkt61sW2fLBW4lCqI 2ayuSCLg7W/gUOorszpUclbYSi40D05ayYaU18v/PM+AqijlejrcQLOHgwHd6LRtfntS bVRg== 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=fE9aBt6d7vItFATd1b+yD0cgZRy3HR7r8JYB0tjBLtg=; b=B6HDT+IGjZwUvmimNkH10BX5wh0vXnsmD2DMavLUHtprncBPukrdl5IxO4vmPkmRRa vOA6VTVS00HdqUo2m+uhBxdnK3iiJdEybrD+2N2YmNCZO49qqNCYlTCutKYkQgquTqA/ iRGKvXWYtyYsvPWkx6sr8t8IUnfWwqI6iGTB3If2jn6zQUxpXU3KOvnGlGja4MhZs0Hq cLspv4TxBIBTgVKHjiE5cIdHNpUJ6wk1YAhC3JIoKxJyxiRXjPIdpcImXeKs3Atga8Fo 3RNuhSh3uthM+GZX3Lf/UhDqtU6gNZGkIw/Uhv8zaHZklUoTEOMmvyCzCxaUwJxGKR08 97pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CqFgWZVJ; 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 gs9-20020a1709072d0900b007ae832c0b6bsi15816764ejc.508.2022.11.22.20.44.17; Tue, 22 Nov 2022 20:44:40 -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=CqFgWZVJ; 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 S235724AbiKWEM2 (ORCPT + 89 others); Tue, 22 Nov 2022 23:12:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235693AbiKWEMN (ORCPT ); Tue, 22 Nov 2022 23:12:13 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1425A72091; Tue, 22 Nov 2022 20:12:12 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AN49668007426; Wed, 23 Nov 2022 04:11:59 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=fE9aBt6d7vItFATd1b+yD0cgZRy3HR7r8JYB0tjBLtg=; b=CqFgWZVJLdIBBA33OTwjJKt/FSyuRfK8EQ7b4q8AwOd369Quf6nHrv5mJH3xw02o6iJs sCRDDqYQ8YmNWav6jwdLwvy2LQYzCu8ziSmrO8zY9d3p9kT1r4jwXIfiECdEJ3EPNp3v 1FnZvkg0uPPllVFxUcAtsSq1nkGINXyGiWZQR1SHcEquN2v+X2XJ1mzUiMGmgmJuDPLa WmgUs7yfmN9a1l94yUk/Cl0wYGjrX7OOieLJq6lvVyZk7BVH0P1pz3a828R5NOkYCiHv Lm2IVwY5N7TMC5zfxmU3iRBffGLmHB4PgEW6HmBF+iu3gLBKpjtq6S7okxSjI/ejaNIt 9w== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m11fw1ca6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 04:11:59 +0000 Received: from nasanex01a.na.qualcomm.com ([10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2AN4BvoC030882 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 04:11:57 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:11:57 -0800 From: Asutosh Das To: , , CC: , , , , , , , , , Asutosh Das , , Alim Akhtar , "James E.J. Bottomley" , Jinyoung Choi , open list Subject: [PATCH v5 04/16] ufs: core: Defer adding host to scsi if mcq is supported Date: Tue, 22 Nov 2022 20:10:17 -0800 Message-ID: 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: 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-ORIG-GUID: iKGosVwbPuxTQ8jWDYlh0CNhC_q7mqzm X-Proofpoint-GUID: iKGosVwbPuxTQ8jWDYlh0CNhC_q7mqzm 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 suspectscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 clxscore=1015 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 If MCQ support is present, enabling it after MCQ support has been configured would require reallocating tags and memory. It would also free up the already allocated memory in Single Doorbell Mode. So defer invoking scsi_add_host() until MCQ is configured. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das --- drivers/ufs/core/ufshcd.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 08be8ad..42c49ce 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8208,6 +8208,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params) int ret; unsigned long flags; ktime_t start = ktime_get(); + struct Scsi_Host *host = hba->host; hba->ufshcd_state = UFSHCD_STATE_RESET; @@ -8242,6 +8243,14 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params) ret = ufshcd_device_params_init(hba); if (ret) goto out; + + if (is_mcq_supported(hba)) { + ret = scsi_add_host(host, hba->dev); + if (ret) { + dev_err(hba->dev, "scsi_add_host failed\n"); + goto out; + } + } } ufshcd_tune_unipro_params(hba); @@ -9838,10 +9847,12 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) hba->is_irq_enabled = true; } - err = scsi_add_host(host, hba->dev); - if (err) { - dev_err(hba->dev, "scsi_add_host failed\n"); - goto out_disable; + if (!is_mcq_supported(hba)) { + err = scsi_add_host(host, hba->dev); + if (err) { + dev_err(hba->dev, "scsi_add_host failed\n"); + goto out_disable; + } } hba->tmf_tag_set = (struct blk_mq_tag_set) { -- 2.7.4