lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Nov 2022 19:30:09 +0200 (EET)
From:   Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To:     "Gabriel L. Somlo" <gsomlo@...il.com>
cc:     LKML <linux-kernel@...r.kernel.org>,
        linux-serial <linux-serial@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jirislaby@...nel.org>, kgugala@...micro.com,
        mholenko@...micro.com, joel@....id.au,
        david.abdurachmanov@...il.com, florent@...oy-digital.fr,
        geert@...ux-m68k.org
Subject: Re: [PATCH v3 13/14] serial: liteuart: add IRQ support for the TX
 path

On Tue, 15 Nov 2022, Gabriel L. Somlo wrote:

> On Tue, Nov 15, 2022 at 06:14:50PM +0200, Ilpo Järvinen wrote:
> > On Sat, 12 Nov 2022, Gabriel Somlo wrote:
> > 
> > > Modify the TX path to operate in an IRQ-compatible way, while
> > > maintaining support for polling mode via the poll timer.
> > > 
> > > Signed-off-by: Gabriel Somlo <gsomlo@...il.com>
> > > ---
> > >  drivers/tty/serial/liteuart.c | 67 ++++++++++++++++++++++++-----------
> > >  1 file changed, 47 insertions(+), 20 deletions(-)
> > > 
> > > diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
> > > index e30adb30277f..307c27398e30 100644
> > > --- a/drivers/tty/serial/liteuart.c
> > > +++ b/drivers/tty/serial/liteuart.c

> > > +	if (port->irq) {
> > > +		u8 irq_mask = litex_read8(port->membase + OFF_EV_ENABLE);
> > > +		litex_write8(port->membase + OFF_EV_ENABLE, irq_mask & ~EV_TX);
> > 
> > If you put irq_mask into liteuart_port you wouldn't need to read it 
> > back here?
> 
> So, instead of `bool poll_tx_started` I should just keep a copy of the
> irq_mask there, and take `&port->lock` whenever I need to *both* update
> the mask *and* write it out to the actual device register?

I was mostly thinking of storing EV_RX there but then it could be derived 
from port->irq that is checked by all paths already.

> > > +	if (unlikely(port->x_char)) {
> > > +		litex_write8(port->membase + OFF_RXTX, port->x_char);
> > > +		port->x_char = 0;
> > > +		port->icount.tx++;
> > > +		return;
> > > +	}
> > > +
> > > +	while (!litex_read8(port->membase + OFF_TXFULL)) {
> > > +		if (xmit->head == xmit->tail)
> > 
> > There exists a helper for this condition.
> 
> Is that in the released linus tree, or still only in tty-next?

uart_circ_empty() has been around for ages.

> > > +	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
> > > +		uart_write_wakeup(port);
> > > +
> > > +	if (uart_circ_empty(xmit))
> > > +		liteuart_stop_tx(port);
> > > +}
> > 
> > You might want to check if you can generate this whole function with 
> > Jiri's tx helpers (IIRC, they're only in tty-next tree currently).
> 
> Looks like I should switch to tty-next for this whole series, which
> makes sense, since it's a tty I'm working on :)
> 
> I'll rebase on top of that before I send out v4, hopefully later this
> afternoon.

Ok.

As I now looked it up, Jiri's tx helpers is 
8275b48b278096edc1e3ea5aa9cf946a10022f79 and you'll find some example 
conversions in the changes following it.


-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