Re: [PATCH v2 08/15] serial: 8250_mxpcie: speed up TX using memory-mapped FIFO window
From: Andy Shevchenko
Date: Wed Jul 01 2026 - 08:43:08 EST
On Wed, Jul 01, 2026 at 11:41:21AM +0800, Crescent Hsieh wrote:
> The MUEx50 UART provides a memory-mapped TX FIFO data window along with
> a TX FIFO level counter.
>
> Fill the TX FIFO in bulk via the MMIO FIFO window based on available
> FIFO space, and use this path from the mxpcie interrupt handler instead
> of the generic serial8250_tx_chars() helper.
...
> +static void mxpcie8250_tx_chars(struct uart_8250_port *up)
> +{
> + struct uart_port *port = &up->port;
> + struct tty_port *tport = &port->state->port;
> + unsigned int i, count, txsize;
> + unsigned char c;
> +
> + if (port->x_char) {
> + uart_xchar_out(port, UART_TX);
> + return;
> + }
> + if (uart_tx_stopped(port) || kfifo_is_empty(&tport->xmit_fifo)) {
> + port->ops->stop_tx(port);
> + return;
> + }
> + txsize = serial_in(up, MOXA_PUART_TX_FIFO_CNT);
> + count = min(kfifo_len(&tport->xmit_fifo), port->fifosize - txsize);
> + for (i = 0; i < count; ++i) {
I haven't checked the whole series, but if the loop iterator is local,
write it as
for (unsigned int i = 0; i < count; ++i) {
> + if (!uart_fifo_get(port, &c))
> + break;
> +
> + serial_out(up, MOXA_PUART_TX_FIFO_MEM + i, c);
> + }
> + if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS)
> + uart_write_wakeup(port);
> +
> + if (kfifo_is_empty(&tport->xmit_fifo) && !(up->capabilities & UART_CAP_RPM))
> + port->ops->stop_tx(port);
> +}
--
With Best Regards,
Andy Shevchenko