Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6923500rwn; Tue, 13 Sep 2022 10:55:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6H8ZOUilfhWetF34E85YRfUwvqvANMpwMwYuKx6RmRbGsCRt/s8fqj4NFqJeBDchEU6zVw X-Received: by 2002:a17:90a:53a4:b0:1fa:97eb:6f0a with SMTP id y33-20020a17090a53a400b001fa97eb6f0amr455062pjh.54.1663091703872; Tue, 13 Sep 2022 10:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663091703; cv=none; d=google.com; s=arc-20160816; b=NljiX96wXk+h9vt9Yps6N4dbwosdJeVrSCCaA0gfRWWgHehAUC8WhRkaiAe6Fr+/ai 7AYDcu8vpInFM8O9IA7UCaVY8zunpqcpe/nWXlNaPNNFB+RFHPhS7o0MzWsIsFA5ZkSN 9uibcBRjnNpBh0PpUhW8OpwfPu9MaL1efa1jMRHIEpjhid10NKvSDnrRIyvt6kQTEtvQ IOmqtXJ2+8PyDfyhgyQKSXDSuMhCWwhLJkynoCBKJiSDe1AbNllCDbCl0PgsK8HFdRuG keBctAb0A0LfLdRfVJU2h3R/bIKRdV23xmNjYQn7BfGARdz0Wbm6HMOizqIuW7GrJNIg 6kyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=QsjjO29pV+lXnXx8W3jvjySTYx0DjCwzWNd1Q2TmSXA=; b=Q26/cWpCoHNluoKujj/JL4smrD5tYSogLVT7+SR++sS9qSg59+bLtJCLICv6EBm1Xb cIGivgR9bfxHZuNqoXpB7KdG+7Fxan6UIzwV7lbjeaUrjVzkI0PHlm9ptrcH6YRlzM2i sFIrO898kmAB78RJAD6TeMJ4ToGDNl73IwY6OKfO1t2hxIbhT0n7l87i21aFD8QJ85zC mPfWRgGlH0f38gVhq27w0iuNHganZgxrdi0VbNx7IQ60gjTzhQIfolzEUgn44FIhJ0XL XBdpo5CDiB3CIMDzIN/lZRqS9FMVFjUZ/wjRcvYUXMP6fDFDqI1BLddVWSJnO56MRLF3 4rsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uqnmjv2x; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020aa788ce000000b00537fd74ca6bsi13140698pff.54.2022.09.13.10.54.51; Tue, 13 Sep 2022 10:55:03 -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=@linaro.org header.s=google header.b=Uqnmjv2x; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233472AbiIMRok (ORCPT + 99 others); Tue, 13 Sep 2022 13:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233129AbiIMRoN (ORCPT ); Tue, 13 Sep 2022 13:44:13 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A80FBC61 for ; Tue, 13 Sep 2022 09:39:29 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id v1so12391966plo.9 for ; Tue, 13 Sep 2022 09:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date; bh=QsjjO29pV+lXnXx8W3jvjySTYx0DjCwzWNd1Q2TmSXA=; b=Uqnmjv2xQNeNKUq7BA4jcJlTZavzWJWhXukjJKyzC6pVFxMd0AzNd7CIJMP+lYYZMf rG+4JX2uYdFGphoSIMXiymcu0A66WUnE5bVc/thHgnWrLHp013vc7TxCNyd3fwHkJx0a fKZe9OKqlVWzr5GCkcFRXwIkjzUpm0+4WZalg3kT3SbCvFFt8bYTJQYJQcXO4u8Xp/KI V1fk91M+6twTeJvNjlHc/fk+vkhF6MNjMCoWviMZnCJAaAwPfuhRyPPPfglH74ezfl24 xKo1NvFzl3xADNqgD0ofJ4ZBbTVkbWg6yS4Tb1wKpmso5K7ESaWBhRR2grqhAEJTdkxO hHyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date; bh=QsjjO29pV+lXnXx8W3jvjySTYx0DjCwzWNd1Q2TmSXA=; b=0aytCrauO7n3HtPvAgYjeQFYTKX3IxR87kJHr503NKEDqL7JkWuJa5mFqHt3vdGhUk S2ATcO3OT5H2OBTUjJtI1N7v9VkXZyU1ZaiSiwS5X2pNfEsiz2h3zHYsipwrw4EodaBf vwsMpx79fEPy1wb8fieCIo08sHR+jrLZzd5VzU8BJYcA7b1yr28bNYBlbJLw+5XLEDId ZK9WO05p94OtPexDZgoJ1OL8ekwbWHv5G1RG8Qj+lJiiysuQtBWDilk/ipe7YNEslaBf 5ILpbvIbVleRTNzsF6CsGW7dpnAtNyS6TTec43KUM03tpo+zcjiEJaYxVa13mA/cdnOX jCFQ== X-Gm-Message-State: ACgBeo1bYT/DRg2coMMW2gOEMCeOramJNM5afXg9OD6PgL1MPjuXLBtv M4YsasYel/hPInk/a+q1wa/+ X-Received: by 2002:a17:903:110e:b0:171:3afa:e68c with SMTP id n14-20020a170903110e00b001713afae68cmr32267098plh.12.1663087169076; Tue, 13 Sep 2022 09:39:29 -0700 (PDT) Received: from workstation ([117.202.184.122]) by smtp.gmail.com with ESMTPSA id e14-20020a17090a7c4e00b002008a85bac1sm7344495pjl.49.2022.09.13.09.39.23 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Sep 2022 09:39:28 -0700 (PDT) Date: Tue, 13 Sep 2022 22:09:21 +0530 From: Manivannan Sadhasivam To: Krishna Chaitanya Chundru Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, mka@chromium.org, quic_vbadigan@quicinc.com, quic_hemantk@quicinc.com, quic_nitegupt@quicinc.com, quic_skananth@quicinc.com, quic_ramkri@quicinc.com, swboyd@chromium.org, dmitry.baryshkov@linaro.org, Stanimir Varbanov , Andy Gross , Bjorn Andersson , Konrad Dybcio , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas Subject: Re: [PATCH v6 2/5] PCI: qcom: Add retry logic for link to be stable in L1ss Message-ID: <20220913163921.GE25849@workstation> References: <20220909195000.GA310621@bhelgaas> <7310fc0c-5f87-87a6-4484-d60970ce3285@quicinc.com> <20220912173346.GB25849@workstation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) 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,T_SCC_BODY_TEXT_LINE 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, Sep 13, 2022 at 07:54:22PM +0530, Krishna Chaitanya Chundru wrote: > > On 9/12/2022 11:03 PM, Manivannan Sadhasivam wrote: > > On Mon, Sep 12, 2022 at 09:39:36PM +0530, Krishna Chaitanya Chundru wrote: > > > On 9/10/2022 1:20 AM, Bjorn Helgaas wrote: > > > > On Fri, Sep 09, 2022 at 02:14:41PM +0530, Krishna chaitanya chundru wrote: > > > > > Some specific devices are taking time to settle the link in L1ss. > > > > > So added a retry logic before returning from the suspend op. > > > > "L1ss" is not a state. If you mean "L1.1" or "L1.2", say that. Also > > > > in code comments below. > > > Yes L1ss means L1.2 and L1.2 We will update it next patch > > > > s/So added a/Add/ > > > > > > > > What are these specific devices? Is this a qcom controller defect? > > > > An endpoint defect that should be addressed via some kind of generic > > > > quirk? > > > This is depending up on the endpoint devices and it varies to device to > > > device. > > > > > Can we identify the source of the traffic? Is the NVMe driver not > > flushing it's queues correctly? > > We found that it is not from nvme data, we are seeing some physical layer > activity on the > > protocol analyzer. > Okay > > > > > We are thinking this is not a defect if there is some traffic in the link > > > the link will > > > > > > not go to L1ss . > > > > > Is this hack still required even after switching to syscore ops? > > > > Thanks, > > Mani > > Yes, mani it is still required. And just before this sycore ops there will > be a pci transaction to > > mask msix interrupts. > Hmm. I'm getting slightly confused here. What really happens when you do the resource teardown during suspend and the link has not entered L1SS? Since PHY is powered by MX domain, I'm wondering why we should wait for the link to be in L1SS? Thanks, Mani > > > > > Signed-off-by: Krishna chaitanya chundru > > > > > --- > > > > > drivers/pci/controller/dwc/pcie-qcom.c | 36 +++++++++++++++++++++++----------- > > > > > 1 file changed, 25 insertions(+), 11 deletions(-) > > > > > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > > > > > index 6e04d0d..15c2067 100644 > > > > > --- a/drivers/pci/controller/dwc/pcie-qcom.c > > > > > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > > > > > @@ -1809,26 +1809,40 @@ static int qcom_pcie_probe(struct platform_device *pdev) > > > > > static int __maybe_unused qcom_pcie_pm_suspend(struct qcom_pcie *pcie) > > > > > { > > > > > u32 val; > > > > > + ktime_t timeout, start; > > > > > struct dw_pcie *pci = pcie->pci; > > > > > struct device *dev = pci->dev; > > > > > if (!pcie->cfg->supports_system_suspend) > > > > > return 0; > > > > > - /* if the link is not active turn off clocks */ > > > > > - if (!dw_pcie_link_up(pci)) { > > > > > - dev_info(dev, "Link is not active\n"); > > > > > - goto suspend; > > > > > - } > > > > > + start = ktime_get(); > > > > > + /* Wait max 200 ms */ > > > > > + timeout = ktime_add_ms(start, 200); > > > > > - /* if the link is not in l1ss don't turn off clocks */ > > > > > - val = readl(pcie->parf + PCIE20_PARF_PM_STTS); > > > > > - if (!(val & PCIE20_PARF_PM_STTS_LINKST_IN_L1SUB)) { > > > > > - dev_warn(dev, "Link is not in L1ss\n"); > > > > > - return 0; > > > > > + while (1) { > > > > > + > > > > > + if (!dw_pcie_link_up(pci)) { > > > > > + dev_warn(dev, "Link is not active\n"); > > > > > + break; > > > > > + } > > > > > + > > > > > + /* if the link is not in l1ss don't turn off clocks */ > > > > > + val = readl(pcie->parf + PCIE20_PARF_PM_STTS); > > > > > + if ((val & PCIE20_PARF_PM_STTS_LINKST_IN_L1SUB)) { > > > > > + dev_dbg(dev, "Link enters L1ss after %d ms\n", > > > > > + ktime_to_ms(ktime_get() - start)); > > > > > + break; > > > > > + } > > > > > + > > > > > + if (ktime_after(ktime_get(), timeout)) { > > > > > + dev_warn(dev, "Link is not in L1ss\n"); > > > > > + return 0; > > > > > + } > > > > > + > > > > > + udelay(1000); > > > > > } > > > > > -suspend: > > > > > if (pcie->cfg->ops->suspend) > > > > > pcie->cfg->ops->suspend(pcie); > > > > > -- > > > > > 2.7.4 > > > > >