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: <CAJJ77WsAi5jmnDxY45ipu3a94D6+yoHJNHgExhFsVoirV3NoyQ@mail.gmail.com>
Date:	Fri, 17 Oct 2014 15:55:41 +0530
From:	Sudhir Sreedharan <ssreedharan@...sta.com>
To:	Peter Hurley <peter@...leysoftware.com>
Cc:	Greg KH <gregkh@...uxfoundation.org>,
	Kevin Hilman <khilman@...nel.org>,
	linux-serial@...r.kernel.org, Jiri Slaby <jslaby@...e.cz>,
	lkml <linux-kernel@...r.kernel.org>,
	Olof Johansson <olof@...om.net>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: Re: [PATCH] tty: serial: 8250_core: restore the LCR register in set_sleep

Hi Peter,

On Thu, Oct 16, 2014 at 6:05 PM, Peter Hurley <peter@...leysoftware.com> wrote:
> On 10/15/2014 02:43 AM, Sudhir Sreedharan wrote:
>> In ST16650V2 based serial uarts, while initalizing the PM state,
>> LCR registers are being initialized to 0 in serial8250_set_sleep().
>> If console port is already initialized and being used, this will
>> throws garbage in the console.
>>
>> Signed-off-by: Sudhir Sreedharan <ssreedharan@...sta.com>
>> ---
>>  drivers/tty/serial/8250/8250_core.c |    7 +++++--
>>  1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
>> index ca5cfdc..e054482 100644
>> --- a/drivers/tty/serial/8250/8250_core.c
>> +++ b/drivers/tty/serial/8250/8250_core.c
>> @@ -595,6 +595,7 @@ static void serial8250_rpm_put_tx(struct uart_8250_port *p)
>>   */
>>  static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
>>  {
>> +     unsigned char lcr, efr;
>>       /*
>>        * Exar UARTs have a SLEEP register that enables or disables
>>        * each UART to enter sleep mode separately.  On the XR17V35x the
>> @@ -611,6 +612,8 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
>>
>>       if (p->capabilities & UART_CAP_SLEEP) {
>>               if (p->capabilities & UART_CAP_EFR) {
>> +                     lcr = serial_in(p, UART_LCR);
>> +                     efr = serial_in(p, UART_EFR);
>>                       serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B);
>>                       serial_out(p, UART_EFR, UART_EFR_ECB);
>>                       serial_out(p, UART_LCR, 0);
>> @@ -618,8 +621,8 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
>>               serial_out(p, UART_IER, sleep ? UART_IERX_SLEEP : 0);
>>               if (p->capabilities & UART_CAP_EFR) {
>>                       serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B);
>> -                     serial_out(p, UART_EFR, 0);
>> -                     serial_out(p, UART_LCR, 0);
>> +                     serial_out(p, UART_EFR, sleep ? 0 : efr);
>> +                     serial_out(p, UART_LCR, sleep ? 0 : lcr);
>
> Why is it necessary to clear EFR and LCR here? Does the UART not
> power down?
>
> UARTs with CAP_SLEEP but not CAP_EFR don't clear LCR before sleep.
>
> However, if there is some kind of intentional side-effect here,
> then a comment should note that.

Yes, we can restore the LCR and EFR with the saved values.
                     serial_out(p, UART_EFR, efr);
                     serial_out(p, UART_LCR, lcr);

I will send a new patch with the changes.

Thanks,
Sudhir

>
> Regards,
> Peter Hurley
>
>>               }
>>       }
>>  out:
>>
>
--
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