linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] PCI: qcom: Fix probe error paths
@ 2022-04-01 13:38 Johan Hovold
  2022-04-01 13:38 ` [PATCH v2 1/2] PCI: qcom: Fix runtime PM imbalance on probe errors Johan Hovold
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Johan Hovold @ 2022-04-01 13:38 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Stanimir Varbanov, Andy Gross, Bjorn Andersson
  Cc: Rob Herring, Krzysztof Wilczyński, Bjorn Helgaas,
	Dmitry Baryshkov, linux-pci, linux-arm-msm, linux-kernel,
	Johan Hovold

This series fixes a few problems in the probe error handling which could
cause trouble, for example, on probe deferral.

Johan


Changes in v2
 - Capitalise subject lines according to PCI subsystem conventions


Johan Hovold (2):
  PCI: qcom: Fix runtime PM imbalance on probe errors
  PCI: qcom: Fix unbalanced PHY init on probe errors

 drivers/pci/controller/dwc/pcie-qcom.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

-- 
2.35.1


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

* [PATCH v2 1/2] PCI: qcom: Fix runtime PM imbalance on probe errors
  2022-04-01 13:38 [PATCH v2 0/2] PCI: qcom: Fix probe error paths Johan Hovold
@ 2022-04-01 13:38 ` Johan Hovold
  2022-04-27  7:54   ` Manivannan Sadhasivam
  2022-04-01 13:38 ` [PATCH v2 2/2] PCI: qcom: Fix unbalanced PHY init " Johan Hovold
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Johan Hovold @ 2022-04-01 13:38 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Stanimir Varbanov, Andy Gross, Bjorn Andersson
  Cc: Rob Herring, Krzysztof Wilczyński, Bjorn Helgaas,
	Dmitry Baryshkov, linux-pci, linux-arm-msm, linux-kernel,
	Johan Hovold, stable

Drop the leftover pm_runtime_disable() calls from the late probe error
paths that would, for example, prevent runtime PM from being reenabled
after a probe deferral.

Fixes: 6e5da6f7d824 ("PCI: qcom: Fix error handling in runtime PM support")
Cc: stable@vger.kernel.org      # 4.20
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 20a0e6533a1c..0b0bd71f1bd2 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1616,17 +1616,14 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	pp->ops = &qcom_pcie_dw_ops;
 
 	ret = phy_init(pcie->phy);
-	if (ret) {
-		pm_runtime_disable(&pdev->dev);
+	if (ret)
 		goto err_pm_runtime_put;
-	}
 
 	platform_set_drvdata(pdev, pcie);
 
 	ret = dw_pcie_host_init(pp);
 	if (ret) {
 		dev_err(dev, "cannot initialize host\n");
-		pm_runtime_disable(&pdev->dev);
 		goto err_pm_runtime_put;
 	}
 
-- 
2.35.1


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

* [PATCH v2 2/2] PCI: qcom: Fix unbalanced PHY init on probe errors
  2022-04-01 13:38 [PATCH v2 0/2] PCI: qcom: Fix probe error paths Johan Hovold
  2022-04-01 13:38 ` [PATCH v2 1/2] PCI: qcom: Fix runtime PM imbalance on probe errors Johan Hovold
@ 2022-04-01 13:38 ` Johan Hovold
  2022-04-27  7:55   ` Manivannan Sadhasivam
  2022-04-27  7:42 ` [PATCH v2 0/2] PCI: qcom: Fix probe error paths Johan Hovold
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Johan Hovold @ 2022-04-01 13:38 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Stanimir Varbanov, Andy Gross, Bjorn Andersson
  Cc: Rob Herring, Krzysztof Wilczyński, Bjorn Helgaas,
	Dmitry Baryshkov, linux-pci, linux-arm-msm, linux-kernel,
	Johan Hovold, stable

Make sure to undo the PHY initialisation (e.g. balance runtime PM) in
case host initialisation fails during probe.

Fixes: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver")
Cc: stable@vger.kernel.org      # 4.5
Cc: Stanimir Varbanov <svarbanov@mm-sol.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 0b0bd71f1bd2..df47986bda29 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1624,11 +1624,13 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	ret = dw_pcie_host_init(pp);
 	if (ret) {
 		dev_err(dev, "cannot initialize host\n");
-		goto err_pm_runtime_put;
+		goto err_phy_exit;
 	}
 
 	return 0;
 
+err_phy_exit:
+	phy_exit(pcie->phy);
 err_pm_runtime_put:
 	pm_runtime_put(dev);
 	pm_runtime_disable(dev);
