linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: dwc: Enable runtime pm of the host bridge
@ 2024-02-19 13:21 Krishna chaitanya chundru
  2024-02-26 15:53 ` Manivannan Sadhasivam
  0 siblings, 1 reply; 3+ messages in thread
From: Krishna chaitanya chundru @ 2024-02-19 13:21 UTC (permalink / raw)
  To: Jingoo Han, Gustavo Pimentel, Manivannan Sadhasivam,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
	Bjorn Helgaas
  Cc: linux-pci, linux-kernel, quic_vbadigan, quic_ramkri,
	quic_nitegupt, quic_skananth, quic_parass,
	Krishna chaitanya chundru

Currently controller driver goes to runtime suspend irrespective
of the child(pci-pci bridge & endpoint driver) runtime state.
This is because the runtime pm is not being enabled for the host
bridge dev which maintains parent child relationship.

So enable pm runtime for the host bridge, so that controller driver
goes to suspend only when all child devices goes to runtime suspend.

Signed-off-by: Krishna chaitanya chundru <quic_krichai@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);
+	pm_runtime_enable(&bridge->dev);
+
 	return 0;
 
 err_stop_link:

---
base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
change-id: 20240219-runtime_pm_enable-bdc17914bd50

Best regards,
-- 
Krishna chaitanya chundru <quic_krichai@quicinc.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: dwc: Enable runtime pm of the host bridge
  2024-02-19 13:21 [PATCH] PCI: dwc: Enable runtime pm of the host bridge Krishna chaitanya chundru
@ 2024-02-26 15:53 ` Manivannan Sadhasivam
  2024-02-27  7:38   ` Krishna Chaitanya Chundru
  0 siblings, 1 reply; 3+ messages in thread
From: Manivannan Sadhasivam @ 2024-02-26 15:53 UTC (permalink / raw)
  To: Krishna chaitanya chundru
  Cc: Jingoo Han, Gustavo Pimentel, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, linux-pci,
	linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt,
	quic_skananth, quic_parass

On Mon, Feb 19, 2024 at 06:51:10PM +0530, Krishna chaitanya chundru wrote:
> Currently controller driver goes to runtime suspend irrespective
> of the child(pci-pci bridge & endpoint driver) runtime state.
> This is because the runtime pm is not being enabled for the host
> bridge dev which maintains parent child relationship.
> 

You should describe the parent-child topology first. Maybe a simple flow like
below will help:

	PCIe Controller
	      |
	PCIe Host bridge
	      |
	PCI-PCI bridge
	      |
	PCIe endpoint

Also explain the fact that 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. And this causes the topology breakage and also
possible PM issues.

- Mani

> So enable pm runtime for the host bridge, so that controller driver
> goes to suspend only when all child devices goes to runtime suspend.
> 
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@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);
> +	pm_runtime_enable(&bridge->dev);
> +
>  	return 0;
>  
>  err_stop_link:
> 
> ---
> base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
> change-id: 20240219-runtime_pm_enable-bdc17914bd50
> 
> Best regards,
> -- 
> Krishna chaitanya chundru <quic_krichai@quicinc.com>
> 

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: dwc: Enable runtime pm of the host bridge
  2024-02-26 15:53 ` Manivannan Sadhasivam
@ 2024-02-27  7:38   ` Krishna Chaitanya Chundru
  0 siblings, 0 replies; 3+ messages in thread
From: Krishna Chaitanya Chundru @ 2024-02-27  7:38 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Jingoo Han, Gustavo Pimentel, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, linux-pci,
	linux-kernel, quic_vbadigan, quic_ramkri, quic_nitegupt,
	quic_skananth, quic_parass



On 2/26/2024 9:23 PM, Manivannan Sadhasivam wrote:
> On Mon, Feb 19, 2024 at 06:51:10PM +0530, Krishna chaitanya chundru wrote:
>> Currently controller driver goes to runtime suspend irrespective
>> of the child(pci-pci bridge & endpoint driver) runtime state.
>> This is because the runtime pm is not being enabled for the host
>> bridge dev which maintains parent child relationship.
>>
> 
> You should describe the parent-child topology first. Maybe a simple flow like
> below will help:
> 
> 	PCIe Controller
> 	      |
> 	PCIe Host bridge
> 	      |
> 	PCI-PCI bridge
> 	      |
> 	PCIe endpoint
> 
> Also explain the fact that 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. And this causes the topology breakage and also
> possible PM issues.
> 
> - Mani
>
ACK.

- Krishna Chaitanya.
>> So enable pm runtime for the host bridge, so that controller driver
>> goes to suspend only when all child devices goes to runtime suspend.
>>
>> Signed-off-by: Krishna chaitanya chundru <quic_krichai@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);
>> +	pm_runtime_enable(&bridge->dev);
>> +
>>   	return 0;
>>   
>>   err_stop_link:
>>
>> ---
>> base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
>> change-id: 20240219-runtime_pm_enable-bdc17914bd50
>>
>> Best regards,
>> -- 
>> Krishna chaitanya chundru <quic_krichai@quicinc.com>
>>
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-27  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-19 13:21 [PATCH] PCI: dwc: Enable runtime pm of the host bridge Krishna chaitanya chundru
2024-02-26 15:53 ` Manivannan Sadhasivam
2024-02-27  7:38   ` Krishna Chaitanya Chundru

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).