Skip to contentSkip to conversation

Patch "dmaengine: rcar-dmac: use TCRB instead of TCR for residue" has been added to the 4.14-stable tree

PATCH [email protected] 2 participants 3 messages Dec 18, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

dmaengine: rcar-dmac: use TCRB instead of TCR for residue

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
dmaengine-rcar-dmac-use-tcrb-instead-of-tcr-for-residue.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Mon Dec 18 13:28:59 CET 2017

From: Hiroyuki Yokoyama <[email protected]>
Date: Thu, 19 Oct 2017 01:15:13 +0000
Subject: dmaengine: rcar-dmac: use TCRB instead of TCR for residue

From: Hiroyuki Yokoyama <[email protected]>

[ Upstream commit 847449f23dcbff68234525f90dd53c7c7db18cad ]

SYS/RT/Audio DMAC includes independent data buffers for reading and writing. Therefore, the read transfer counter and write transfer counter have different values.
TCR indicates read counter, and TCRB indicates write counter. The relationship is like below.

TCR TCRB
[SOURCE] -> [DMAC] -> [SINK]

In the MEM_TO_DEV direction, what really matters is how much data has been written to the device. If the DMA is interrupted between read and write, then, the data doesn't end up in the destination, so shouldn't be counted. TCRB is thus the register we should use in this cases.

In the DEV_TO_MEM direction, the situation is more complex. Both the read and write side are important. What matters from a data consumer point of view is how much data has been written to memory. On the other hand, if the transfer is interrupted between read and write, we'll end up losing data. It can also be important to report.

In the MEM_TO_MEM direction, what matters is of course how much data has been written to memory from data consumer point of view. Here, because read and write have independent data buffers, it will take a while for TCR and TCRB to become equal. Thus we should check TCRB in this case, too.

Thus, all cases we should check TCRB instead of TCR.

Without this patch, Sound Capture has noise after PluseAudio support (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate")), because the recorder will use wrong residue counter which indicates transferred from sound device, but in reality the data was not yet put to memory and recorder will record it.

---
 drivers/dma/sh/rcar-dmac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sh/rcar-dmac.c +1 -1
@@ -1310,7 +1310,7 @@ static unsigned int rcar_dmac_chan_get_r
 	}
 
 	/* Add the residue for the current chunk. */
-	residue += rcar_dmac_chan_read(chan, RCAR_DMATCR) << desc->xfer_shift;
+	residue += rcar_dmac_chan_read(chan, RCAR_DMATCRB) << desc->xfer_shift;
 
 	return residue;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/dmaengine-rcar-dmac-use-tcrb-instead-of-tcr-for-residue.patch

#1 lore raw

Hi Greg,

Quoted 7 lines · On Mon, Dec 18, 2017 at 1:56 PM, <[email protected]> wrote:

This is a note to let you know that I've just added the patch titled

dmaengine: rcar-dmac: use TCRB instead of TCR for residue

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 6 lines

The filename of the patch is:
dmaengine-rcar-dmac-use-tcrb-instead-of-tcr-for-residue.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Please drop it, cfr. commit 087ffdd2880b5dd7 ("dmaengine: Revert "rcar-dmac: use TCRB instead of TCR for residue"").

Next has a working fix, but that is not yet upstream:
a8d46a7f5d17ca9c dmaengine: rcar-dmac: ensure CHCR DE bit is actually 0 after clearing
73a47bd0da668c99 dmaengine: rcar-dmac: use TCRB instead of TCR for residue

Quoted 9 lines

From foo@baz Mon Dec 18 13:28:59 CET 2017
From: Hiroyuki Yokoyama <[email protected]>
Date: Thu, 19 Oct 2017 01:15:13 +0000
Subject: dmaengine: rcar-dmac: use TCRB instead of TCR for residue

From: Hiroyuki Yokoyama <[email protected]>

[ Upstream commit 847449f23dcbff68234525f90dd53c7c7db18cad ]

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#2 lore raw
Quoted 17 lines · Geert Uytterhoeven

Hi Greg,

Quoted 7 lines · On Mon, Dec 18, 2017 at 1:56 PM, <[email protected]> wrote:

This is a note to let you know that I've just added the patch titled

dmaengine: rcar-dmac: use TCRB instead of TCR for residue

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 6 lines

The filename of the patch is:
dmaengine-rcar-dmac-use-tcrb-instead-of-tcr-for-residue.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 7 lines

Please drop it, cfr. commit 087ffdd2880b5dd7 ("dmaengine: Revert "rcar-dmac: use TCRB instead of TCR for residue"").

Next has a working fix, but that is not yet upstream:
a8d46a7f5d17ca9c dmaengine: rcar-dmac: ensure CHCR DE bit is actually 0 after clearing
73a47bd0da668c99 dmaengine: rcar-dmac: use TCRB instead of TCR for residue

Thanks for letting me know, now also dropped from the 4.4 and 4.9 stable queues.

greg k-h