Re: [PATCH v5 07/14] serial: 8250_mxpcie: speed up RX using memory-mapped FIFO window

Andy Shevchenko <[email protected]> Sun, 2 Aug 2026 12:03:56 +0300
Newsgroups org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel
Message-ID <CAHp75VfSVSEbn95i=UKBdHZNNEFfK7LpqFc54it8EjVVijA7Kw@mail.gmail.com>
On Fri, Jul 31, 2026 at 10:49=E2=80=AFAM Crescent Hsieh
<[email protected]> wrote:
>
> The MUEx50 UART provides a memory-mapped RX FIFO data window along with
> an RX FIFO byte counter.
>
> When no break or error conditions are present, read received data in
> bulk via the MMIO FIFO window and push it to the tty layer in one
> operation. Fall back to the generic 8250 RX path for break and error
> handling.

...

> +static void mxpcie8250_rx_chars(struct uart_8250_port *up)
> +{
> +       struct uart_port *port =3D &up->port;
> +       struct tty_port *tport =3D &port->state->port;
> +       unsigned int count;
> +       u8 *buf;
> +
> +       count =3D serial_in(up, MOXA_PUART_RX_FIFO_CNT);
> +       count =3D min(count, port->fifosize);

You want to include minmax.h for this.

> +       count =3D tty_prepare_flip_string(tport, &buf, count);
> +       if (!count)
> +               return;
> +
> +       for (unsigned int i =3D 0; i < count; ++i)

i++ should be sufficient.

> +               buf[i] =3D serial_in(up, MOXA_PUART_RX_FIFO_MEM + i);
> +
> +       port->icount.rx +=3D count;
> +       tty_flip_buffer_push(tport);
> +}

--=20
With Best Regards,
Andy Shevchenko