From: Eric Curtin <ericcurtin17@gmail.com>
To: gregkh@linuxfoundation.org, linux@armlinux.org.uk
Cc: jirislaby@kernel.org, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org,
Eric Curtin <ericcurtin17@gmail.com>
Subject: [PATCH v3] serial: amba-pl011: don't wait for BUSY after every earlycon character
Date: Mon, 20 Jul 2026 12:17:41 +0000 [thread overview]
Message-ID: <20260720121741.13682-1-ericcurtin17@gmail.com> (raw)
In-Reply-To: <2026071036-unworn-bunny-fec5@gregkh>
pl011_putc(), used exclusively by the pl011 earlycon (pl011_early_write()
-> uart_console_write()), waits for UART01x_FR_TXFF to clear before
writing a character (correct: don't overrun the TX FIFO) and then *also*
busy-waited for UART01x_FR_BUSY to clear before returning, i.e. it waited
for the character to be fully shifted out on the wire before the next
character in the string could even be considered.
Waiting for BUSY per character defeats the TX FIFO: instead of letting
the UART buffer several queued bytes and transmit them back to back,
every single character printed through earlycon was forced to wait for
that character's own complete transmission (a full UART bit-time at the
configured baud rate) before the driver would even look at writing the
next one. This is wasted time on real hardware, and it is much worse
under virtualization: each read of UARTFR and each write to UARTDR is
an MMIO access that traps to the hypervisor, so every extra poll is a
full VM-exit/entry round trip.
The regular (non-early) console path already gets this right: it waits
for TXFF per character while filling the FIFO, then waits for BUSY only
once, after the whole string has been written (see the tail of
pl011_console_write_atomic()). The QDF2400 erratum 44 earlycon path
(qdf2400_e44_putc()) is intentionally different because that erratum
requires waiting for the stuck BUSY bit workaround per character, and
is left untouched by this change.
This patch was written with the assistance of an AI coding tool
(OpenCode CLI, using Claude as the backing model). The tool was given
the observation that earlycon output was slower than expected under
virtualization and asked to locate the cause and propose a fix; it
identified the redundant per-character BUSY wait in pl011_putc() shown
above and produced the one-line removal in this patch. The analysis
and diff were reviewed by hand against the driver's other console
write paths (pl011_console_write_atomic()/qdf2400_e44_putc()) to
confirm the change is safe and does not affect the QDF2400 erratum
workaround. Testing was done by booting a VM with a pl011 earlycon
console with and without this change and comparing boot log timing.
Signed-off-by: Eric Curtin <ericcurtin17@gmail.com>
---
drivers/tty/serial/amba-pl011.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 8ed91e1da22b..2a25095e8d8c 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2741,8 +2741,6 @@ static void pl011_putc(struct uart_port *port, unsigned char c)
writel(c, port->membase + UART01x_DR);
else
writeb(c, port->membase + UART01x_DR);
- while (readl(port->membase + UART01x_FR) & UART01x_FR_BUSY)
- cpu_relax();
}
static void pl011_early_write(struct console *con, const char *s, unsigned int n)
--
2.54.0
next prev parent reply other threads:[~2026-07-20 12:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 19:16 [PATCH] serial: amba-pl011: drop redundant BUSY wait from earlycon pl011_putc() Eric Curtin
2026-07-03 19:38 ` [PATCH v2] serial: amba-pl011: don't wait for BUSY after every earlycon character Eric Curtin
2026-07-10 12:38 ` Greg Kroah-Hartman
2026-07-20 12:17 ` Eric Curtin [this message]
2026-07-20 12:26 ` [PATCH v4] " Eric Curtin
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=20260720121741.13682-1-ericcurtin17@gmail.com \
--to=ericcurtin17@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@armlinux.org.uk \
/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