linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krishna Chaitanya Chundru <quic_krichai@quicinc.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: <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>, <manivannan.sadhasivam@linaro.org>,
	<swboyd@chromium.org>, <dmitry.baryshkov@linaro.org>,
	<svarbanov@mm-sol.com>, <agross@kernel.org>,
	<andersson@kernel.org>, <konrad.dybcio@somainline.org>,
	<lpieralisi@kernel.org>, <robh@kernel.org>, <kw@linux.com>,
	<bhelgaas@google.com>, <linux-phy@lists.infradead.org>,
	<vkoul@kernel.org>, <kishon@ti.com>, <mturquette@baylibre.com>,
	<linux-clk@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	<linux-pm@vger.kernel.org>
Subject: Re: [PATCH v7 1/5] PCI: qcom: Add system suspend and resume support
Date: Mon, 3 Oct 2022 17:40:21 +0530	[thread overview]
Message-ID: <f1b079c9-d0b8-6d4d-bf3d-dee45731ee88@quicinc.com> (raw)
In-Reply-To: <20220929185305.GA1912842@bhelgaas>


On 9/30/2022 12:23 AM, Bjorn Helgaas wrote:
> On Mon, Sep 26, 2022 at 09:00:11PM +0530, Krishna Chaitanya Chundru wrote:
>> On 9/23/2022 7:56 PM, Bjorn Helgaas wrote:
>>> On Fri, Sep 23, 2022 at 07:29:31AM +0530, Krishna Chaitanya Chundru wrote:
>>>> On 9/23/2022 12:12 AM, Bjorn Helgaas wrote:
>>>>> On Thu, Sep 22, 2022 at 09:09:28PM +0530, Krishna Chaitanya Chundru wrote:
>>>>>> On 9/21/2022 10:26 PM, Bjorn Helgaas wrote:
>>>>>>> On Wed, Sep 21, 2022 at 03:23:35PM +0530, Krishna Chaitanya Chundru wrote:
>>>>>>>> On 9/20/2022 11:46 PM, Bjorn Helgaas wrote:
>>>>>>>>> On Tue, Sep 20, 2022 at 03:52:23PM +0530, Krishna chaitanya chundru wrote:
>>>>>>>>>> In qcom platform PCIe resources( clocks, phy etc..) can
>>>>>>>>>> released when the link is in L1ss to reduce the power
>>>>>>>>>> consumption. So if the link is in L1ss, release the PCIe
>>>>>>>>>> resources. And when the system resumes, enable the PCIe
>>>>>>>>>> resources if they released in the suspend path.
>>>>>>>>> What's the connection with L1.x?  Links enter L1.x based on
>>>>>>>>> activity and timing.  That doesn't seem like a reliable
>>>>>>>>> indicator to turn PHYs off and disable clocks.
>>>>>>>> This is a Qcom PHY-specific feature (retaining the link state in
>>>>>>>> L1.x with clocks turned off).  It is possible only with the link
>>>>>>>> being in l1.x. PHY can't retain the link state in L0 with the
>>>>>>>> clocks turned off and we need to re-train the link if it's in L2
>>>>>>>> or L3. So we can support this feature only with L1.x.  That is
>>>>>>>> the reason we are taking l1.x as the trigger to turn off clocks
>>>>>>>> (in only suspend path).
>>>>>>> This doesn't address my question.  L1.x is an ASPM feature, which
>>>>>>> means hardware may enter or leave L1.x autonomously at any time
>>>>>>> without software intervention.  Therefore, I don't think reading the
>>>>>>> current state is a reliable way to decide anything.
>>>>>> After the link enters the L1.x it will come out only if there is
>>>>>> some activity on the link.  AS system is suspended and NVMe driver
>>>>>> is also suspended( queues will  freeze in suspend) who else can
>>>>>> initiate any data.
>>>>> I don't think we can assume that nothing will happen to cause exit
>>>>> from L1.x.  For instance, PCIe Messages for INTx signaling, LTR, OBFF,
>>>>> PTM, etc., may be sent even though we think the device is idle and
>>>>> there should be no link activity.
>>>> I don't think after the link enters into L1.x there will some
>>>> activity on the link as you mentioned, except for PCIe messages like
>>>> INTx/MSI/MSIX. These messages also will not come because the client
>>>> drivers like NVMe will keep their device in the lowest power mode.
>>>>
>>>> The link will come out of L1.x only when there is config or memory
>>>> access or some messages to trigger the interrupts from the devices.
>>>> We are already making sure this access will not be there in S3.  If
>>>> the link is in L0 or L0s what you said is expected but not in L1.x
>>> Forgive me for being skeptical, but we just spent a few months
>>> untangling the fact that some switches send PTM request messages even
>>> when they're in a non-D0 state.  We expected that devices in D3hot
>>> would not send such messages because "why would they?"  But it turns
>>> out the spec allows that, and they actually *do*.
>>>
>>> I don't think it's robust interoperable design for a PCI controller
>>> driver like qcom to assume anything about PCI devices unless it's
>>> required by the spec.
>>  From pci spec 4, in sec 5.5
>> "Ports that support L1 PM Substates must not require a reference clock while
>> in L1 PM Substates
>> other than L1.0".
>> If there is no reference clk we can say there is no activity on the link.
>> If anything needs to be sent (such as LTR, or some messages ), the link
>> needs to be back in L0 before it
>> sends the packet to the link partner.
>>
>> To exit from L1.x clkreq pin should be asserted.
>>
>> In suspend after turning off clocks and phy we can enable to trigger an
>> interrupt whenever the clk req pin asserts.
>> In that interrupt handler, we can enable the pcie resources back.
>  From the point of view of the endpoint driver, ASPM should be
> invisible -- no software intervention required.  I think you're
> suggesting that the PCIe controller driver could help exit L1.x by
> handling a clk req interrupt and enabling clock and PHY then.
>
> But doesn't L1.x exit also have to happen within the time the endpoint
> can tolerate?  E.g., I think L1.2 exit has to happen within the LTR
> time advertised by the endpoint (PCIe r6.0, sec 5.5.5).  How can we
> guarantee that if software is involved?
It is true that it is difficult to guarantee those delays. On our internal
boards, we are able to achieve this but that is not with linux kernel.

