Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp806319rdb; Thu, 30 Nov 2023 21:18:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEof+X/A/hOrb8C3ayWXf/sK4aBIhNvLQLgqR/enJS0zZndFftW1cv9Mp1XANOYEmpF/VTQ X-Received: by 2002:a17:902:d50e:b0:1cf:c518:fa3f with SMTP id b14-20020a170902d50e00b001cfc518fa3fmr17840831plg.35.1701407918504; Thu, 30 Nov 2023 21:18:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701407918; cv=none; d=google.com; s=arc-20160816; b=nzv/+YzP681zA5QPk0d3i0Mbjby+gkTKRVYDtOxcZrfjidpgFq5lhBebSRVA4ZuP3r 3xdslANP2btjauPFRMW0FJzCJSlyTN/3gJuBtILbnFITz2LmujFNvKh19nkshwTkk2tc B12o7HdYZ2Mojha1PVB9H5QxfxviCuB8SGHbY2mycxV9+Gto+oWk07vG55iwB7eAgxcW uQSvW6iFwLWdVBZ++jzzS6F11Q2jsGynVx4Ho+teeEI4r4kUbXUkzEo8vPKWZ4FFPc+i qSX/E74VIXmHlYW/PY/B7or6MfTUyxaLxzKj8S5TruebfAXPBsWzCpoHZCpTOnfpl/ph 7V6w== 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=pRabzvDHXxA3HfjAWwuu7cz0rBdyToZdAPXN41JPa1M=; fh=KohajDDuARRElnTrm5GGSpYLMvBeVD0JKMCpL1hoeEM=; b=cWrA29fK8/XLKIdxUteQ8CHnGscmn4F82C5Ka5C1F2YVQJC7P5zuBII1BnnvSG/jli O7x+yhYu3ChhoSv1WlvLCQlleTkL1tUimEf1Y2+hZ++Bfwz85QlGeNiNIQBVq+BpAVal 93EyJ3VtSM2+6cd390rPESSsBYKcRsto05Zf+pDhsx6+cDXa4hH2yrtQfPArq1u72v2X RPNb+U18aNp9fht8KPD3ucCgGZ53LkFXVscpzyLkkiumQj8g0m15+xBqAPCDHQvVHB++ wcgoR74qfcVJw/hGLgKpN0FjVWB/t3orrVmCBOiMRWJBo78VINIvRrIdBTQKYcHJRyTK Vxhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cASA5TYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id n9-20020a1709026a8900b001cfa17ec30dsi2458500plk.508.2023.11.30.21.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 21:18:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cASA5TYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 133BF80FC169; Thu, 30 Nov 2023 21:18:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377472AbjLAFSM (ORCPT + 99 others); Fri, 1 Dec 2023 00:18:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377435AbjLAFSL (ORCPT ); Fri, 1 Dec 2023 00:18:11 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC35BD40 for ; Thu, 30 Nov 2023 21:18:17 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 185C0C433C9; Fri, 1 Dec 2023 05:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701407897; bh=dCH6U9DOKu1MDBp3F2VxdSLSjeuwOTuCV17QciUNQRE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cASA5TYKYLtyKWEJ+B6W6xHPbbn4MqWOo92HlcZDaTIUdHRtQOwhk3B/sWKSqdV4U fovI7Idrlv9uvN3ewXvXh/XP3F2dCE0HywhNBZCoWDnYSA+qoeRA59KWKMwzdzmQex 4ZCKzFEFUWzEPV0zcea2SD19oJLMqIO6cFGyk9RU6zlR0XWAebLUnf75bjVhFkPktg Qxov3HdiAz1k5W99OcyxyggkQX3C5AEKmDq0yRUh4wuwUZEJpilbo+A6rnXYSYCyjG VK0jf7bVJcsqaaZ1Krx2q18Wae9zIUSf0cpxhsoM+1BHCIjutvU09qxnWDB0EURHGg Iizq4ICOe48hg== Date: Fri, 1 Dec 2023 10:48:00 +0530 From: Manivannan Sadhasivam To: Ziqi Chen Cc: Manivannan Sadhasivam , Can Guo , quic_asutoshd@quicinc.com, bvanassche@acm.org, beanhuo@micron.com, avri.altman@wdc.com, junwoo80.lee@samsung.com, martin.petersen@oracle.com, quic_nguyenb@quicinc.com, quic_nitirawa@quicinc.com, quic_rampraka@quicinc.com, linux-scsi@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , "James E.J. Bottomley" , "open list:ARM/QUALCOMM SUPPORT" , open list Subject: Re: [PATCH] scsi: ufs: qcom: move ufs_qcom_host_reset() to ufs_qcom_device_reset() Message-ID: <20231201051800.GA4009@thinkpad> References: <1698145815-17396-1-git-send-email-quic_ziqichen@quicinc.com> <20231025074128.GA3648@thinkpad> <85d7a1ef-92c4-49ae-afe0-727c1b446f55@quicinc.com> <20231128112731.GV3088@thinkpad> 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=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 30 Nov 2023 21:18:35 -0800 (PST) On Wed, Nov 29, 2023 at 08:10:57PM +0800, Ziqi Chen wrote: > > > On 11/28/2023 7:27 PM, Manivannan Sadhasivam wrote: > > On Tue, Nov 28, 2023 at 03:40:57AM +0800, Ziqi Chen wrote: > > > > > > > > > On 11/22/2023 2:14 PM, Can Guo wrote: > > > > > > > > > > > > On 10/25/2023 3:41 PM, Manivannan Sadhasivam wrote: > > > > > On Tue, Oct 24, 2023 at 07:10:15PM +0800, Ziqi Chen wrote: > > > > > > During PISI test, we found the issue that host Tx still bursting after > > > > > > > > > > What is PISI test? > > > > > > SI measurement. > > > > > > > Please expand it in the patch description. > > Sure, I will update in next patch version. > > > > > > > > > > > > > > H/W reset. Move ufs_qcom_host_reset() to ufs_qcom_device_reset() and > > > > > > reset host before device reset to stop tx burst. > > > > > > > > > > > > > > > > device_reset() callback is supposed to reset only the device and not > > > > > the host. > > > > > So NACK for this patch. > > > > > > > > Agree, the change should come in a more reasonable way. > > > > > > > > Actually, similar code is already there in ufs_mtk_device_reset() in > > > > ufs-mediatek.c, I guess here is trying to mimic that fashion. > > > > > > > > This change, from its functionality point of view, we do need it, > > > > because I occasionally (2 out of 10) hit PHY error on lane 0 during > > > > reboot test (in my case, I tried SM8350, SM8450 and SM8550, all same). > > > > > > > > [    1.911188] [DEBUG]ufshcd_update_uic_error: UECPA:0x80000002 > > > > [    1.922843] [DEBUG]ufshcd_update_uic_error: UECDL:0x80004000 > > > > [    1.934473] [DEBUG]ufshcd_update_uic_error: UECN:0x0 > > > > [    1.944688] [DEBUG]ufshcd_update_uic_error: UECT:0x0 > > > > [    1.954901] [DEBUG]ufshcd_update_uic_error: UECDME:0x0 > > > > > > > > I found out that the PHY error pops out right after UFS device gets > > > > reset in the 2nd init. After having this change in place, the PA/DL > > > > errors are gone. > > > > > > Hi Mani, > > > > > > There is another way that adding a new vops that call XXX_host_reset() from > > > soc vendor driver. in this way, we can call this vops in core layer without > > > the dependency of device reset. > > > due to we already observed such error and received many same reports from > > > different OEMs, we need to fix it in some way. > > > if you think above way is available, I will update new patch in soon. Or > > > could you give us other suggestion? > > > > > > > First, please describe the issue in detail. How the issue is getting triggered > > and then justify your change. I do not have access to the bug reports that you > > received. > > From the waveform measured by Samsung , we can see at the end of 2nd Link > Startup, host still keep bursting after H/W reset. This abnormal timing > would cause the PA/DL error mentioned by Can. > > On the other hand, at the end of 1st Link start up, Host ends bursting at > first and then sends H/W reset to device. So Samsung suggested to do host > reset before every time device reset to fix this issue. That's what you saw > in this patch. This patch has been verified by OEMs. > Thanks for the detail. This info should have been part of the patch description. > So do you think if we can keep this change with details update in commit > message. or need to do other improvement? > For sure we should not do host reset within device_reset callback. I'd like to know at what point of time we are seeing the host burst after device reset. I mean can you point me to the code in the ufshcd driver that when calling device_reset you are seeing the issue? Then we can do a host_reset before that _specific_ device_reset with the help of the new vops you suggested. - Mani > > -Ziqi > > > > > - Mani > > > > > -Ziqi > > > > > > > > > > > Thanks, > > > > Can Guo. > > > > > > > > > > - Mani > > > > > > > > > > > Signed-off-by: Ziqi Chen > > > > > > --- > > > > > >   drivers/ufs/host/ufs-qcom.c | 13 +++++++------ > > > > > >   1 file changed, 7 insertions(+), 6 deletions(-) > > > > > > > > > > > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > > > > > > index 96cb8b5..43163d3 100644 > > > > > > --- a/drivers/ufs/host/ufs-qcom.c > > > > > > +++ b/drivers/ufs/host/ufs-qcom.c > > > > > > @@ -445,12 +445,6 @@ static int > > > > > > ufs_qcom_power_up_sequence(struct ufs_hba *hba) > > > > > >       struct phy *phy = host->generic_phy; > > > > > >       int ret; > > > > > > -    /* Reset UFS Host Controller and PHY */ > > > > > > -    ret = ufs_qcom_host_reset(hba); > > > > > > -    if (ret) > > > > > > -        dev_warn(hba->dev, "%s: host reset returned %d\n", > > > > > > -                  __func__, ret); > > > > > > - > > > > > >       /* phy initialization - calibrate the phy */ > > > > > >       ret = phy_init(phy); > > > > > >       if (ret) { > > > > > > @@ -1709,6 +1703,13 @@ static void ufs_qcom_dump_dbg_regs(struct > > > > > > ufs_hba *hba) > > > > > >   static int ufs_qcom_device_reset(struct ufs_hba *hba) > > > > > >   { > > > > > >       struct ufs_qcom_host *host = ufshcd_get_variant(hba); > > > > > > +    int ret = 0; > > > > > > + > > > > > > +    /* Reset UFS Host Controller and PHY */ > > > > > > +    ret = ufs_qcom_host_reset(hba); > > > > > > +    if (ret) > > > > > > +        dev_warn(hba->dev, "%s: host reset returned %d\n", > > > > > > +                  __func__, ret); > > > > > >       /* reset gpio is optional */ > > > > > >       if (!host->device_reset) > > > > > > -- > > > > > > 2.7.4 > > > > > > > > > > > > > -- மணிவண்ணன் சதாசிவம்