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

Andy Shevchenko <[email protected]> Mon, 3 Aug 2026 10:28:34 +0300
Newsgroups gmane.linux.kernel,gmane.linux.serial
Message-ID <CAHp75VfRWdWcL0NSmQRpVeb5idcLCZCzKD6ynGza7+o7M2VG=w@mail.gmail.com>
On Mon, Aug 3, 2026 at 10:26=E2=80=AFAM Andy Shevchenko
<[email protected]> wrote:
>
> On Mon, Aug 3, 2026 at 7:46=E2=80=AFAM Jiri Slaby <[email protected]> =
wrote:
> >
> > On 02. 08. 26, 11:10, Andy Shevchenko wrote:
> > > On Fri, Jul 31, 2026 at 10:49=E2=80=AFAM Crescent Hsieh
> > > <[email protected]> wrote:
> > >>
> > >> The MUEx50 UART provides a memory-mapped TX FIFO data window along w=
ith
> > >> a TX FIFO level counter.
> > >>
> > >> Fill the TX FIFO in bulk via the MMIO FIFO window based on available
> > >> FIFO space, using uart_port_tx_limited() for the common serial-core =
TX
> > >> handling.
> > >
> > > ...
> > >
> > >> +static void mxpcie8250_tx_chars(struct uart_8250_port *up)
> > >> +{
> > >> +       struct uart_port *port =3D &up->port;
> > >> +       unsigned int offset =3D 0;
> > >> +       unsigned char c;
> > >> +
> > >> +       uart_port_tx_limited(port, c, port->fifosize - serial_in(up,=
 MOXA_PUART_TX_FIFO_CNT),
> > >> +                            true,
> > >> +                            serial_out(up, MOXA_PUART_TX_FIFO_MEM +=
 offset++, c),
> > >> +                            ({}));
> > >> +}
> > >
> > > At least three randomly chosen drivers use the empty tx_done, perhaps
> > > it's time to have a helper that embeds this ugly piece in it and hide=
s
> > > from the driver?
> >
> > I haven't tried, can we make the helper a variadic macro?
>
> Since it's last argument it can be done with the variadic, but you can
> also reconsider the others from the same group (the wrappers on top of
> __uart_port_tx() call) to regroup argument list to make more than a
> single optional argument. This can mimic the case of
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/=
lib/kstrtox.h#n21
> where two optional arguments are possible.

Note, if you see the history of those changes, you can see how it can
be achieved iteratively without breaking the users and having a single
name of the function, say uart_port_tx() for a new approach.


--=20
With Best Regards,
Andy Shevchenko