From: Mykyta Poturai <Mykyta_Poturai@epam.com>
To: Edwin Thankachan <Edwin.Thankachan@electrifex.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Michal Orzel <michal.orzel@amd.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
John Ernberg <john.ernberg@actia.se>,
Xen-devel <xen-devel-bounces@lists.xenproject.org>
Subject: Re: [PATCH] drivers/char: imx-lpuart: use interrupt-driven transmit
Date: Thu, 3 Dec 2026 08:00:54 +0000 [thread overview]
Message-ID: <DNAXU5FKQ3EB.15UW2AWSC6DF8@epam.com> (raw)
In-Reply-To: <PN1PPFAD8E819240FB132FD32571E662DE3EC4B2@PN1PPFAD8E81924.INDPRD01.PROD.OUTLOOK.COM>
On Thu Dec 3, 2026 at 8:45 AM EET, Edwin Thankachan wrote:
> The driver handles the TX interrupt but never calls
> serial_async_transmit(), so every console character is written
> synchronously. serial_puts() holds the port's tx_lock with interrupts
> disabled meanwhile. Each console line therefore keeps a CPU spinning
> with interrupts off until it has been transmitted, which takes about
> 5 ms for a 60-character line at 115200 baud.
>
> Call serial_async_transmit() once the interrupt is set up, as ns16550
> does, so printk() only queues characters and the TX interrupt drains
> the buffer.
>
> This requires ->tx_ready() to return the number of characters the port
> can accept, as the serial core expects. It returns the raw UARTSTAT_TC
> bit instead, which serial_tx_interrupt() would take as a count of
> 4194304 characters. Return 1 when TDRE is set, which is also what
> ->putc() waits for.
>
> Fixes: 44e17aa60d47 ("xen/arm: Add i.MX lpuart driver")
> Signed-off-by: Edwin Thankachan <edwin.thankachan@electrifex.com>
> ---
> Tested on an i.MX95 board (Xen 4.21 based tree, which adds an i.MX95
> compatible entry): Xen, dom0 and three domUs boot.
> Build-tested on staging for arm64.
>
> Example of the stall: with guest_loglvl=all, each
> XEN_DOMCTL_memory_mapping call logs one line. Timing the dom0 privcmd
> ioctl over 16 s, the call took 5.66 ms (median) before this patch and
> 0.071 ms after.
>
> One interrupt per character is enough for a console; using the TX FIFO
> depth in ->tx_ready() could follow separately. When the transmit buffer
> overflows, characters are dropped instead of stalling the CPU, as with
> the other interrupt-driven UART drivers; "sync_console" keeps the old
> behaviour.
>
> xen/drivers/char/imx-lpuart.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/xen/drivers/char/imx-lpuart.c b/xen/drivers/char/imx-lpuart.c
> index cf034d7ed062..469d791894bd 100644
> --- a/xen/drivers/char/imx-lpuart.c
> +++ b/xen/drivers/char/imx-lpuart.c
> @@ -98,13 +98,15 @@
> temp |= (UARTCTRL_RIE | UARTCTRL_TIE);
> temp |= UARTCTRL_ILIE;
> imx_lpuart_write(uart, UARTCTRL, temp);
> +
> + serial_async_transmit(port);
> }
>
> static int imx_lpuart_tx_ready(struct serial_port *port)
> {
> struct imx_lpuart *uart = port->uart;
>
> - return imx_lpuart_read(uart, UARTSTAT) & UARTSTAT_TC;
> + return !!(imx_lpuart_read(uart, UARTSTAT) & UARTSTAT_TDRE);
> }
>
> static void imx_lpuart_putc(struct serial_port *port, char c)
>
> base-commit: 0f5037b465b647428b66ba2d413f44315d5b97d0
LGTM
Reviewed-by: Mykyta Poturai <mykyta_poturai@epam.com>
next prev parent reply other threads:[~2026-12-03 8:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 6:45 [PATCH] drivers/char: imx-lpuart: use interrupt-driven transmit Edwin Thankachan
2026-12-03 8:00 ` Mykyta Poturai [this message]
2026-12-03 8:21 ` John Ernberg
2026-12-04 1:17 ` Stefano Stabellini
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=DNAXU5FKQ3EB.15UW2AWSC6DF8@epam.com \
--to=mykyta_poturai@epam.com \
--cc=Edwin.Thankachan@electrifex.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=john.ernberg@actia.se \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel-bounces@lists.xenproject.org \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.