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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1498481318-1894-19-git-send-email-bich.hemon@st.com>
Date:   Mon, 26 Jun 2017 12:49:16 +0000
From:   Bich HEMON <bich.hemon@...com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre TORGUE <alexandre.torgue@...com>,
        "Jiri Slaby" <jslaby@...e.com>,
        "linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     Bich HEMON <bich.hemon@...com>
Subject: [PATCH 18/20] serial: stm32: update dma buffers length

From: Bich Hemon <bich.hemon@...com>

When stm32 dma is used alone for rx, meaning that the
third dmamux property in the device tree is 0x0, then
the received data are accumulated in dma internal fifo
until it is full before being transferred to the memory.
This dma fifo is 16 bytes wide on stm32ap1 so the dma
buffer is set to 160 bytes (= 16bytes * 10).

When stm32 dma is used combined with mdma, meaning that
the third dmamux property in the device tree is 0x1, then
the received data are accumulated per 16 bytes packets
(cf. explanation above) until the rx dma transfer period
is reached, so 160 bytes with this patch.

Due to the constraints above, the usart driver should not
be used in dma mode for rx when received data length is
unknown, as this is the case with the console.

There is no constraint for dma mode using for tx: this patch
simply align both rx and tx buffer lengths to the same value.

Signed-off-by: Gerald Baeza <gerald.baeza@...com>
---
 drivers/tty/serial/stm32-usart.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h
index 25ed28b..5137e68 100644
--- a/drivers/tty/serial/stm32-usart.h
+++ b/drivers/tty/serial/stm32-usart.h
@@ -238,9 +238,9 @@ struct stm32_usart_info stm32h7_info = {
 #define STM32_SERIAL_NAME "ttyS"
 #define STM32_MAX_PORTS 8
 
-#define RX_BUF_L 200		 /* dma rx buffer length     */
+#define RX_BUF_L 160		 /* dma rx buffer length     */
 #define RX_BUF_P RX_BUF_L	 /* dma rx buffer period     */
-#define TX_BUF_L 200		 /* dma tx buffer length     */
+#define TX_BUF_L RX_BUF_L	 /* dma tx buffer length     */
 
 struct stm32_port {
 	struct uart_port port;
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