linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fixes for the PCI dra7xx driver
@ 2024-08-27 12:24 Siddharth Vadapalli
  2024-08-27 12:24 ` [PATCH 1/2] PCI: dra7xx: Fix threaded IRQ request for "dra7xx-pcie-main" IRQ Siddharth Vadapalli
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Siddharth Vadapalli @ 2024-08-27 12:24 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, robh, vigneshr, kishon,
	manivannan.sadhasivam, j-keerthy
  Cc: linux-omap, linux-pci, linux-kernel, linux-arm-kernel, stable,
	u-kumar1, srk, s-vadapalli

Hello,

This series is based on commit
3e9bff3bbe13 Merge tag 'vfs-6.11-rc6.fixes' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs
of Mainline Linux.

The first patch fixes conversion to "devm_request_threaded_irq()" where
the IRQF_ONESHOT flag should have been added since the handler is NULL.

The second patch fixes the error handling when IRQ request fails in the
probe function. The existing error handling doesn't cleanup the changes
performed prior to the IRQ request invocation.

Regards,
Siddharth.

Siddharth Vadapalli (2):
  PCI: dra7xx: Fix threaded IRQ request for "dra7xx-pcie-main" IRQ
  PCI: dra7xx: Fix error handling when IRQ request fails in probe

 drivers/pci/controller/dwc/pci-dra7xx.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

-- 
2.40.1



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

* [PATCH 1/2] PCI: dra7xx: Fix threaded IRQ request for "dra7xx-pcie-main" IRQ
  2024-08-27 12:24 [PATCH 0/2] Fixes for the PCI dra7xx driver Siddharth Vadapalli
@ 2024-08-27 12:24 ` Siddharth Vadapalli
  2024-09-02  7:33   ` Manivannan Sadhasivam
  2024-08-27 12:24 ` [PATCH 2/2] PCI: dra7xx: Fix error handling when IRQ request fails in probe Siddharth Vadapalli
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Siddharth Vadapalli @ 2024-08-27 12:24 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, robh, vigneshr, kishon,
	manivannan.sadhasivam, j-keerthy
  Cc: linux-omap, linux-pci, linux-kernel, linux-arm-kernel, stable,
	u-kumar1, srk, s-vadapalli

