android_kernel_oneplus_msm8998/drivers/dma
Ben Dooks 04ce0e7695 dmaengine: tegra: avoid overflow of byte tracking
[ Upstream commit e486df39305864604b7e25f2a95d51039517ac57 ]

The dma_desc->bytes_transferred counter tracks the number of bytes
moved by the DMA channel. This is then used to calculate the information
passed back in the in the tegra_dma_tx_status callback, which is usually
fine.

When the DMA channel is configured as continous, then the bytes_transferred
counter will increase over time and eventually overflow to become negative
so the residue count will become invalid and the ALSA sound-dma code will
report invalid hardware pointer values to the application. This results in
some users becoming confused about the playout position and putting audio
data in the wrong place.

To fix this issue, always ensure the bytes_transferred field is modulo the
size of the request. We only do this for the case of the cyclic transfer
done ISR as anyone attempting to move 2GiB of DMA data in one transfer
is unlikely.

Note, we don't fix the issue that we should /never/ transfer a negative
number of bytes so we could make those fields unsigned.

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-27 09:33:53 +02:00
..
bestcomm
dw dmaengine: dw: fix master selection 2016-05-04 14:48:42 -07:00
hsu dmaengine: hsu: correct use of channel status register 2016-05-04 14:48:42 -07:00
ioat driver/dma/ioat: Call del_timer_sync() without holding prep_lock 2018-11-21 09:27:33 +01:00
ipu dmaengine: ipu: Make sure the interrupt routine checks all interrupts. 2017-03-12 06:37:30 +01:00
ppc4xx
sh dmaengine: usb-dmac: Make DMAC system sleep callbacks explicit 2019-03-23 08:44:36 +01:00
xilinx
acpi-dma.c dmaengine updates for 4.4-rc1 2015-11-10 10:05:17 -08:00
amba-pl08x.c
at_hdmac.c dmaengine: at_hdmac: fix module unloading 2018-12-13 09:21:27 +01:00
at_hdmac_regs.h dmaengine: at_hdmac: use %pad format string for dma_addr_t 2015-11-16 09:21:05 +05:30
at_xdmac.c dmaengine: at_xdmac: Fix wrongfull report of a channel as in use 2019-03-23 08:44:27 +01:00
bcm2835-dma.c dmaengine: bcm2835-dma: Convert to use DMA pool 2015-12-05 15:36:32 +05:30
coh901318.c
coh901318.h
coh901318_lli.c
cppi41.c
dma-axi-dmac.c
dma-jz4740.c dmaengine: jz4740: disable/unprepare clk if probe fails 2018-02-25 11:03:41 +01:00
dma-jz4780.c dmaengine: dma-jz4780: Return error if not probed from DT 2018-11-21 09:27:33 +01:00
dmaengine.c dmaengine: Fix array index out of bounds warning in __get_unmap_pool() 2017-12-20 10:04:54 +01:00
dmaengine.h
dmatest.c dmaengine: dmatest: Abort test in case of mapping error 2019-03-23 08:44:27 +01:00
edma.c dmaengine: edma: Align the memcpy acnt array size with the transfer 2017-10-18 09:20:41 +02:00
ep93xx_dma.c dmaengine: ep93xx: Always start from BASE0 2017-06-14 13:16:22 +02:00
fsl-edma.c
fsl_raid.c
fsl_raid.h
fsldma.c
fsldma.h
idma64.c dmaengine updates for 4.4-rc1 2015-11-10 10:05:17 -08:00
idma64.h
img-mdc-dma.c
imx-dma.c dmaengine: imx-dma: fix warning comparison of distinct pointer types 2019-04-27 09:33:52 +02:00
imx-sdma.c dmaengine: imx-sdma: Handle return value of clk_prepare_enable 2018-04-13 19:50:14 +02:00
iop-adma.c
k3dma.c dmaengine: k3dma: Off by one in k3_of_dma_simple_xlate() 2018-08-24 13:26:57 +02:00
Kconfig Merge branch 'topic/idma' into for-linus 2015-10-31 07:37:05 +05:30
lpc18xx-dmamux.c
Makefile
mic_x100_dma.c dmaengine: Revert "dmaengine: mic_x100: add missing spin_unlock" 2016-01-06 15:16:36 +05:30
mic_x100_dma.h
mmp_pdma.c
mmp_tdma.c
moxart-dma.c
mpc512x_dma.c
mv_xor.c
mv_xor.h
mxs-dma.c
nbpfaxi.c
of-dma.c
omap-dma.c
pch_dma.c
pl330.c dmaengine: pl330: fix irq race with terminate_all 2018-09-26 08:35:05 +02:00
pxa_dma.c dmaengine: pxa_dma: remove duplicate const qualifier 2018-08-06 16:24:40 +02:00
qcom_bam_dma.c
s3c24xx-dma.c
sa11x0-dma.c
sirf-dma.c
ste_dma40.c
ste_dma40_ll.c
ste_dma40_ll.h
sun4i-dma.c
sun6i-dma.c
tegra20-apb-dma.c dmaengine: tegra: avoid overflow of byte tracking 2019-04-27 09:33:53 +02:00
ti-dma-crossbar.c dmaengine: ti-dma-crossbar: Fix event mapping for TPCC_EVT_MUX_60_63 2018-03-24 10:58:48 +01:00
timb_dma.c
TODO
txx9dmac.c
txx9dmac.h
virt-dma.c
virt-dma.h dmaengine: virt-dma: Fix kernel-doc annotations 2015-10-27 11:12:09 +09:00
xgene-dma.c dmaengine: xgene-dma: Fix double IRQ issue by setting IRQ_DISABLE_UNLAZY flag 2016-01-07 11:09:36 +05:30
zx296702_dma.c dmaengine: zx: fix build warning 2018-02-25 11:03:50 +01:00