Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Diogo Ivo" <diogo.ivo.sx@renesas.com>
Cc: linux-serial@vger.kernel.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v4 3/7] serial: rsci: Enable transmit end interrupt in rsci_stop_tx()
Date: Fri, 13 Nov 2026 19:35:00 +0000	[thread overview]
Message-ID: <sashiko-outbox-213556@kernel.org> (raw)
In-Reply-To: <20261113-g2ul_sci-v4-3-6815e41d90c5@renesas.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] serial: rsci: TX restart on suspend in sci_tx_end_interrupt()
--

commit 071c63519ac773139fb715b1e8e4f93c225b5ba8
Author: Diogo Ivo <diogo.ivo.sx@renesas.com>

serial: rsci: Enable transmit end interrupt in rsci_stop_tx()

This commit enables the transmit end interrupt (CCR0_TEIE) in
rsci_stop_tx() when transmission is active (CCR0_TE is set) so that
sci_tx_end_interrupt() clears CCR0_TE once in-flight data finishes
shifting out.

> diff --git a/drivers/tty/serial/rsci.c b/drivers/tty/serial/rsci.c
> index 0391111db8ae8..05703bb31afde 100644
> --- a/drivers/tty/serial/rsci.c
> +++ b/drivers/tty/serial/rsci.c
> @@ -409,6 +409,8 @@ static void rsci_stop_tx(struct uart_port *port)
>  
>  	ctrl = rsci_serial_in(port, CCR0);
>  	ctrl &= ~CCR0_TIE;
> +	if (ctrl & CCR0_TE)
> +		ctrl |= CCR0_TEIE;
>  	rsci_serial_out(port, CCR0, ctrl);
>  }

[Severity: Medium]
Can enabling CCR0_TEIE here cause sci_tx_end_interrupt() to restart
transmission during system suspend?

uart_suspend_port() sets uport->suspended = 1 and calls ops->stop_tx()
and ops->set_mctrl(uport, 0) without setting tty->flow.stopped or
uport->hw_stopped, then drops uport->lock to wait up to 30ms for the
hardware transmitter to empty.  When the in-flight bytes finish shifting
out, the resulting TEI interrupt sees !uart_tx_stopped(port) as true and
resumes transmission if tport->xmit_fifo still has queued data:

drivers/tty/serial/sh-sci.c:sci_tx_end_interrupt() {
    ...
	if (port->x_char || (!kfifo_is_empty(&tport->xmit_fifo) &&
			     !uart_tx_stopped(port))) {
		ctrl &= ~(s->params->param_bits->teie);
		ctrl |= s->params->param_bits->tie;
		s->ops->write_reg(port, regs->control, ctrl);
		s->ops->transmit_chars(port);
    ...
}

This keeps transmitting after stop_tx() and modem control deassertion,
and if xmit_fifo does not empty within 30ms, uart_suspend_port() times
out with "Unable to drain transmitter" and calls ops->shutdown()
mid-transmission.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113-g2ul_sci-v4-0-6815e41d90c5@renesas.com?part=3

  reply	other threads:[~2026-11-13 19:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 18:26 [PATCH v4 0/7] Fix transmit handling on SCI/RSCI ports Diogo Ivo
2026-11-13 18:26 ` [PATCH v4 1/7] serial: sh-sci: Drop TE disable at end of transmission on SCI Diogo Ivo
2026-11-13 18:42   ` sashiko-bot
2026-11-13 18:26 ` [PATCH v4 2/7] serial: sh-sci: Keep TX enabled on TEI while data is pending Diogo Ivo
2026-11-13 19:18   ` sashiko-bot
2026-11-13 18:26 ` [PATCH v4 3/7] serial: rsci: Enable transmit end interrupt in rsci_stop_tx() Diogo Ivo
2026-11-13 19:35   ` sashiko-bot [this message]
2026-11-13 18:26 ` [PATCH v4 4/7] serial: sh-sci: Do not kick TX from sci_er_interrupt() on RSCI Diogo Ivo
2026-11-13 19:38   ` sashiko-bot
2026-11-13 18:26 ` [PATCH v4 5/7] serial: sh-sci: Skip TDxE clear when hardware clears it automatically Diogo Ivo
2026-11-13 19:47   ` sashiko-bot
2026-11-13 18:26 ` [PATCH v4 6/7] serial: sh-sci: Toggle TE when restoring SCSCR in console write on SCI Diogo Ivo
2026-11-13 19:56   ` sashiko-bot
2026-11-13 18:26 ` [PATCH v4 7/7] serial: rsci: Simplify rsci_transmit_chars() Diogo Ivo
2026-11-13 20:00   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-213556@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=diogo.ivo.sx@renesas.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox