linux-stable/drivers/dma/sh
Yoshihiro Shimoda 431f979f76 dmaengine: rcar-dmac: Check the done lists in rcar_dmac_chan_get_residue()
[ Upstream commit 3e081628d5 ]

This patch fixes an issue that a race condition happens between a client
driver and the rcar-dmac driver:

- The rcar_dmac_isr_transfer_end() is called.
 - The done list appears, and desc.running is the next active list.
- rcar_dmac_chan_get_residue() is called by a client driver before
  rcar_dmac_isr_channel_thread() is called.
 - The rcar_dmac_chan_get_residue() will not find any descriptors.
 - And, the following WARNING happens:
	WARN(1, "No descriptor for cookie!");

The sh-sci driver with HSCIF (921,600bps) on R-Car H3 can cause this
situation.
So, this patch checks the done lists in rcar_dmac_chan_get_residue()
and returns zero if the done lists has the argument cookie.

Tested-by: Nguyen Viet Dung <dung.nguyen.aj@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-30 07:50:48 +02:00
..
Kconfig dmaengine: sh: Use ARCH_RENESAS 2016-02-08 08:48:08 +05:30
Makefile dmaengine: sh: Remove unused R-Car HPB-DMAC driver 2015-12-10 09:43:33 +05:30
rcar-dmac.c dmaengine: rcar-dmac: Check the done lists in rcar_dmac_chan_get_residue() 2018-05-30 07:50:48 +02:00
shdma-arm.h dmaengine: shdma: Use defines instead of hardcoded numbers 2014-07-15 18:02:29 +09:00
shdma-base.c dmaengine: sh_shdma-base: convert callback to helper function 2016-08-08 08:11:43 +05:30
shdma-of.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
shdma-r8a73a4.c dmaengine: shdma: r8a73a4: Make dma_ts_shift[] static 2015-05-25 22:33:07 +05:30
shdma.h dmaengine: sh: Rework Kconfig and Makefile 2014-07-31 17:15:45 +05:30
shdmac.c dmaengine: Remove site specific OOM error messages on kzalloc 2016-06-21 21:35:00 +05:30
sudmac.c dmaengine: Remove site specific OOM error messages on kzalloc 2016-06-21 21:35:00 +05:30
usb-dmac.c dmaengine: usb-dmac: Fix DMAOR AE bit definition 2017-06-14 15:05:56 +02:00