lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1463387878-7643-2-git-send-email-jiada_wang@mentor.com>
Date:	Mon, 16 May 2016 17:37:49 +0900
From:	Jiada Wang <jiada_wang@...tor.com>
To:	<vinod.koul@...el.com>, <dan.j.williams@...el.com>
CC:	<dmaengine@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<george_davis@...tor.com>, <jiada_wang@...tor.com>
Subject: [PATCH 01/10] dma: imx-sdma: use chn_real_count to report residue for UART

For uart rx dma data may not receive fully, so the number
of data read by sdma script once isn't always equal to period_len,
thus residue returned from sdma_tx_status() isn't valid for uart rx
dma. The old way to use chn_real_count to report residue should be
used for uart rx dma.

Signed-off-by: Jiada Wang <jiada_wang@...tor.com>
---
 drivers/dma/imx-sdma.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 0f6fd42..1f1b64b 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -680,6 +680,11 @@ static void sdma_update_channel_loop(struct sdma_channel *sdmac)
 		bd->mode.status |= BD_DONE;
 		sdmac->buf_tail++;
 		sdmac->buf_tail %= sdmac->num_bd;
+		if (sdmac->peripheral_type == IMX_DMATYPE_UART) {
+			/* restore mode.count after counter readed */
+			sdmac->chn_real_count = bd->mode.count;
+			bd->mode.count = sdmac->chn_count;
+		}
 	}
 }
 
@@ -1285,6 +1290,9 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
 		goto err_out;
 	}
 
+	if (sdmac->peripheral_type == IMX_DMATYPE_UART)
+		sdmac->chn_count = period_len;
+
 	while (buf < buf_len) {
 		struct sdma_buffer_descriptor *bd = &sdmac->bd[i];
 		int param;
@@ -1361,7 +1369,8 @@ static enum dma_status sdma_tx_status(struct dma_chan *chan,
 	struct sdma_channel *sdmac = to_sdma_chan(chan);
 	u32 residue;
 
-	if (sdmac->flags & IMX_DMA_SG_LOOP)
+	if ((sdmac->flags & IMX_DMA_SG_LOOP) &&
+	    (sdmac->peripheral_type != IMX_DMATYPE_UART))
 		residue = (sdmac->num_bd - sdmac->buf_tail) * sdmac->period_len;
 	else
 		residue = sdmac->chn_count - sdmac->chn_real_count;
-- 
2.4.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