MIPS: AR7: assorted fixes
Subsystems (3)
cover MIPS: AR7: assorted fixes
This patchset fixes a few issues found in AR7 that accumulated in the past few years. One was fixed for ages in OpenWrt/LEDE and never made it upstream, the others weren't noticed until now.
Jonas Gorski (2):
MIPS: AR7: defer registration of GPIO
MIPS: AR7: ensure the port type's FCR value is used
Oswald Buddenhagen (1):
MIPS: AR7: ensure that serial ports are properly set up
arch/mips/ar7/platform.c | 5 +++++ arch/mips/ar7/prom.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.13.2
PATCH 1/3 MIPS: AR7: defer registration of GPIO
When called from prom init code, ar7_gpio_init() will fail as it will call gpiochip_add() which relies on a working kmalloc() to alloc the gpio_desc array and kmalloc is not useable yet at prom init time.
Move ar7_gpio_init() to ar7_register_devices() (a device_initcall) where kmalloc works.
---
Text shamelessy stolen from commit 2ec459f2a77b8.
arch/mips/ar7/platform.c | 4 ++++ arch/mips/ar7/prom.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-)
arch/mips/ar7/platform.c +4 -0
@@ -653,6 +653,10 @@ static int __init ar7_register_devices(void)u32 val;int res; + res =ar7_gpio_init (); +if (res) +pr_warn ("unable to register gpios: %d\n" , res); + res =ar7_register_uarts ();if (res)pr_err ("unable to setup uart(s): %d\n" , res);
arch/mips/ar7/prom.c +0 -2
@@ -246,8 +246,6 @@ void __init prom_init(void)ar7_init_cmdline (fw_arg0, (char **)fw_arg1);ar7_init_env ((struct env_var *)fw_arg2);console_config (); - -ar7_gpio_init (); }#define PORT (offset) (KSEG1ADDR(AR7_REGS_UART0 + (offset * 4)))
Signature · 1 line
2.13.2
PATCH 2/3 MIPS: AR7: ensure that serial ports are properly set up
In reply to Jonas GorskiFrom: Oswald Buddenhagen <[email protected]>
without UPF_FIXED_TYPE, the data from the PORT_AR7 uart_config entry is never copied, resulting in a dead port.
--- arch/mips/ar7/platform.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/ar7/platform.c +1 -0
@@ -575,6 +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.regshift =2 ; uart_port.line =0 ;
Signature · 1 line
2.13.2
RFC PATCH 3/3 MIPS: AR7: ensure the port type's FCR value is used
In reply to Jonas GorskiSince 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:
[ 5.220000] 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:
[ 5.250000] 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
---
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(-)
arch/mips/ar7/platform.c +1 -1
@@ -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 ;
Signature · 1 line
2.13.2
Re: [PATCH 1/3] MIPS: AR7: defer registration of GPIO
In reply to Jonas GorskiQuoted 9 lines · Jonas Gorski
When called from prom init code,
ar7_gpio_init()will fail as it will callgpiochip_add()which relies on a workingkmalloc()to alloc thegpio_descarray and kmalloc is not useable yet at prom init time.Move
ar7_gpio_init()toar7_register_devices()(adevice_initcall) where kmalloc works.Fixes 14e85c0e69d5 ("gpio: remove gpio_descs global array")Signed-off-by Jonas Gorski <[email protected]>
Signature · 1 line
Florian
Re: [PATCH 2/3] MIPS: AR7: ensure that serial ports are properly set up
In reply to Jonas GorskiQuoted 9 lines · Jonas Gorski
From: Oswald Buddenhagen <[email protected]>
without
UPF_FIXED_TYPE, the data from thePORT_AR7uart_configentry is never copied, resulting in a dead port.Fixes 154615d55459 ("MIPS: AR7: Use correct UART port type")Signed-off-by Oswald Buddenhagen <[email protected]>[jonas.gorski: add Fixes tag]Signed-off-by Jonas Gorski <[email protected]>
Signature · 1 line
Florian
Quoted 10 lines · Jonas Gorski
This patchset fixes a few issues found in AR7 that accumulated in the past few years. One was fixed for ages in OpenWrt/LEDE and never made it upstream, the others weren't noticed until now.
Jonas Gorski (2):
MIPS: AR7: defer registration of GPIO
MIPS: AR7: ensure the port type's FCR value is usedOswald Buddenhagen (1):
MIPS: AR7: ensure that serial ports are properly set up
Thanks. Patches 1 + 2 applied for 4.14.
Cheers
James
Re: [PATCH RFC 3/3] MIPS: AR7: ensure the port type's FCR value is used
In reply to Jonas GorskiQuoted 22 lines · Jonas Gorski
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 inserial8250_do_set_termiosanymore, but copied over once inserial8250_config_portand then modified as needed.Unfortunately,
serial8250_config_portwill never be called if the port is shared between kernel and userspace, and the port's flag doesn't haveUPF_BOOT_AUTOCONF, which would trigger aserial8250_config_portas well.This causes garbled output from userspace:
[ 5.220000] random: procd urandom read with 49 bits of entropy availableers
[keeFix this by forcing it to be configured on boot, resulting in the expected output:
[ 5.250000] random: procd urandom read with 50 bits of entropy availablePress 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
Quoted 6 lines
Fixes aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")Signed-off-by Jonas Gorski <[email protected]>---
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
Quoted 21 lines
arch/mips/ar7/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/mips/ar7/platform.c +1
-1@@ -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 ;Signature · 1 line
2.13.2
Re: [PATCH RFC 3/3] MIPS: AR7: ensure the port type's FCR value is used
Quoted 30 lines · James Hogan
Quoted 22 lines · Jonas Gorski
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 inserial8250_do_set_termiosanymore, but copied over once inserial8250_config_portand then modified as needed.Unfortunately,
serial8250_config_portwill never be called if the port is shared between kernel and userspace, and the port's flag doesn't haveUPF_BOOT_AUTOCONF, which would trigger aserial8250_config_portas well.This causes garbled output from userspace:
[ 5.220000] random: procd urandom read with 49 bits of entropy availableers
[keeFix this by forcing it to be configured on boot, resulting in the expected output:
[ 5.250000] random: procd urandom read with 50 bits of entropy availablePress 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 levelQuoted 6 lines
Fixes aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")Signed-off-by Jonas Gorski <[email protected]>---
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.
Quoted 2 lines
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
Re: [PATCH RFC 3/3] MIPS: AR7: ensure the port type's FCR value is used
Quoted 31 lines · Jonas Gorski
Quoted 30 lines · James Hogan
Quoted 28 lines · Jonas Gorski
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 inserial8250_do_set_termiosanymore, but copied over once inserial8250_config_portand then modified as needed.Unfortunately,
serial8250_config_portwill never be called if the port is shared between kernel and userspace, and the port's flag doesn't haveUPF_BOOT_AUTOCONF, which would trigger aserial8250_config_portas well.This causes garbled output from userspace:
[ 5.220000] random: procd urandom read with 49 bits of entropy availableers
[keeFix this by forcing it to be configured on boot, resulting in the expected output:
[ 5.250000] random: procd urandom read with 50 bits of entropy availablePress 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 levelFixes aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")Signed-off-by Jonas Gorski <[email protected]>---
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.
Quoted 6 lines
Quoted 2 lines
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
Re: [PATCH RFC 3/3] MIPS: AR7: ensure the port type's FCR value is used
In reply to Jonas GorskiHi stable maintainers,
Quoted 18 lines · Jonas Gorski
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 inserial8250_do_set_termiosanymore, but copied over once inserial8250_config_portand then modified as needed.Unfortunately,
serial8250_config_portwill never be called if the port is shared between kernel and userspace, and the port's flag doesn't haveUPF_BOOT_AUTOCONF, which would trigger aserial8250_config_portas well.This causes garbled output from userspace:
[ 5.220000] random: procd urandom read with 49 bits of entropy availableers
[keeFix this by forcing it to be configured on boot, resulting in the expected output:
Quoted 6 lines
[ 5.250000] random: procd urandom read with 50 bits of entropy availablePress 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 levelFixes aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")Signed-off-by Jonas Gorski <[email protected]>
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
maintainerRe: [PATCH RFC 3/3] MIPS: AR7: ensure the port type's FCR value is used
Quoted 28 lines · James Hogan
Hi stable maintainers,
Quoted 18 lines · Jonas Gorski
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 inserial8250_do_set_termiosanymore, but copied over once inserial8250_config_portand then modified as needed.Unfortunately,
serial8250_config_portwill never be called if the port is shared between kernel and userspace, and the port's flag doesn't haveUPF_BOOT_AUTOCONF, which would trigger aserial8250_config_portas well.This causes garbled output from userspace:
[ 5.220000] random: procd urandom read with 49 bits of entropy availableers
[keeFix this by forcing it to be configured on boot, resulting in the expected output:
Quoted 6 lines
[ 5.250000] random: procd urandom read with 50 bits of entropy availablePress 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 levelFixes aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")Signed-off-by Jonas Gorski <[email protected]>
Quoted 7 lines
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