* [PATCH v1] dmaengine: dw: Initialize channel before each transfer
@ 2020-07-05 11:56 Andy Shevchenko
2020-07-06 2:14 ` Viresh Kumar
2020-07-06 4:51 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2020-07-05 11:56 UTC (permalink / raw)
To: Viresh Kumar, dmaengine, Vinod Koul; +Cc: Andy Shevchenko, Tsuchiya Yuto
In some cases DMA can be used only with a consumer which does runtime power
management and on the platforms, that have DMA auto power gating logic
(see comments in the drivers/acpi/acpi_lpss.c), may result in DMA losing
its context. Simple mitigation of this issue is to initialize channel
each time the consumer initiates a transfer.
Fixes: cfdf5b6cc598 ("dw_dmac: add support for Lynxpoint DMA controllers")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206403
Reported-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/dma/dw/core.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index 21cb2a58dbd2..a1b56f52db2f 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -118,16 +118,11 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
{
struct dw_dma *dw = to_dw_dma(dwc->chan.device);
- if (test_bit(DW_DMA_IS_INITIALIZED, &dwc->flags))
- return;
-
dw->initialize_chan(dwc);
/* Enable interrupts */
channel_set_bit(dw, MASK.XFER, dwc->mask);
channel_set_bit(dw, MASK.ERROR, dwc->mask);
-
- set_bit(DW_DMA_IS_INITIALIZED, &dwc->flags);
}
/*----------------------------------------------------------------------*/
@@ -954,8 +949,6 @@ static void dwc_issue_pending(struct dma_chan *chan)
void do_dw_dma_off(struct dw_dma *dw)
{
- unsigned int i;
-
dma_writel(dw, CFG, 0);
channel_clear_bit(dw, MASK.XFER, dw->all_chan_mask);
@@ -966,9 +959,6 @@ void do_dw_dma_off(struct dw_dma *dw)
while (dma_readl(dw, CFG) & DW_CFG_DMA_EN)
cpu_relax();
-
- for (i = 0; i < dw->dma.chancnt; i++)
- clear_bit(DW_DMA_IS_INITIALIZED, &dw->chan[i].flags);
}
void do_dw_dma_on(struct dw_dma *dw)
@@ -1032,8 +1022,6 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
/* Clear custom channel configuration */
memset(&dwc->dws, 0, sizeof(struct dw_dma_slave));
- clear_bit(DW_DMA_IS_INITIALIZED, &dwc->flags);
-
/* Disable interrupts */
channel_clear_bit(dw, MASK.XFER, dwc->mask);
channel_clear_bit(dw, MASK.BLOCK, dwc->mask);
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] dmaengine: dw: Initialize channel before each transfer
2020-07-05 11:56 [PATCH v1] dmaengine: dw: Initialize channel before each transfer Andy Shevchenko
@ 2020-07-06 2:14 ` Viresh Kumar
2020-07-06 4:51 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2020-07-06 2:14 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Viresh Kumar, dmaengine, Vinod Koul, Tsuchiya Yuto
On 05-07-20, 14:56, Andy Shevchenko wrote:
> In some cases DMA can be used only with a consumer which does runtime power
> management and on the platforms, that have DMA auto power gating logic
> (see comments in the drivers/acpi/acpi_lpss.c), may result in DMA losing
> its context. Simple mitigation of this issue is to initialize channel
> each time the consumer initiates a transfer.
>
> Fixes: cfdf5b6cc598 ("dw_dmac: add support for Lynxpoint DMA controllers")
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206403
> Reported-by: Tsuchiya Yuto <kitakar@gmail.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/dma/dw/core.c | 12 ------------
> 1 file changed, 12 deletions(-)
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] dmaengine: dw: Initialize channel before each transfer
2020-07-05 11:56 [PATCH v1] dmaengine: dw: Initialize channel before each transfer Andy Shevchenko
2020-07-06 2:14 ` Viresh Kumar
@ 2020-07-06 4:51 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2020-07-06 4:51 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Viresh Kumar, dmaengine, Tsuchiya Yuto
On 05-07-20, 14:56, Andy Shevchenko wrote:
> In some cases DMA can be used only with a consumer which does runtime power
> management and on the platforms, that have DMA auto power gating logic
> (see comments in the drivers/acpi/acpi_lpss.c), may result in DMA losing
> its context. Simple mitigation of this issue is to initialize channel
> each time the consumer initiates a transfer.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-06 4:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-05 11:56 [PATCH v1] dmaengine: dw: Initialize channel before each transfer Andy Shevchenko
2020-07-06 2:14 ` Viresh Kumar
2020-07-06 4:51 ` Vinod Koul
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).