All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krishna Chaitanya Chundru <quic_krichai@quicinc.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Jingoo Han" <jingoohan1@gmail.com>,
	"Gustavo Pimentel" <gustavo.pimentel@synopsys.com>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	quic_vbadigan@quicinc.com, quic_ramkri@quicinc.com,
	quic_nitegupt@quicinc.com, quic_skananth@quicinc.com,
	quic_parass@quicinc.com
Subject: Re: [PATCH v2] PCI: dwc: Enable runtime pm of the host bridge
Date: Thu, 7 Mar 2024 07:28:54 +0530	[thread overview]
Message-ID: <be760502-446b-f4cc-776d-8751bdb75ff7@quicinc.com> (raw)
In-Reply-To: <20240305195722.GA541937@bhelgaas>



On 3/6/2024 1:27 AM, Bjorn Helgaas wrote:
> On Tue, Mar 05, 2024 at 03:19:01PM +0530, Krishna chaitanya chundru wrote:
>> The Controller driver is the parent device of the PCIe host bridge,
>> PCI-PCI bridge and PCIe endpoint as shown below.
> 
> Nit: add blank line here.
> 
Ack.
>> 	PCIe controller(Top level parent & parent of host bridge)
>> 			|
>> 			v
>> 	PCIe Host bridge(Parent of PCI-PCI bridge)
>> 			|
>> 			v
>> 	PCI-PCI bridge(Parent of endpoint driver)
>> 			|
>> 			v
>> 		PCIe endpoint driver
> 
> Nit: use spaces instead of tabs to ensure this still looks good when
> "git log" indents this.  In this case it doesn't seem to matter,
> 
Ack.
>> Since runtime PM is disabled for host bridge, the state of the child
>> devices under the host bridge is not taken into account by PM framework
>> for the top level parent, PCIe controller. So PM framework, allows
>> the controller driver to enter runtime PM irrespective of the state
>> of the devices under the host bridge.
> 
> IIUC this says that we runtime suspend the controller even though
> runtime PM is disabled for the host bridge?  I have a hard time
> parsing this; can you cite a function that does this or some relevant
> documentation about how this part of runtime PM works?
> 
Generally controller should go to runtime suspend when endpoint client
drivers and pci-pci host bridge drivers goes to runtime suspend as the
controller driver is the parent, but we are observing controller driver
goes to runtime suspend even when client drivers and PCI-PCI bridge are
in active state.

Unfortunately I don't have any reference for any documentation about how
runtime PM works.
>> And this causes the topology breakage and also possible PM issues.
> 
> Not sure what this refers to, since you didn't mention topology
> breakage earlier.  And "possible PM" issues is too vague to be useful.
> 
>> So enable pm runtime for the host bridge, so that controller driver
>> goes to suspend only when all child devices goes to runtime suspend.
> 
> s/pm runtime/runtime PM/ so all the references match (unless you mean
> something different here) (also in subject line)
> 
>> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
>> ---
>> Changes in v2:
>> - Updated commit message as suggested by mani.
>> - Link to v1: https://lore.kernel.org/r/20240219-runtime_pm_enable-v1-1-d39660310504@quicinc.com
>> ---
>>   drivers/pci/controller/dwc/pcie-designware-host.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>> index d5fc31f8345f..57756a73df30 100644
>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>> @@ -16,6 +16,7 @@
>>   #include <linux/of_pci.h>
>>   #include <linux/pci_regs.h>
>>   #include <linux/platform_device.h>
>> +#include <linux/pm_runtime.h>
>>   
>>   #include "../../pci.h"
>>   #include "pcie-designware.h"
>> @@ -505,6 +506,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
>>   	if (pp->ops->post_init)
>>   		pp->ops->post_init(pp);
>>   
>> +	pm_runtime_set_active(&bridge->dev);
> 
> There are currently no callers of pm_runtime_set_active() in
> drivers/pci/controller/.  This adds it to dw_pcie_host_init(), but it
> doesn't seem to be a DWC-specific issue, so I assume other drivers and
> driver cores like cadence and mobiveil should have this, too?
> 
I think cadence and mobiveil also should have this.
>> +	pm_runtime_enable(&bridge->dev);
> 
> There are several existing calls of pci_runtime_enable(), including
> from several DWC drivers.  Are they now redundant?
> 
No These are not redundant, Those drivers are calling this
pm_runtime_enable() for their controller dev node. Here we are calling
runtime enable for the bridge dev which is allocated and used by the
PCIe framework.

- Krishna Chaitanya.
> In addition, [1] suggests that pm_runtime_enable() should be called
> *after* pm_runtime_set_active(), but these existing calls
> (dra7xx_pcie_probe(), ks_pcie_probe(), qcom_pcie_probe(),
> rcar_gen4_pcie_prepare(), tegra_pcie_config_rp()) happen *before*
> dw_pcie_host_init() calls pm_runtime_set_active().
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/power/runtime_pm.rst?id=v6.7#n582
>  >>   	return 0;
>>   
>>   err_stop_link:
>>
>> ---
>> base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
>> change-id: 20240219-runtime_pm_enable-bdc17914bd50
>>
>> Best regards,
>> -- 
>> Krishna chaitanya chundru <quic_krichai@quicinc.com>
>>

  reply	other threads:[~2024-03-07  1:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05  9:49 [PATCH v2] PCI: dwc: Enable runtime pm of the host bridge Krishna chaitanya chundru
2024-03-05 19:57 ` Bjorn Helgaas
2024-03-07  1:58   ` Krishna Chaitanya Chundru [this message]
2024-03-07 21:55     ` Bjorn Helgaas
2024-03-08  3:08       ` Krishna Chaitanya Chundru
2024-03-08 17:12         ` Bjorn Helgaas
2024-03-19 11:11           ` Manivannan Sadhasivam
2024-03-20 15:27             ` Krishna Chaitanya Chundru
2024-03-22 22:04             ` Bjorn Helgaas
2024-03-25 11:09               ` Manivannan Sadhasivam
2024-04-12 10:32                 ` Krishna Chaitanya Chundru

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=be760502-446b-f4cc-776d-8751bdb75ff7@quicinc.com \
    --to=quic_krichai@quicinc.com \
    --cc=bhelgaas@google.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=helgaas@kernel.org \
    --cc=jingoohan1@gmail.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=quic_nitegupt@quicinc.com \
    --cc=quic_parass@quicinc.com \
    --cc=quic_ramkri@quicinc.com \
    --cc=quic_skananth@quicinc.com \
    --cc=quic_vbadigan@quicinc.com \
    --cc=robh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.