-- 
2.35.1


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

* Re: [PATCH v2 0/2] PCI: qcom: Fix probe error paths
  2022-04-01 13:38 [PATCH v2 0/2] PCI: qcom: Fix probe error paths Johan Hovold
  2022-04-01 13:38 ` [PATCH v2 1/2] PCI: qcom: Fix runtime PM imbalance on probe errors Johan Hovold
  2022-04-01 13:38 ` [PATCH v2 2/2] PCI: qcom: Fix unbalanced PHY init " Johan Hovold
@ 2022-04-27  7:42 ` Johan Hovold
  2022-04-27  7:56 ` Stanimir Varbanov
  2022-04-27  9:09 ` Lorenzo Pieralisi
  4 siblings, 0 replies; 8+ messages in thread
From: Johan Hovold @ 2022-04-27  7:42 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Lorenzo Pieralisi, Stanimir Varbanov, Andy Gross,
	Bjorn Andersson, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, Dmitry Baryshkov, linux-pci, linux-arm-msm,
	linux-kernel

On Fri, Apr 01, 2022 at 03:38:52PM +0200, Johan Hovold wrote:
> This series fixes a few problems in the probe error handling which could
> cause trouble, for example, on probe deferral.

> Johan Hovold (2):
>   PCI: qcom: Fix runtime PM imbalance on probe errors
>   PCI: qcom: Fix unbalanced PHY init on probe errors
> 
>  drivers/pci/controller/dwc/pcie-qcom.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Any comments to this series? Does it need a Qualcomm maintainer ack to
be merged? Bjorn?

Johan

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

* Re: [PATCH v2 1/2] PCI: qcom: Fix runtime PM imbalance on probe errors
  2022-04-01 13:38 ` [PATCH v2 1/2] PCI: qcom: Fix runtime PM imbalance on probe errors Johan Hovold
@ 2022-04-27  7:54   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam @ 2022-04-27  7:54 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Lorenzo Pieralisi, Stanimir Varbanov, Andy Gross,
	Bjorn Andersson, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, Dmitry Baryshkov, linux-pci, linux-arm-msm,
	linux-kernel, stable

On Fri, Apr 01, 2022 at 03:38:53PM +0200, Johan Hovold wrote:
> Drop the leftover pm_runtime_disable() calls from the late probe error
> paths that would, for example, prevent runtime PM from being reenabled
> after a probe deferral.
> 
> Fixes: 6e5da6f7d824 ("PCI: qcom: Fix error handling in runtime PM support")
> Cc: stable@vger.kernel.org      # 4.20
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
>  drivers/pci/controller/dwc/pcie-qcom.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index 20a0e6533a1c..0b0bd71f1bd2 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1616,17 +1616,14 @@ static int qcom_pcie_probe(struct platform_device *pdev)
>  	pp->ops = &qcom_pcie_dw_ops;
>  
>  	ret = phy_init(pcie->phy);
> -	if (ret) {
> -		pm_runtime_disable(&pdev->dev);
> +	if (ret)
>  		goto err_pm_runtime_put;
> -	}
>  
>  	platform_set_drvdata(pdev, pcie);
>  
>  	ret = dw_pcie_host_init(pp);
>  	if (ret) {
>  		dev_err(dev, "cannot initialize host\n");
> -		pm_runtime_disable(&pdev->dev);
>  		goto err_pm_runtime_put;
>  	}
>  
> -- 
> 2.35.1
> 

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

