[RFC,3/3] MIPS: AR7: ensure the port type's FCR value is used
diff mbox series

Message ID -
State Accepted
Delegated to: Ralf Baechle
Headers show
Series
  • MIPS: AR7: assorted fixes
Related show

Commit Message

Jonas Gorski Oct. 29, 2017, 3:27 p.m. UTC
Since commit aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt
trigger I/F of FIFO buffers"), the port's default FCR value isn't used
in serial8250_do_set_termios anymore, but copied over once in
serial8250_config_port and then modified as needed.

Unfortunately, serial8250_config_port will never be called if the port
is shared between kernel and userspace, and the port's flag doesn't have
UPF_BOOT_AUTOCONF, which would trigger a serial8250_config_port as well.

This causes garbled output from userspace:

[    ] random: procd urandom read with 49 bits of entropy available
ers
   [kee

Fix this by forcing it to be configured on boot, resulting in the
expected output:

[    ] random: procd urandom read with 50 bits of entropy available
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level

Fixes: aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")
Signed-off-by: Jonas Gorski <>
---
I'm not sure if this is just AR7's issue, or if this points to a general
issue for UARTs used as kernel console and login console with the "fixed"
commit.

 arch/mips/ar7/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Hogan Nov. 14, 2017, 11:02 a.m. UTC | #1
On Sun, Oct 29, 2017 at 04:27:21PM +0100, Jonas Gorski wrote:
> Since commit aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt
> trigger I/F of FIFO buffers"), the port's default FCR value isn't used
> in serial8250_do_set_termios anymore, but copied over once in
> serial8250_config_port and then modified as needed.
> 
> Unfortunately, serial8250_config_port will never be called if the port
> is shared between kernel and userspace, and the port's flag doesn't have
> UPF_BOOT_AUTOCONF, which would trigger a serial8250_config_port as well.
> 
> This causes garbled output from userspace:
> 
> [    ] random: procd urandom read with 49 bits of entropy available
> ers
>    [kee
> 
> Fix this by forcing it to be configured on boot, resulting in the
> expected output:
> 
> [    ] random: procd urandom read with 50 bits of entropy available
> Press the [f] key and hit [enter] to enter failsafe mode
> Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
> 
> Fixes: aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")
> Signed-off-by: Jonas Gorski <>
> ---
> I'm not sure if this is just AR7's issue, or if this points to a general
> issue for UARTs used as kernel console and login console with the "fixed"
> commit.

Thanks. Given nobody seems to have objected, I've applied to my
mips-fixes branch, with stable tag for 3.17+.

Cheers
James

> 
>  arch/mips/ar7/platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
> index 4674f1efbe7a..e1675c25d5d4 100644
> --- a/arch/mips/ar7/platform.c
> +++ b/arch/mips/ar7/platform.c
> @@ -575,7 +575,7 @@ static int __init ar7_register_uarts(void)
>  	uart_port.type		= PORT_AR7;
>  	uart_port.uartclk	= clk_get_rate(bus_clk) / 2;
>  	uart_port.iotype	= UPIO_MEM32;
> -	uart_port.flags		= UPF_FIXED_TYPE;
> +	uart_port.flags		= UPF_FIXED_TYPE | UPF_BOOT_AUTOCONF;
>  	uart_port.regshift	= 2;
>  
>  	uart_port.line		= 0;
> -- 
> 2.13.2
> 
>
Jonas Gorski Dec. 28, 2017, 3:38 p.m. UTC | #2
On 14 November 2017 at 12:02, James Hogan <> wrote:
> On Sun, Oct 29, 2017 at 04:27:21PM +0100, Jonas Gorski wrote:
>> Since commit aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt
>> trigger I/F of FIFO buffers"), the port's default FCR value isn't used
>> in serial8250_do_set_termios anymore, but copied over once in
>> serial8250_config_port and then modified as needed.
>>
>> Unfortunately, serial8250_config_port will never be called if the port
>> is shared between kernel and userspace, and the port's flag doesn't have
>> UPF_BOOT_AUTOCONF, which would trigger a serial8250_config_port as well.
>>
>> This causes garbled output from userspace:
>>
>> [    ] random: procd urandom read with 49 bits of entropy available
>> ers
>>    [kee
>>
>> Fix this by forcing it to be configured on boot, resulting in the
>> expected output:
>>
>> [    ] random: procd urandom read with 50 bits of entropy available
>> Press the [f] key and hit [enter] to enter failsafe mode
>> Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
>>
>> Fixes: aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")
>> Signed-off-by: Jonas Gorski <>
>> ---
>> I'm not sure if this is just AR7's issue, or if this points to a general
>> issue for UARTs used as kernel console and login console with the "fixed"
>> commit.
>
> Thanks. Given nobody seems to have objected, I've applied to my
> mips-fixes branch, with stable tag for 3.17+.

Hmm, I don't see it in
https://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips.git/log/?h=mips-fixes
- did you maybe forget to push?


Regards
Jonas
James Hogan Jan. 2, 2018, 8:40 a.m. UTC | #3
On Thu, Dec 28, 2017 at 04:38:29PM +0100, Jonas Gorski wrote:
> On 14 November 2017 at 12:02, James Hogan <> wrote:
> > On Sun, Oct 29, 2017 at 04:27:21PM +0100, Jonas Gorski wrote:
> >> Since commit aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt
> >> trigger I/F of FIFO buffers"), the port's default FCR value isn't used
> >> in serial8250_do_set_termios anymore, but copied over once in
> >> serial8250_config_port and then modified as needed.
> >>
> >> Unfortunately, serial8250_config_port will never be called if the port
> >> is shared between kernel and userspace, and the port's flag doesn't have
> >> UPF_BOOT_AUTOCONF, which would trigger a serial8250_config_port as well.
> >>
> >> This causes garbled output from userspace:
> >>
> >> [    ] random: procd urandom read with 49 bits of entropy available
> >> ers
> >>    [kee
> >>
> >> Fix this by forcing it to be configured on boot, resulting in the
> >> expected output:
> >>
> >> [    ] random: procd urandom read with 50 bits of entropy available
> >> Press the [f] key and hit [enter] to enter failsafe mode
> >> Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
> >>
> >> Fixes: aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")
> >> Signed-off-by: Jonas Gorski <>
> >> ---
> >> I'm not sure if this is just AR7's issue, or if this points to a general
> >> issue for UARTs used as kernel console and login console with the "fixed"
> >> commit.
> >
> > Thanks. Given nobody seems to have objected, I've applied to my
> > mips-fixes branch, with stable tag for 3.17+.
> 
> Hmm, I don't see it in
> https://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips.git/log/?h=mips-fixes
> - did you maybe forget to push?

Ralf reappeared so I delegated the patch to him in patchwork, and he has
apparently marked it as accepted.

But perhaps that only just happened and he hasn't pushed yet. Ralf?

Cheers
James
James Hogan Jan. 22, 2018, 1:07 p.m. UTC | #4
Hi stable maintainers,

On Sun, Oct 29, 2017 at 04:27:21PM +0100, Jonas Gorski wrote:
> Since commit aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt
> trigger I/F of FIFO buffers"), the port's default FCR value isn't used
> in serial8250_do_set_termios anymore, but copied over once in
> serial8250_config_port and then modified as needed.
> 
> Unfortunately, serial8250_config_port will never be called if the port
> is shared between kernel and userspace, and the port's flag doesn't have
> UPF_BOOT_AUTOCONF, which would trigger a serial8250_config_port as well.
> 
> This causes garbled output from userspace:
> 
> [    ] random: procd urandom read with 49 bits of entropy available
> ers
>    [kee
> 
> Fix this by forcing it to be configured on boot, resulting in the
> expected output:
> 
> [    ] random: procd urandom read with 50 bits of entropy available
> Press the [f] key and hit [enter] to enter failsafe mode
> Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
> 
> Fixes: aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")
> Signed-off-by: Jonas Gorski <>

Please can this patch be applied to stable branches 3.17+. It is now
merged into mainline as commit 0a5191efe06b ("MIPS: AR7: ensure the port
type's FCR value is used").

Commit b084116f8587 ("MIPS: AR7: Ensure that serial ports are properly
set up") is a prerequisite for it to apply cleanly, but is already
tagged for stable.

Thanks
James
Greg Kroah-Hartman Jan. 22, 2018, 1:34 p.m. UTC | #5
On Mon, Jan 22, 2018 at 01:07:19PM +0000, James Hogan wrote:
> Hi stable maintainers,
> 
> On Sun, Oct 29, 2017 at 04:27:21PM +0100, Jonas Gorski wrote:
> > Since commit aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt
> > trigger I/F of FIFO buffers"), the port's default FCR value isn't used
> > in serial8250_do_set_termios anymore, but copied over once in
> > serial8250_config_port and then modified as needed.
> > 
> > Unfortunately, serial8250_config_port will never be called if the port
> > is shared between kernel and userspace, and the port's flag doesn't have
> > UPF_BOOT_AUTOCONF, which would trigger a serial8250_config_port as well.
> > 
> > This causes garbled output from userspace:
> > 
> > [    ] random: procd urandom read with 49 bits of entropy available
> > ers
> >    [kee
> > 
> > Fix this by forcing it to be configured on boot, resulting in the
> > expected output:
> > 
> > [    ] random: procd urandom read with 50 bits of entropy available
> > Press the [f] key and hit [enter] to enter failsafe mode
> > Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
> > 
> > Fixes: aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")
> > Signed-off-by: Jonas Gorski <>
> 
> Please can this patch be applied to stable branches 3.17+. It is now
> merged into mainline as commit 0a5191efe06b ("MIPS: AR7: ensure the port
> type's FCR value is used").
> 
> Commit b084116f8587 ("MIPS: AR7: Ensure that serial ports are properly
> set up") is a prerequisite for it to apply cleanly, but is already
> tagged for stable.

Now snuck into this round of stable -rc review :)

thanks,

greg k-h

Patch
diff mbox series

diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 4674f1efbe7a..e1675c25d5d4 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -575,7 +575,7 @@  static int __init ar7_register_uarts(void)
 	uart_port.type		= PORT_AR7;
 	uart_port.uartclk	= clk_get_rate(bus_clk) / 2;
 	uart_port.iotype	= UPIO_MEM32;
-	uart_port.flags		= UPF_FIXED_TYPE;
+	uart_port.flags		= UPF_FIXED_TYPE | UPF_BOOT_AUTOCONF;
 	uart_port.regshift	= 2;
 
 	uart_port.line		= 0;