public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] dmaengine: dw-edma: Remove runtime PM support
@ 2022-09-10  5:47 Manivannan Sadhasivam
  2022-09-29 17:08 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Manivannan Sadhasivam @ 2022-09-10  5:47 UTC (permalink / raw)
  To: gustavo.pimentel, vkoul
  Cc: dmaengine, linux-kernel, linux-arm-msm, Manivannan Sadhasivam,
	Serge Semin, Frank Li

Currently, the dw-edma driver enables the runtime_pm for parent device
(chip->dev) and increments/decrements the refcount during alloc/free
chan resources callbacks.

This leads to a problem when the eDMA driver has been probed, but the
channels were not used. This scenario can happen when the DW PCIe driver
probes eDMA driver successfully, but the PCI EPF driver decides not to
use eDMA channels and use iATU instead for PCI transfers.

In this case, the underlying device would be runtime suspended due to
pm_runtime_enable() in dw_edma_probe() and the PCI EPF driver would have
no knowledge of it.

Ideally, the eDMA driver should not be the one doing the runtime PM of
the parent device. The responsibility should instead belong to the client
drivers like PCI EPF.

So let's remove the runtime PM support from eDMA driver.

Cc: Serge Semin <fancer.lancer@gmail.com>
Cc: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---

Changes in v2:

 - Added review tag from Sergey
 - Rebased on top of v6.0.0-rc1

 drivers/dma/dw-edma/dw-edma-core.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
index 07f756479663..c54b24ff5206 100644
--- a/drivers/dma/dw-edma/dw-edma-core.c
+++ b/drivers/dma/dw-edma/dw-edma-core.c
@@ -9,7 +9,6 @@
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
-#include <linux/pm_runtime.h>
 #include <linux/dmaengine.h>
 #include <linux/err.h>
 #include <linux/interrupt.h>
@@ -682,15 +681,12 @@ static int dw_edma_alloc_chan_resources(struct dma_chan *dchan)
 	if (chan->status != EDMA_ST_IDLE)
 		return -EBUSY;
 
-	pm_runtime_get(chan->dw->chip->dev);
-
 	return 0;
 }
 
 static void dw_edma_free_chan_resources(struct dma_chan *dchan)
 {
 	unsigned long timeout = jiffies + msecs_to_jiffies(5000);
-	struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan);
 	int ret;
 
 	while (time_before(jiffies, timeout)) {
@@ -703,8 +699,6 @@ static void dw_edma_free_chan_resources(struct dma_chan *dchan)
 
 		cpu_relax();
 	}
-
-	pm_runtime_put(chan->dw->chip->dev);
 }
 
 static int dw_edma_channel_setup(struct dw_edma *dw, bool write,
@@ -977,9 +971,6 @@ int dw_edma_probe(struct dw_edma_chip *chip)
 	if (err)
 		goto err_irq_free;
 
-	/* Power management */
-	pm_runtime_enable(dev);
-
 	/* Turn debugfs on */
 	dw_edma_v0_core_debugfs_on(dw);
 
@@ -1009,9 +1000,6 @@ int dw_edma_remove(struct dw_edma_chip *chip)
 	for (i = (dw->nr_irqs - 1); i >= 0; i--)
 		free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]);
 
-	/* Power management */
-	pm_runtime_disable(dev);
-
 	/* Deregister eDMA device */
 	dma_async_device_unregister(&dw->wr_edma);
 	list_for_each_entry_safe(chan, _chan, &dw->wr_edma.channels,
-- 
2.25.1


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

* Re: [PATCH v2] dmaengine: dw-edma: Remove runtime PM support
  2022-09-10  5:47 [PATCH v2] dmaengine: dw-edma: Remove runtime PM support Manivannan Sadhasivam
@ 2022-09-29 17:08 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2022-09-29 17:08 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: gustavo.pimentel, dmaengine, linux-kernel, linux-arm-msm,
	Serge Semin, Frank Li

On 10-09-22, 11:17, Manivannan Sadhasivam wrote:
> Currently, the dw-edma driver enables the runtime_pm for parent device
> (chip->dev) and increments/decrements the refcount during alloc/free
> chan resources callbacks.
> 
> This leads to a problem when the eDMA driver has been probed, but the
> channels were not used. This scenario can happen when the DW PCIe driver
> probes eDMA driver successfully, but the PCI EPF driver decides not to
> use eDMA channels and use iATU instead for PCI transfers.
> 
> In this case, the underlying device would be runtime suspended due to
> pm_runtime_enable() in dw_edma_probe() and the PCI EPF driver would have
> no knowledge of it.
> 
> Ideally, the eDMA driver should not be the one doing the runtime PM of
> the parent device. The responsibility should instead belong to the client
> drivers like PCI EPF.
> 
> So let's remove the runtime PM support from eDMA driver.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2022-09-29 17:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-10  5:47 [PATCH v2] dmaengine: dw-edma: Remove runtime PM support Manivannan Sadhasivam
2022-09-29 17:08 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox