2020-05-04 14:30:33

by Michal Simek

[permalink] [raw]
Subject: [PATCH v2] tty: xilinx_uartps: Fix missing id assignment to the console

From: Shubhrajyoti Datta <[email protected]>

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 <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
---

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);
--
2.26.2


2020-05-07 02:52:02

by Sasha Levin

[permalink] [raw]
Subject: Re: [PATCH v2] tty: xilinx_uartps: Fix missing id assignment to the console

Hi

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.6.10, v5.4.38, v4.19.120, v4.14.178, v4.9.221, v4.4.221.

v5.6.10: Build OK!
v5.4.38: Build OK!
v4.19.120: Failed to apply! Possible dependencies:
024ca329bfb9 ("serial: uartps: Register own uart console and driver structures")
10a5315b47b0 ("serial: uartps: Fill struct uart_driver in probe()")
14090ad1805f ("serial: uartps: Move alias reading higher in probe()")
18cc7ac8a28e ("Revert "serial: uartps: Register own uart console and driver structures"")
427c8ae9bebc ("serial: uartps: Change logic how console_port is setup")
46a460f0150a ("serial: uartps: Do not use static struct uart_driver out of probe()")
8da1a3940da4 ("Revert "serial: uartps: Use the same dynamic major number for all ports"")
ab262666018d ("serial: uartps: Use the same dynamic major number for all ports")
bed25ac0e2b6 ("serial: uartps: Move Port ID to device data structure")
e4bbb5194ea3 ("serial: uartps: Move register to probe based on run time detection")

v4.14.178: Failed to apply! Possible dependencies:
024ca329bfb9 ("serial: uartps: Register own uart console and driver structures")
0413fe045dda ("serial: uartps: Use dynamic array for console port")
0a84bae7edfb ("serial: uartps: Remove static port array")
10a5315b47b0 ("serial: uartps: Fill struct uart_driver in probe()")
14090ad1805f ("serial: uartps: Move alias reading higher in probe()")
18cc7ac8a28e ("Revert "serial: uartps: Register own uart console and driver structures"")
1f2107223e5b ("serial: uartps: Move cnds_uart_get_port to probe")
427c8ae9bebc ("serial: uartps: Change logic how console_port is setup")
46a460f0150a ("serial: uartps: Do not use static struct uart_driver out of probe()")
8da1a3940da4 ("Revert "serial: uartps: Use the same dynamic major number for all ports"")
ab262666018d ("serial: uartps: Use the same dynamic major number for all ports")
e4bbb5194ea3 ("serial: uartps: Move register to probe based on run time detection")

v4.9.221: Failed to apply! Possible dependencies:
024ca329bfb9 ("serial: uartps: Register own uart console and driver structures")
0413fe045dda ("serial: uartps: Use dynamic array for console port")
0a84bae7edfb ("serial: uartps: Remove static port array")
10a5315b47b0 ("serial: uartps: Fill struct uart_driver in probe()")
14090ad1805f ("serial: uartps: Move alias reading higher in probe()")
18cc7ac8a28e ("Revert "serial: uartps: Register own uart console and driver structures"")
1f2107223e5b ("serial: uartps: Move cnds_uart_get_port to probe")
46a460f0150a ("serial: uartps: Do not use static struct uart_driver out of probe()")
4b9d33c6a306 ("serial: uartps: Fix suspend functionality")
81e33b51ed69 ("serial: xuartps: Cleanup the clock enable")
8da1a3940da4 ("Revert "serial: uartps: Use the same dynamic major number for all ports"")
ab262666018d ("serial: uartps: Use the same dynamic major number for all ports")
d62100f1aac2 ("serial: xilinx_uartps: Add pm runtime support")
d653c43aefed ("serial: xilinx_uartps: Fix the error path")
e4bbb5194ea3 ("serial: uartps: Move register to probe based on run time detection")
ecfc5771ef06 ("serial: xuartps: Enable clocks in the pm disable case also")

v4.4.221: Failed to apply! Possible dependencies:
024ca329bfb9 ("serial: uartps: Register own uart console and driver structures")
10a5315b47b0 ("serial: uartps: Fill struct uart_driver in probe()")
14090ad1805f ("serial: uartps: Move alias reading higher in probe()")
18cc7ac8a28e ("Revert "serial: uartps: Register own uart console and driver structures"")
354fb1a7d7e5 ("tty: xuartps: Cleanup: Reformat if-else")
373e882f9ecf ("tty: xuartps: Refactor IRQ handling")
3816b2f886d0 ("serial: xuartps: Adds RXBS register support for zynqmp")
46a460f0150a ("serial: uartps: Do not use static struct uart_driver out of probe()")
4b9d33c6a306 ("serial: uartps: Fix suspend functionality")
55861d11c5c8 ("tty: xuartps: Move request_irq to after setting up the HW")
5ede4a5cde27 ("tty: xuartps: Move RX path into helper function")
6e14f7c1f2c2 ("tty: xuartps: Improve startup function")
81e33b51ed69 ("serial: xuartps: Cleanup the clock enable")
8da1a3940da4 ("Revert "serial: uartps: Use the same dynamic major number for all ports"")
a19eda0f49e5 ("tty: xuartps: Acquire port lock for shutdown")
a8df6a51600a ("tty: xuartps: Remove '_OFFSET' suffix from #defines")
ab262666018d ("serial: uartps: Use the same dynamic major number for all ports")
aea8f3ddcf5d ("tty: xuartps: Clear interrupt status register in shutdown")
e3538c37ee38 ("tty: xuartps: Beautify read-modify writes")
e4bbb5194ea3 ("serial: uartps: Move register to probe based on run time detection")
ea8dd8e58576 ("tty: xuartps: Don't consider circular buffer when enabling transmitter")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

--
Thanks
Sasha

2020-05-30 12:08:38

by Jan Kiszka

[permalink] [raw]
Subject: Re: [PATCH v2] tty: xilinx_uartps: Fix missing id assignment to the console

On 04.05.20 16:27, Michal Simek wrote:
> From: Shubhrajyoti Datta <[email protected]>
>
> 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 <[email protected]>
> Cc: stable <[email protected]>
> Signed-off-by: Michal Simek <[email protected]>
> ---
>
> 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

2020-06-01 10:25:42

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH v2] tty: xilinx_uartps: Fix missing id assignment to the console

On 30. 05. 20 14:06, Jan Kiszka wrote:
> On 04.05.20 16:27, Michal Simek wrote:
>> From: Shubhrajyoti Datta <[email protected]>
>>
>> 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 <[email protected]>
>> Cc: stable <[email protected]>
>> Signed-off-by: Michal Simek <[email protected]>
>> ---
>>
>> 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

2020-06-18 07:55:15

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH v2] tty: xilinx_uartps: Fix missing id assignment to the console

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 <[email protected]>
>>>
>>> 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 <[email protected]>
>>> Cc: stable <[email protected]>
>>> Signed-off-by: Michal Simek <[email protected]>
>>> ---
>>>
>>> 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