Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] tty: serial: qcom-geni: re-arm RX DMA on spurious zero-length interrupt
@ 2026-04-22 16:13 Vynnie Von Diktus via B4 Relay
  2026-05-11 15:21 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Vynnie Von Diktus via B4 Relay @ 2026-04-22 16:13 UTC (permalink / raw)
  To: linux-serial; +Cc: linux-kernel, Vynnie Von Diktus

From: Vynnie Von Diktus <vyndiktus@gmail.com>

qcom_geni_serial_handle_rx_dma() returns early when SE_DMA_RX_LEN_IN
reads as zero, interpreting it as a spurious interrupt. The early return
skips geni_se_rx_dma_prep(), leaving the RX DMA descriptor permanently
unarmed. All subsequently received bytes are silently dropped until the
port is closed and reopened.

On cold boots, chip startup transients on the UART lines can produce a
genuine spurious DMA interrupt with a zero-length count. The bug is
invisible on warm reboots (the UART stays powered and stable, so no
spurious interrupt fires), which makes it appear as an intermittent
failure only on power-cycle reboots.

Fix by restructuring the zero-length check to fall through to
geni_se_rx_dma_prep() in all cases. Only the data processing
(handle_rx_uart) is skipped when no bytes arrived.

Tested on SM8150 (Snapdragon 855) with a WCN3990 BT UART — Bluetooth
firmware download now succeeds on every cold boot without
"Frame reassembly failed" errors.

The same GENI serial IP block is used across SDM845, SM8150, SM8250,
SM8350 and many other Snapdragon SoCs; the bug and fix are expected to
apply to all of them.

Signed-off-by: Vynnie Von Diktus <vyndiktus@gmail.com>
---
 drivers/tty/serial/qcom_geni_serial.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 69a632fef..3c950bdc0 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -837,11 +837,9 @@ static void qcom_geni_serial_handle_rx_dma(struct uart_port *uport, bool drop)
 	rx_in = readl(uport->membase + SE_DMA_RX_LEN_IN);
 	if (!rx_in) {
 		dev_warn(uport->dev, "serial engine reports 0 RX bytes in!\n");
-		return;
-	}
-
-	if (!drop)
+	} else if (!drop) {
 		handle_rx_uart(uport, rx_in, drop);
+	}
 
 	ret = geni_se_rx_dma_prep(&port->se, port->rx_buf,
 				  DMA_RX_BUF_SIZE,

---
base-commit: 4a8d8848356e9e4c41e22de9b1ef1507ea21734a
change-id: 20260422-qcom-geni-uart-dma-rearm-a5df83e164ff

Best regards,
--  
Vynnie Von Diktus <vyndiktus@gmail.com>



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tty: serial: qcom-geni: re-arm RX DMA on spurious zero-length interrupt
  2026-04-22 16:13 [PATCH] tty: serial: qcom-geni: re-arm RX DMA on spurious zero-length interrupt Vynnie Von Diktus via B4 Relay
@ 2026-05-11 15:21 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-05-11 15:21 UTC (permalink / raw)
  To: vyndiktus; +Cc: linux-serial, linux-kernel

On Wed, Apr 22, 2026 at 04:13:03PM +0000, Vynnie Von Diktus via B4 Relay wrote:
> From: Vynnie Von Diktus <vyndiktus@gmail.com>
> 
> qcom_geni_serial_handle_rx_dma() returns early when SE_DMA_RX_LEN_IN
> reads as zero, interpreting it as a spurious interrupt. The early return
> skips geni_se_rx_dma_prep(), leaving the RX DMA descriptor permanently
> unarmed. All subsequently received bytes are silently dropped until the
> port is closed and reopened.
> 
> On cold boots, chip startup transients on the UART lines can produce a
> genuine spurious DMA interrupt with a zero-length count. The bug is
> invisible on warm reboots (the UART stays powered and stable, so no
> spurious interrupt fires), which makes it appear as an intermittent
> failure only on power-cycle reboots.
> 
> Fix by restructuring the zero-length check to fall through to
> geni_se_rx_dma_prep() in all cases. Only the data processing
> (handle_rx_uart) is skipped when no bytes arrived.
> 
> Tested on SM8150 (Snapdragon 855) with a WCN3990 BT UART — Bluetooth
> firmware download now succeeds on every cold boot without
> "Frame reassembly failed" errors.
> 
> The same GENI serial IP block is used across SDM845, SM8150, SM8250,
> SM8350 and many other Snapdragon SoCs; the bug and fix are expected to
> apply to all of them.
> 
> Signed-off-by: Vynnie Von Diktus <vyndiktus@gmail.com>
> ---
>  drivers/tty/serial/qcom_geni_serial.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 69a632fef..3c950bdc0 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -837,11 +837,9 @@ static void qcom_geni_serial_handle_rx_dma(struct uart_port *uport, bool drop)
>  	rx_in = readl(uport->membase + SE_DMA_RX_LEN_IN);
>  	if (!rx_in) {
>  		dev_warn(uport->dev, "serial engine reports 0 RX bytes in!\n");
> -		return;
> -	}
> -
> -	if (!drop)
> +	} else if (!drop) {
>  		handle_rx_uart(uport, rx_in, drop);
> +	}
>  
>  	ret = geni_se_rx_dma_prep(&port->se, port->rx_buf,
>  				  DMA_RX_BUF_SIZE,
> 
> ---
> base-commit: 4a8d8848356e9e4c41e22de9b1ef1507ea21734a
> change-id: 20260422-qcom-geni-uart-dma-rearm-a5df83e164ff
> 
> Best regards,
> --  
> Vynnie Von Diktus <vyndiktus@gmail.com>

Does not apply to the tty-next tree :(


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-11 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-22 16:13 [PATCH] tty: serial: qcom-geni: re-arm RX DMA on spurious zero-length interrupt Vynnie Von Diktus via B4 Relay
2026-05-11 15:21 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox