diff mbox series

[v2] tty: xilinx_uartps: Fix missing id assignment to the console

Message ID ed3111533ef5bd342ee5ec504812240b870f0853.1588602446.git.michal.simek@xilinx.com (mailing list archive)
State Mainlined
Commit 2ae11c46d5fdc46cb396e35911c713d271056d35
Headers show
Series [v2] tty: xilinx_uartps: Fix missing id assignment to the console | expand

Commit Message

Michal Simek May 4, 2020, 2:27 p.m. UTC
From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

When serial console has been assigned to ttyPS1 (which is serial1 alias)
console index is not updated property and pointing to index -1 (statically
initialized) which ends up in situation where nothing has been printed on
the port.

The commit 18cc7ac8a28e ("Revert "serial: uartps: Register own uart console
and driver structures"") didn't contain this line which was removed by
accident.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2:
- Do better commit description
- Origin subject was "tty: xilinx_uartps: Add the id to the console"

Greg: Would be good if you can take this patch to 5.7 and also to stable
trees.

---
 drivers/tty/serial/xilinx_uartps.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jan Kiszka May 30, 2020, 12:06 p.m. UTC | #1
On 04.05.20 16:27, Michal Simek wrote:
> From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>
> When serial console has been assigned to ttyPS1 (which is serial1 alias)
> console index is not updated property and pointing to index -1 (statically
> initialized) which ends up in situation where nothing has been printed on
> the port.
>
> The commit 18cc7ac8a28e ("Revert "serial: uartps: Register own uart console
> and driver structures"") didn't contain this line which was removed by
> accident.
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> Changes in v2:
> - Do better commit description
> - Origin subject was "tty: xilinx_uartps: Add the id to the console"
>
> Greg: Would be good if you can take this patch to 5.7 and also to stable
> trees.
>
> ---
>  drivers/tty/serial/xilinx_uartps.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
> index 672cfa075e28..b9d672af8b65 100644
> --- a/drivers/tty/serial/xilinx_uartps.c
> +++ b/drivers/tty/serial/xilinx_uartps.c
> @@ -1465,6 +1465,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
>  		cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS;
>  #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
>  		cdns_uart_uart_driver.cons = &cdns_uart_console;
> +		cdns_uart_console.index = id;
>  #endif
>
>  		rc = uart_register_driver(&cdns_uart_uart_driver);
>

This breaks the ultra96-rev1 which uses uart1 as serial0 (and
stdout-path = "serial0:115200n8"). Reverting this commit gives

[    0.024344] Serial: AMBA PL011 UART driver
[    0.028010] ff000000.serial: ttyPS1 at MMIO 0xff000000 (irq = 19, base_baud = 6250000) is a xuartps
[    0.028172] serial serial0: tty port ttyPS1 registered
[    0.028579] ff010000.serial: ttyPS0 at MMIO 0xff010000 (irq = 20, base_baud = 6250000) is a xuartps
[    0.557477] printk: console [ttyPS0] enabled

again. Affects stable as well (seen first in 5.4).

Jan
Michal Simek June 1, 2020, 10:23 a.m. UTC | #2
On 30. 05. 20 14:06, Jan Kiszka wrote:
> On 04.05.20 16:27, Michal Simek wrote:
>> From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>>
>> When serial console has been assigned to ttyPS1 (which is serial1 alias)
>> console index is not updated property and pointing to index -1 (statically
>> initialized) which ends up in situation where nothing has been printed on
>> the port.
>>
>> The commit 18cc7ac8a28e ("Revert "serial: uartps: Register own uart console
>> and driver structures"") didn't contain this line which was removed by
>> accident.
>>
>> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>> Cc: stable <stable@vger.kernel.org>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> Changes in v2:
>> - Do better commit description
>> - Origin subject was "tty: xilinx_uartps: Add the id to the console"
>>
>> Greg: Would be good if you can take this patch to 5.7 and also to stable
>> trees.
>>
>> ---
>>  drivers/tty/serial/xilinx_uartps.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
>> index 672cfa075e28..b9d672af8b65 100644
>> --- a/drivers/tty/serial/xilinx_uartps.c
>> +++ b/drivers/tty/serial/xilinx_uartps.c
>> @@ -1465,6 +1465,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
>>  		cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS;
>>  #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
>>  		cdns_uart_uart_driver.cons = &cdns_uart_console;
>> +		cdns_uart_console.index = id;
>>  #endif
>>
>>  		rc = uart_register_driver(&cdns_uart_uart_driver);
>>
> 
> This breaks the ultra96-rev1 which uses uart1 as serial0 (and
> stdout-path = "serial0:115200n8"). Reverting this commit gives
> 
> [    0.024344] Serial: AMBA PL011 UART driver
> [    0.028010] ff000000.serial: ttyPS1 at MMIO 0xff000000 (irq = 19, base_baud = 6250000) is a xuartps
> [    0.028172] serial serial0: tty port ttyPS1 registered
> [    0.028579] ff010000.serial: ttyPS0 at MMIO 0xff010000 (irq = 20, base_baud = 6250000) is a xuartps
> [    0.557477] printk: console [ttyPS0] enabled
> 
> again. Affects stable as well (seen first in 5.4).