Commit da87d35a6e51 ("PCI: dra7xx: Use threaded IRQ handler for
"dra7xx-pcie-main" IRQ") switched from devm_request_irq() to
devm_request_threaded_irq() for the "dra7xx-pcie-main" interrupt.
Since the primary handler was set to NULL, the "IRQF_ONESHOT" flag
should have also been set. Fix this.

Fixes: da87d35a6e51 ("PCI: dra7xx: Use threaded IRQ handler for "dra7xx-pcie-main" IRQ")
Cc: <stable@vger.kernel.org>
Reported-by: Udit Kumar <u-kumar1@ti.com>
Suggested-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
---
 drivers/pci/controller/dwc/pci-dra7xx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
index 4fe3b0cb72ec..20fb50741f3d 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -850,7 +850,8 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
 	dra7xx->mode = mode;
 
 	ret = devm_request_threaded_irq(dev, irq, NULL, dra7xx_pcie_irq_handler,
-			       IRQF_SHARED, "dra7xx-pcie-main", dra7xx);
+					IRQF_SHARED | IRQF_ONESHOT,
+					"dra7xx-pcie-main", dra7xx);
 	if (ret) {
 		dev_err(dev, "failed to request irq\n");
 		goto err_gpio;
-- 
2.40.1



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

* [PATCH 2/2] PCI: dra7xx: Fix error handling when IRQ request fails in probe
  2024-08-27 12:24 [PATCH 0/2] Fixes for the PCI dra7xx driver Siddharth Vadapalli
  2024-08-27 12:24 ` [PATCH 1/2] PCI: dra7xx: Fix threaded IRQ request for "dra7xx-pcie-main" IRQ Siddharth Vadapalli
@ 2024-08-27 12:24 ` Siddharth Vadapalli
  2024-08-27 14:00   ` Kumar, Udit
  2024-09-02  7:40   ` Manivannan Sadhasivam
  2024-08-30 19:50 ` [PATCH 0/2] Fixes for the PCI dra7xx driver Kevin Hilman
  2024-09-13 22:51 ` Krzysztof Wilczyński
  3 siblings, 2 replies; 8+ messages in thread
From: Siddharth Vadapalli @ 2024-08-27 12:24 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, robh, vigneshr, kishon,
	manivannan.sadhasivam, j-keerthy
  Cc: linux-omap, linux-pci, linux-kernel, linux-arm-kernel, stable,
	u-kumar1, srk, s-vadapalli

Commit d4c7d1a089d6 ("PCI: dwc: dra7xx: Push request_irq() call to the
bottom of probe") moved the IRQ request for "dra7xx-pcie-main" towards
the end of dra7xx_pcie_probe(). However, the error handling does not take
into account the initialization performed by either dra7xx_add_pcie_port()
or dra7xx_add_pcie_ep(), depending on the mode of operation. Fix the error
handling to address this.

Fixes: d4c7d1a089d6 ("PCI: dwc: dra7xx: Push request_irq() call to the bottom of probe")
Cc: <stable@vger.kernel.org>
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
---
 drivers/pci/controller/dwc/pci-dra7xx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
index 20fb50741f3d..5c62e1a3ba52 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -854,11 +854,17 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
 					"dra7xx-pcie-main", dra7xx);
 	if (ret) {
 		dev_err(dev, "failed to request irq\n");
-		goto err_gpio;
+		goto err_deinit;
 	}
 
 	return 0;
 
+err_deinit:
+	if (dra7xx->mode == DW_PCIE_RC_TYPE)
+		dw_pcie_host_deinit(&dra7xx->pci->pp);
+	else
+		dw_pcie_ep_deinit(&dra7xx->pci->ep);
+
 err_gpio:
 err_get_sync:
 	pm_runtime_put(dev);
-- 
2.40.1



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

* Re: [PATCH 2/2] PCI: dra7xx: Fix error handling when IRQ request fails in probe
  2024-08-27 12:24 ` [PATCH 2/2] PCI: dra7xx: Fix error handling when IRQ request fails in probe Siddharth Vadapalli
@ 2024-08-27 14:00   ` Kumar, Udit
  2024-09-02  7:40   ` Manivannan Sadhasivam
  1 sibling, 0 replies; 8+ messages in thread
From: Kumar, Udit @ 2024-08-27 14:00 UTC (permalink / raw)
  To: Siddharth Vadapalli, bhelgaas, lpieralisi, kw, robh, vigneshr,
	kishon, manivannan.sadhasivam, j-keerthy
  Cc: linux-omap, linux-pci, linux-kernel, linux-arm-kernel, stable,
	srk


On 8/27/2024 5:54 PM, Siddharth Vadapalli wrote:
> Commit d4c7d1a089d6 ("PCI: dwc: dra7xx: Push request_irq() call to the
> bottom of probe") moved the IRQ request for "dra7xx-pcie-main" towards
> the end of dra7xx_pcie_probe(). However, the error handling does not take
> into account the initialization performed by either dra7xx_add_pcie_port()
> or dra7xx_add_pcie_ep(), depending on the mode of operation. Fix the error
> handling to address this.
>
> Fixes: d4c7d1a089d6 ("PCI: dwc: dra7xx: Push request_irq() call to the bottom of probe")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> ---
>   drivers/pci/controller/dwc/pci-dra7xx.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
> index 20fb50741f3d..5c62e1a3ba52 100644
> --- a/drivers/pci/controller/dwc/pci-dra7xx.c
> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c
> @@ -854,11 +854,17 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
>   					"dra7xx-pcie-main", dra7xx);
>   	if (ret) {
>   		dev_err(dev, "failed to request irq\n");
> -		goto err_gpio;
> +		goto err_deinit;
>   	}
>   
>   	return 0;
>   
> +err_deinit:
> +	if (dra7xx->mode == DW_PCIE_RC_TYPE)
> +		dw_pcie_host_deinit(&dra7xx->pci->pp);
> +	else
> +		dw_pcie_ep_deinit(&dra7xx->pci->ep);


dw_pcie_ep_deinit may not be available in previous kernels

Otherwise
Tested-by: Udit Kumar <u-kumar1@ti.com>

> +
>   err_gpio:
>   err_get_sync:
>   	pm_runtime_put(dev);


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

* Re: [PATCH 0/2] Fixes for the PCI dra7xx driver
  2024-08-27 12:24 [PATCH 0/2] Fixes for the PCI dra7xx driver Siddharth Vadapalli
  2024-08-27 12:24 ` [PATCH 1/2] PCI: dra7xx: Fix threaded IRQ request for "dra7xx-pcie-main" IRQ Siddharth Vadapalli
  2024-08-27 12:24 ` [PATCH 2/2] PCI: dra7xx: Fix error handling when IRQ request fails in probe Siddharth Vadapalli
@ 2024-08-30 19:50 ` Kevin Hilman
  2024-09-13 22:51 ` Krzysztof Wilczyński
  3 siblings, 0 replies; 8+ messages in thread
From: Kevin Hilman @ 2024-08-30 19:50 UTC (permalink / raw)
  To: s-vadapalli
  Cc: bhelgaas, j-keerthy, kishon, kw, linux-arm-kernel, linux-kernel,
	linux-omap, linux-pci, lpieralisi, manivannan.sadhasivam, robh,
	srk, stable, u-kumar1, vigneshr

> This series is based on commit
> 3e9bff3bbe13 Merge tag 'vfs-6.11-rc6.fixes' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs
> of Mainline Linux.
> 
> The first patch fixes conversion to "devm_request_threaded_irq()" where
> the IRQF_ONESHOT flag should have been added since the handler is NULL.
> 
> The second patch fixes the error handling when IRQ request fails in the
> probe function. The existing error handling doesn't cleanup the changes
> performed prior to the IRQ request invocation.

I tested this patch on v6.11-rc5 using a am57xx-beagle-x15 with a SATA
drive connected to the eSATA port, and confirm that this allows
booting again.

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

Kevin


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

* Re: [PATCH 1/2] PCI: dra7xx: Fix threaded IRQ request for "dra7xx-pcie-main" IRQ
  2024-08-27 12:24 ` [PATCH 1/2] PCI: dra7xx: Fix threaded IRQ request for "dra7xx-pcie-main" IRQ Siddharth Vadapalli
@ 2024-09-02  7:33   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam @ 2024-09-02  7:33 UTC (permalink / raw)
  To: Siddharth Vadapalli
  Cc: bhelgaas, lpieralisi, kw, robh, vigneshr, kishon, j-keerthy,
	linux-omap, linux-pci, linux-kernel, linux-arm-kernel, stable,
	u-kumar1, srk

On Tue, Aug 27, 2024 at 05:54:21PM +0530, Siddharth Vadapalli wrote:
> Commit da87d35a6e51 ("PCI: dra7xx: Use threaded IRQ handler for
> "dra7xx-pcie-main" IRQ") switched from devm_request_irq() to
> devm_request_threaded_irq() for the "dra7xx-pcie-main" interrupt.
> Since the primary handler was set to NULL, the "IRQF_ONESHOT" flag
> should have also been set. Fix this.
> 
> Fixes: da87d35a6e51 ("PCI: dra7xx: Use threaded IRQ handler for "dra7xx-pcie-main" IRQ")
> Cc: <stable@vger.kernel.org>
> Reported-by: Udit Kumar <u-kumar1@ti.com>
> Suggested-by: Vignesh Raghavendra <vigneshr@ti.com>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>

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

- Mani

> ---
>  drivers/pci/controller/dwc/pci-dra7xx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
> index 4fe3b0cb72ec..20fb50741f3d 100644
> --- a/drivers/pci/controller/dwc/pci-dra7xx.c
> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c
> @@ -850,7 +850,8 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
>  	dra7xx->mode = mode;
>  
>  	ret = devm_request_threaded_irq(dev, irq, NULL, dra7xx_pcie_irq_handler,
> -			       IRQF_SHARED, "dra7xx-pcie-main", dra7xx);
> +					IRQF_SHARED | IRQF_ONESHOT,
> +					"dra7xx-pcie-main", dra7xx);
>  	if (ret) {
>  		dev_err(dev, "failed to request irq\n");
>  		goto err_gpio;
> -- 
> 2.40.1
> 

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


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

* Re: [PATCH 2/2] PCI: dra7xx: Fix error handling when IRQ request fails in probe
  2024-08-27 12:24 ` [PATCH 2/2] PCI: dra7xx: Fix error handling when IRQ request fails in probe Siddharth Vadapalli
  2024-08-27 14:00   ` Kumar, Udit
@ 2024-09-02  7:40   ` Manivannan Sadhasivam
  1 sibling, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam @ 2024-09-02  7:40 UTC (permalink / raw)
  To: Siddharth Vadapalli
  Cc: bhelgaas, lpieralisi, kw, robh, vigneshr, kishon, j-keerthy,
	linux-omap, linux-pci, linux-kernel, linux-arm-kernel, stable,
	u-kumar1, srk

On Tue, Aug 27, 2024 at 05:54:22PM +0530, Siddharth Vadapalli wrote:
> Commit d4c7d1a089d6 ("PCI: dwc: dra7xx: Push request_irq() call to the
> bottom of probe") moved the IRQ request for "dra7xx-pcie-main" towards
> the end of dra7xx_pcie_probe(). However, the error handling does not take
> into account the initialization performed by either dra7xx_add_pcie_port()
> or dra7xx_add_pcie_ep(), depending on the mode of operation. Fix the error
> handling to address this.
> 
> Fixes: d4c7d1a089d6 ("PCI: dwc: dra7xx: Push request_irq() call to the bottom of probe")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>

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

- Mani

> ---
>  drivers/pci/controller/dwc/pci-dra7xx.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
> index 20fb50741f3d..5c62e1a3ba52 100644
> --- a/drivers/pci/controller/dwc/pci-dra7xx.c
> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c
> @@ -854,11 +854,17 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
>  					"dra7xx-pcie-main", dra7xx);
>  	if (ret) {
>  		dev_err(dev, "failed to request irq\n");
> -		goto err_gpio;
> +		goto err_deinit;
>  	}
>  
>  	return 0;
>  
> +err_deinit:
> +	if (dra7xx->mode == DW_PCIE_RC_TYPE)
> +		dw_pcie_host_deinit(&dra7xx->pci->pp);
> +	else
> +		dw_pcie_ep_deinit(&dra7xx->pci->ep);
> +
>  err_gpio:
>  err_get_sync:
>  	pm_runtime_put(dev);
> -- 
> 2.40.1
> 

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


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

* Re: [PATCH 0/2] Fixes for the PCI dra7xx driver
  2024-08-27 12:24 [PATCH 0/2] Fixes for the PCI dra7xx driver Siddharth Vadapalli
                   ` (2 preceding siblings ...)
  2024-08-30 19:50 ` [PATCH 0/2] Fixes for the PCI dra7xx driver Kevin Hilman
@ 2024-09-13 22:51 ` Krzysztof Wilczyński
  3 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Wilczyński @ 2024-09-13 22:51 UTC (permalink / raw)
  To: Siddharth Vadapalli
  Cc: bhelgaas, lpieralisi, robh, vigneshr, kishon,
	manivannan.sadhasivam, j-keerthy, linux-omap, linux-pci,
	linux-kernel, linux-arm-kernel, stable, u-kumar1, srk

Hello,

> This series is based on commit
> 3e9bff3bbe13 Merge tag 'vfs-6.11-rc6.fixes' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs
> of Mainline Linux.
> 
> The first patch fixes conversion to "devm_request_threaded_irq()" where
> the IRQF_ONESHOT flag should have been added since the handler is NULL.
> 
> The second patch fixes the error handling when IRQ request fails in the
> probe function. The existing error handling doesn't cleanup the changes
> performed prior to the IRQ request invocation.

Applied to controller/dra7xx, thank you!

[01/02] PCI: dra7xx: Fix threaded IRQ request for "dra7xx-pcie-main" IRQ
        https://git.kernel.org/pci/pci/c/03f84b3baba7

[02/02] PCI: dra7xx: Fix error handling when IRQ request fails in probe
        https://git.kernel.org/pci/pci/c/4d60f6d4b8fa

	Krzysztof


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

end of thread, other threads:[~2024-09-13 22:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 12:24 [PATCH 0/2] Fixes for the PCI dra7xx driver Siddharth Vadapalli
2024-08-27 12:24 ` [PATCH 1/2] PCI: dra7xx: Fix threaded IRQ request for "dra7xx-pcie-main" IRQ Siddharth Vadapalli
2024-09-02  7:33   ` Manivannan Sadhasivam
2024-08-27 12:24 ` [PATCH 2/2] PCI: dra7xx: Fix error handling when IRQ request fails in probe Siddharth Vadapalli
2024-08-27 14:00   ` Kumar, Udit
2024-09-02  7:40   ` Manivannan Sadhasivam
2024-08-30 19:50 ` [PATCH 0/2] Fixes for the PCI dra7xx driver Kevin Hilman
2024-09-13 22:51 ` Krzysztof Wilczyński

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