public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: renesas_sdhi: sys_dmac: abort DMA synced to avoid timeouts
@ 2021-06-21  7:00 Wolfram Sang
  2021-06-21  9:43 ` Niklas Söderlund
  2021-06-21  9:53 ` Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Wolfram Sang @ 2021-06-21  7:00 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Wolfram Sang, Geert Uytterhoeven

When aborting DMA, we terminate the transfer without waiting for it to
succeed. This may lead to races which can e.g. lead to timeout problems
when tuning. Remove the deprecated dmaengine_terminate_all() function
and use the explicit dmaengine_terminate_sync().

Fixes: e3de2be7368d ("mmc: tmio_mmc: fix card eject during IO with DMA")
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Geert, this fixes the issue you have seen on your Koelsch board on my
Lager board. Can you test again with this patch please?

I noticed that Renesas driver are quite an active user of this
deprecated dmaengine function. I will audit and improve the other
drivers meanwhile.

 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
index ffa64211f4de..6956b83469c8 100644
--- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
@@ -108,9 +108,9 @@ static void renesas_sdhi_sys_dmac_abort_dma(struct tmio_mmc_host *host)
 	renesas_sdhi_sys_dmac_enable_dma(host, false);
 
 	if (host->chan_rx)
-		dmaengine_terminate_all(host->chan_rx);
+		dmaengine_terminate_sync(host->chan_rx);
 	if (host->chan_tx)
-		dmaengine_terminate_all(host->chan_tx);
+		dmaengine_terminate_sync(host->chan_tx);
 
 	renesas_sdhi_sys_dmac_enable_dma(host, true);
 }
-- 
2.30.2


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

end of thread, other threads:[~2021-06-22  7:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-21  7:00 [PATCH] mmc: renesas_sdhi: sys_dmac: abort DMA synced to avoid timeouts Wolfram Sang
2021-06-21  9:43 ` Niklas Söderlund
2021-06-21  9:53 ` Geert Uytterhoeven
2021-06-21 10:52   ` Wolfram Sang
2021-06-22  7:47   ` Wolfram Sang

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