With NVMe attach we have connected the protocol analyzer and tried to see if
there are any transactions over the link. We found there are no transactions
on the link once the link enters L1.x till we resume the system. As the NVMe
is a passive system it is not initiating any transactions.

This whole requirement came from the NVMe driver, it requires keeping 
the link
active state when the system is suspended.

There are only two things we can in do in PCIe suspend as we have to 
turn off
PCIe clocks to allow the system to the lowest possible power state.
1) Keep the device in D3 cold and turn off all the clocks and phy etc.( 
It is not
an ideal one as this decreases the NVMe lifetime because link-down and 
link-up
is treated as a power cycle by a few NVMe devices).
2) This is the one we are proposing where we turn off the clocks, phy 
once the
link enters L1ss.

Can you please suggest us any other possible solutions to meet NVMe 
requirement
(That is to keep the link active during suspend) and the Qcom platform
requirement (that is to turn off all the clocks to allow a lower possible
power state)? Qcom PCIe controller is compatible with v3.1 specification 
only.


Thanks & Regards,
Krishna Chaitanya.


  reply	other threads:[~2022-10-03 12:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 10:22 [PATCH v7 0/5] PCI: qcom: Add system suspend & resume support Krishna chaitanya chundru
2022-09-20 10:22 ` [PATCH v7 1/5] PCI: qcom: Add system suspend and " Krishna chaitanya chundru
2022-09-20 18:16   ` Bjorn Helgaas
2022-09-21  9:53     ` Krishna Chaitanya Chundru
2022-09-21 16:56       ` Bjorn Helgaas
2022-09-22 15:39         ` Krishna Chaitanya Chundru
2022-09-22 18:42           ` Bjorn Helgaas
2022-09-23  1:59             ` Krishna Chaitanya Chundru
2022-09-23 14:26               ` Bjorn Helgaas
2022-09-25  1:53                 ` Krishna Chaitanya Chundru
2022-09-28 14:32                   ` Krishna Chaitanya Chundru
2022-09-26 15:30                 ` Krishna Chaitanya Chundru
2022-09-29 18:53                   ` Bjorn Helgaas
2022-10-03 12:10                     ` Krishna Chaitanya Chundru [this message]
2022-10-05 21:13                       ` Bjorn Helgaas
2022-10-12 14:06                         ` Krishna Chaitanya Chundru
2022-10-13  0:44                           ` Bjorn Helgaas
2022-09-20 21:58   ` Jeff Johnson
2022-09-20 10:22 ` [PATCH v7 2/5] PCI: qcom: Add retry logic for link to be stable in either L1.1 or L1.2 Krishna chaitanya chundru
2022-09-20 22:00   ` Jeff Johnson
2022-09-24  6:05   ` Vinod Koul
2022-09-25  1:51     ` Krishna Chaitanya Chundru
2022-09-20 10:22 ` [PATCH v7 3/5] phy: core: Add support for phy suspend & resume Krishna chaitanya chundru
2022-09-20 10:22 ` [PATCH v7 4/5] phy: qcom: Add power suspend & resume callbacks to PCIe phy Krishna chaitanya chundru
2022-09-20 10:22 ` [PATCH v7 5/5] clk: qcom: gcc-sc7280: Update the .pwrsts for PCIe GDSC Krishna chaitanya chundru
2022-09-27  3:23 ` (subset) [PATCH v7 0/5] PCI: qcom: Add system suspend & resume support Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f1b079c9-d0b8-6d4d-bf3d-dee45731ee88@quicinc.com \
    --to=quic_krichai@quicinc.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=helgaas@kernel.org \
    --cc=kishon@ti.com \
    --cc=konrad.dybcio@somainline.org \
    --cc=kw@linux.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mka@chromium.org \
    --cc=mturquette@baylibre.com \
    --cc=quic_hemantk@quicinc.com \
    --cc=quic_nitegupt@quicinc.com \
    --cc=quic_ramkri@quicinc.com \
    --cc=quic_skananth@quicinc.com \
    --cc=quic_vbadigan@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=svarbanov@mm-sol.com \
    --cc=swboyd@chromium.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).