* Re: [PATCH v2 2/2] PCI: qcom: Fix unbalanced PHY init on probe errors
  2022-04-01 13:38 ` [PATCH v2 2/2] PCI: qcom: Fix unbalanced PHY init " Johan Hovold
@ 2022-04-27  7:55   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam @ 2022-04-27  7:55 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Lorenzo Pieralisi, Stanimir Varbanov, Andy Gross,
	Bjorn Andersson, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, Dmitry Baryshkov, linux-pci, linux-arm-msm,
	linux-kernel, stable

On Fri, Apr 01, 2022 at 03:38:54PM +0200, Johan Hovold wrote:
> Make sure to undo the PHY initialisation (e.g. balance runtime PM) in
> case host initialisation fails during probe.
> 
> Fixes: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver")
> Cc: stable@vger.kernel.org      # 4.5
> Cc: Stanimir Varbanov <svarbanov@mm-sol.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
>  drivers/pci/controller/dwc/pcie-qcom.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index 0b0bd71f1bd2..df47986bda29 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1624,11 +1624,13 @@ static int qcom_pcie_probe(struct platform_device *pdev)
>  	ret = dw_pcie_host_init(pp);
>  	if (ret) {
>  		dev_err(dev, "cannot initialize host\n");
> -		goto err_pm_runtime_put;
> +		goto err_phy_exit;
>  	}
>  
>  	return 0;
>  
> +err_phy_exit:
> +	phy_exit(pcie->phy);
>  err_pm_runtime_put:
>  	pm_runtime_put(dev);
>  	pm_runtime_disable(dev);
> -- 
> 2.35.1
> 

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

* Re: [PATCH v2 0/2] PCI: qcom: Fix probe error paths
  2022-04-01 13:38 [PATCH v2 0/2] PCI: qcom: Fix probe error paths Johan Hovold
                   ` (2 preceding siblings ...)
  2022-04-27  7:42 ` [PATCH v2 0/2] PCI: qcom: Fix probe error paths Johan Hovold
@ 2022-04-27  7:56 ` Stanimir Varbanov
  2022-04-27  9:09 ` Lorenzo Pieralisi
  4 siblings, 0 replies; 8+ messages in thread
From: Stanimir Varbanov @ 2022-04-27  7:56 UTC (permalink / raw)
  To: Johan Hovold, Lorenzo Pieralisi, Andy Gross, Bjorn Andersson
  Cc: Rob Herring, Krzysztof Wilczyński, Bjorn Helgaas,
	Dmitry Baryshkov, linux-pci, linux-arm-msm, linux-kernel

Hi Johan,


On 4/1/22 16:38, Johan Hovold wrote:
> This series fixes a few problems in the probe error handling which could
> cause trouble, for example, on probe deferral.
> 
> Johan
> 
> 
> Changes in v2
>  - Capitalise subject lines according to PCI subsystem conventions
> 
> 
> Johan Hovold (2):
>   PCI: qcom: Fix runtime PM imbalance on probe errors
>   PCI: qcom: Fix unbalanced PHY init on probe errors
> 
>  drivers/pci/controller/dwc/pcie-qcom.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 

Acked-by: Stanimir Varbanov <svarbanov@mm-sol.com>

-- 
regards,
Stan

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

* Re: [PATCH v2 0/2] PCI: qcom: Fix probe error paths
  2022-04-01 13:38 [PATCH v2 0/2] PCI: qcom: Fix probe error paths Johan Hovold
                   ` (3 preceding siblings ...)
  2022-04-27  7:56 ` Stanimir Varbanov
@ 2022-04-27  9:09 ` Lorenzo Pieralisi
  4 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Pieralisi @ 2022-04-27  9:09 UTC (permalink / raw)
  To: Andy Gross, Stanimir Varbanov, Johan Hovold, Bjorn Andersson
  Cc: Lorenzo Pieralisi, linux-pci, Rob Herring,
	Krzysztof Wilczyński, linux-arm-msm, Dmitry Baryshkov,
	Bjorn Helgaas, linux-kernel

On Fri, 1 Apr 2022 15:38:52 +0200, Johan Hovold wrote:
> This series fixes a few problems in the probe error handling which could
> cause trouble, for example, on probe deferral.
> 
> Johan
> 
> 
> Changes in v2
>  - Capitalise subject lines according to PCI subsystem conventions
> 
> [...]

Applied to pci/qcom, thanks!

[1/2] PCI: qcom: Fix runtime PM imbalance on probe errors
      https://git.kernel.org/lpieralisi/pci/c/b986db29ed
[2/2] PCI: qcom: Fix unbalanced PHY init on probe errors
      https://git.kernel.org/lpieralisi/pci/c/3ae93c5a97

Thanks,
Lorenzo

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

end of thread, other threads:[~2022-04-27  9:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 13:38 [PATCH v2 0/2] PCI: qcom: Fix probe error paths Johan Hovold
2022-04-01 13:38 ` [PATCH v2 1/2] PCI: qcom: Fix runtime PM imbalance on probe errors Johan Hovold
2022-04-27  7:54   ` Manivannan Sadhasivam
2022-04-01 13:38 ` [PATCH v2 2/2] PCI: qcom: Fix unbalanced PHY init " Johan Hovold
2022-04-27  7:55   ` Manivannan Sadhasivam
2022-04-27  7:42 ` [PATCH v2 0/2] PCI: qcom: Fix probe error paths Johan Hovold
2022-04-27  7:56 ` Stanimir Varbanov
2022-04-27  9:09 ` Lorenzo Pieralisi

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