Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp14987511rwb; Mon, 28 Nov 2022 06:58:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf5FTm1kwcDjgn95tjUABEaGlQ0/mBQwo0+hNmiy3gPXY/wMBOtUFjUoPOjIAri3OcY1CyFN X-Received: by 2002:a17:902:ccce:b0:185:4880:91cd with SMTP id z14-20020a170902ccce00b00185488091cdmr32464674ple.130.1669647504271; Mon, 28 Nov 2022 06:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669647504; cv=none; d=google.com; s=arc-20160816; b=kvNQYZbHQ5sFznfBtWzV0eNC0yD1nH88E4jBxKAl4uaN2wVf47XeCb3+5vp7v6PSWo bbYCijexRq+r90V46mz0MB1T3v/AGzwB4ntTmZWmBRZQDWY5V71zUnXxDczc9AZN6/oH 9lppWmDDSUbMQrlxWlozqxv3kPpdFuftk/mGiu50V5DdyrPBnvv/7RWMHb9+wFJq2ATX evwz/O2VSIjYF4hGHmu2bqlK3MpYeO9zTySFkQ3g938bKfAItcy/MGLFTA5wNQVvBsT9 djA/8tcdKXWWt+4BEzfheY/DZRyLNdouh9PjfKOoNPmf7VgxC0rMYlammnbFEbHGTvzO rB2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gf5Q5kBVURkS4a+/U9RyeDrsgyM9VlSYNoOm78rgx2A=; b=K5nVZ3QCBRaM3TM3ya8L2BKdAaodXtgS7pIK6rkOpKvDaQmNZToJOJCbkVMXPO1Dy5 o332Cnz0NNxLwgjo35ES4eCt3yoR0649+L2hbaN7jGYNKUj0tjQwFPDd4Hbmyj0MIjpT o2FNkOsnUiJ/JPyLfeVDIr/XlOD4GvM7Qz0596YtuZnwMILT68WwGrAw10yYMKBZFgPx Gsd3fJwks/1YRmhv+mYL+6w27qFOEv9qgZdt35g48MYFmRnOeX96Zb43yQHRrniukiXT SYCLhjZjV5FbzhcoXXzlDBk+WGJEWebgqWmJQkqmcJxh2sBG9Bl/h/I5gWAl2BVHXeg/ tcrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eDNyihVb; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a63790e000000b004772ac33cdesi12187838pgc.688.2022.11.28.06.58.13; Mon, 28 Nov 2022 06:58:24 -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=@kernel.org header.s=k20201202 header.b=eDNyihVb; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231928AbiK1OnE (ORCPT + 84 others); Mon, 28 Nov 2022 09:43:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232626AbiK1Omw (ORCPT ); Mon, 28 Nov 2022 09:42:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E134D2E3; Mon, 28 Nov 2022 06:42:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 19626611D3; Mon, 28 Nov 2022 14:42:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C937BC433C1; Mon, 28 Nov 2022 14:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669646558; bh=Vaqy0ljqy+6FwKwyXsEKERVsCLsDS1+87nejAbRnZ4w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eDNyihVbCj3VD1RtEKcdsPLgOX3bVqN1n+Bn0vD6U/fobkRuhCiK3G7MnbzXR+kmU Wu1aK+UaUIGFbxVvszLCeTDdAcpZGTo7wMd+lMiPwelfoDYXchP7qmSsKurp+5tvTl n8ER6shLBpk/CkP3UFzxb6Y0oCb5CpKo+SZXy9uZ26iWTgCHObZmjhiY60SjmS7Thv 4m+Lzyd+Z0kILEZlRo177qxBPyuBpNj3B8CwqtKg3nZ/QjEKGSY7QFPSpowUXJSQ+1 jgdwb6ARFkVb7vbCVSy1s5CQUHa49OUyLDVvxVIHa+YSf0/vTBDYiBM0CqFeQF8sZk 2cWNiR0IGZe2Q== Date: Mon, 28 Nov 2022 20:12:22 +0530 From: Manivannan Sadhasivam To: Asutosh Das Cc: quic_cang@quicinc.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, quic_nguyenb@quicinc.com, quic_xiaosenh@quicinc.com, stanley.chu@mediatek.com, eddie.huang@mediatek.com, daejun7.park@samsung.com, bvanassche@acm.org, avri.altman@wdc.com, beanhuo@micron.com, linux-arm-msm@vger.kernel.org, Alim Akhtar , "James E.J. Bottomley" , Jinyoung Choi , open list Subject: Re: [PATCH v5 04/16] ufs: core: Defer adding host to scsi if mcq is supported Message-ID: <20221128144222.GD62721@thinkpad> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Tue, Nov 22, 2022 at 08:10:17PM -0800, Asutosh Das wrote: > 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. Why cannot we do it for non MCQ case as well? Thanks, Mani > > 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 > -- மணிவண்ணன் சதாசிவம்