Will take a look at this. Just give me some time.

M
Michal Simek June 18, 2020, 7:52 a.m. UTC | #3
Hi Jan,

On 01. 06. 20 12:23, Michal Simek wrote:
> On 30. 05. 20 14:06, Jan Kiszka wrote:
>> On 04.05.20 16:27, Michal Simek wrote:
>>> From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>>>
>>> When serial console has been assigned to ttyPS1 (which is serial1 alias)
>>> console index is not updated property and pointing to index -1 (statically
>>> initialized) which ends up in situation where nothing has been printed on
>>> the port.
>>>
>>> The commit 18cc7ac8a28e ("Revert "serial: uartps: Register own uart console
>>> and driver structures"") didn't contain this line which was removed by
>>> accident.
>>>
>>> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>>> Cc: stable <stable@vger.kernel.org>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>>> Changes in v2:
>>> - Do better commit description
>>> - Origin subject was "tty: xilinx_uartps: Add the id to the console"
>>>
>>> Greg: Would be good if you can take this patch to 5.7 and also to stable
>>> trees.
>>>
>>> ---
>>>  drivers/tty/serial/xilinx_uartps.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
>>> index 672cfa075e28..b9d672af8b65 100644
>>> --- a/drivers/tty/serial/xilinx_uartps.c
>>> +++ b/drivers/tty/serial/xilinx_uartps.c
>>> @@ -1465,6 +1465,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
>>>  		cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS;
>>>  #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
>>>  		cdns_uart_uart_driver.cons = &cdns_uart_console;
>>> +		cdns_uart_console.index = id;
>>>  #endif
>>>
>>>  		rc = uart_register_driver(&cdns_uart_uart_driver);
>>>
>>
>> This breaks the ultra96-rev1 which uses uart1 as serial0 (and
>> stdout-path = "serial0:115200n8"). Reverting this commit gives
>>
>> [    0.024344] Serial: AMBA PL011 UART driver
>> [    0.028010] ff000000.serial: ttyPS1 at MMIO 0xff000000 (irq = 19, base_baud = 6250000) is a xuartps
>> [    0.028172] serial serial0: tty port ttyPS1 registered
>> [    0.028579] ff010000.serial: ttyPS0 at MMIO 0xff010000 (irq = 20, base_baud = 6250000) is a xuartps
>> [    0.557477] printk: console [ttyPS0] enabled
>>
>> again. Affects stable as well (seen first in 5.4).
> 
> Will take a look at this. Just give me some time.

Your patch is right. We found that if you specify console via command
line this issue is not visible. That's why testing didn't catch it.
Can you please send a revert to this patch?

Thanks,
Michal
diff mbox series

Patch

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 672cfa075e28..b9d672af8b65 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1465,6 +1465,7 @@  static int cdns_uart_probe(struct platform_device *pdev)
 		cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS;
 #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
 		cdns_uart_uart_driver.cons = &cdns_uart_console;
+		cdns_uart_console.index = id;
 #endif
 
 		rc = uart_register_driver(&cdns_uart_uart_driver);