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]
Message-ID: <20130927074950.GA25098@xps8300>
Date:	Fri, 27 Sep 2013 10:49:50 +0300
From:	Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:	Tim Kryger <tim.kryger@...aro.org>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
	Patch Tracking <patches@...aro.org>
Subject: Re: [PATCH] serial: 8250_dw: Improve unwritable LCR workaround

Hi,

On Wed, Sep 25, 2013 at 03:47:14PM -0700, Tim Kryger wrote:
> On Wed, Sep 25, 2013 at 4:42 AM, Heikki Krogerus
> <heikki.krogerus@...ux.intel.com> wrote:
> > On Tue, Sep 24, 2013 at 05:39:09PM -0700, Tim Kryger wrote:
> >>  static void dw8250_serial_out(struct uart_port *p, int offset, int value)
> >>  {
> >>       struct dw8250_data *d = p->private_data;
> >>
> >> -     if (offset == UART_LCR)
> >> -             d->last_lcr = value;
> >> -
> >> -     if (offset == UART_MCR)
> >> -             d->last_mcr = value;
> >> -
> >> -     writeb(value, p->membase + (offset << p->regshift));
> >> +     if (offset == UART_LCR) {
> >> +             int tries = 1000;
> >> +             while (tries--) {
> >> +                     if (value == p->serial_in(p, UART_LCR))
> >> +                             return;
> >> +                     dw8250_force_idle(p);
> >> +                     writeb(value, p->membase + (UART_LCR << p->regshift));
> >> +             }
> >> +             dev_err(p->dev, "Couldn't set LCR to %d\n", value);
> >
> > Is it not enough to simply poll USR[0] to see when the UART becomes
> > free?
> 
> Unfortunately not.  The LCR is modified while holding the spinlock
> with local interrupts disabled so the ISR is deprived of the
> opportunity to empty the FIFO.
> 
> Given that the hardware will never become idle so long as there are
> characters in the RX FIFO, the only option is to forcibly empty it
> here.

OK. The LCR issue is only a problem when the UART is configured with
the busy functionality (UART_16550_COMPATIBLE == NO). Otherwise LRC is
always accessible and this is not necessary.

We need a flag for the UART_16550_COMPATIBLE configuration, and
use this WA based on that.

Thanks,

-- 
heikki
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