RISC-V SBI earlycon
Subsystems (2)
cover RISC-V SBI earlycon
This patchset adds RISC-V SBI earlycon and removes RISC-V EARLY_PRINTK.
We should use earlycon over existing EARLY_PRINTK for SBI console because:
1. It's a more generic way of implementing early console for debugging
2. Current RISC-V EARLY_PRINTK is a compile-time option whereas earlycon is enabled at run-time via kernel parameters.
3. To use earlycon with SBI, we have to pass "earlycon=sbi" in kernel parameters. If earlycon kernel parameter is not provided then kernel boots much faster which is very useful in real-world RISC-V deployments.
The patchset is tested on QEMU virt machine. It is based on Linux-4.20-rc5 and can be found at riscv_earlycon_v1 branch of:
https://github.com/avpatel/linux.git
Anup Patel (3):
tty/serial: Add RISC-V SBI earlycon support
RISC-V: defconfig: Enable RISC-V SBI earlycon support
RISC-V: Remove EARLY_PRINTK support
arch/riscv/Kconfig.debug | 2 -- arch/riscv/configs/defconfig | 1 + arch/riscv/kernel/setup.c | 28 ------------------------- drivers/tty/serial/Kconfig | 12 +++++++++++ drivers/tty/serial/Makefile | 1 + drivers/tty/serial/earlycon-riscv-sbi.c | 28 +++++++++++++++++++++++++ 6 files changed, 42 insertions(+), 30 deletions(-) create mode 100644 drivers/tty/serial/earlycon-riscv-sbi.c
Signature · 1 line
2.17.1
PATCH 1/3 tty/serial: Add RISC-V SBI earlycon support
In RISC-V, the M-mode runtime firmware provide SBI calls for debug prints. This patch adds earlycon support using RISC-V SBI console calls. To enable it, just pass "earlycon=sbi" in kernel parameters.
--- drivers/tty/serial/Kconfig | 12 +++++++++++ drivers/tty/serial/Makefile | 1 + drivers/tty/serial/earlycon-riscv-sbi.c | 28 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 drivers/tty/serial/earlycon-riscv-sbi.c
drivers/tty/serial/Kconfig +12 -0
@@ -85,6 +85,18 @@ config SERIAL_EARLYCON_ARM_SEMIHOST with "earlycon=smh" on the kernel command line. The console is enabled when early_param is processed. +config SERIAL_EARLYCON_RISCV_SBI + bool "Early console using RISC-V SBI" + depends on RISCV + select SERIAL_CORE + select SERIAL_CORE_CONSOLE + select SERIAL_EARLYCON + help + Support for early debug console using RISC-V SBI. This enables + the console before standard serial driver is probed. This is enabled + with "earlycon=sbi" on the kernel command line. The console is + enabled when early_param is processed. + config SERIAL_SB1250_DUART tristate "BCM1xxx on-chip DUART serial support" depends on SIBYTE_SB1xxx_SOC=y
drivers/tty/serial/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_SERIAL_CORE) += serial_core.o obj-$(CONFIG_SERIAL_EARLYCON) += earlycon.o obj-$(CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST) += earlycon-arm-semihost.o +obj-$(CONFIG_SERIAL_EARLYCON_RISCV_SBI) += earlycon-riscv-sbi.o # These Sparc drivers have to appear before others such as 8250 # which share ttySx minor node space. Otherwise console device
drivers/tty/serial/earlycon-riscv-sbi.c new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* RISC-V SBI based earlycon +* +* Copyright (C) 2018 Anup Patel <[email protected]> +*/ +#include <linux/kernel.h> +#include <linux/console.h> +#include <linux/init.h> +#include <linux/serial_core.h> +#include <asm/sbi.h> + +static void sbi_console_write (struct console *con, +const char *s,unsigned int n) +{ +int i; + +for (i =0 ; i < n; ++i) +sbi_console_putchar (s[i]); +} + +static int __init early_sbi_setup (struct earlycon_device *device, +const char *opt) +{ + device->con->write = sbi_console_write; +return 0 ; +} +EARLYCON_DECLARE (sbi, early_sbi_setup);
Signature · 1 line
2.17.1
Re: [PATCH 1/3] tty/serial: Add RISC-V SBI earlycon support
Quoted 6 lines · Anup Patel
In RISC-V, the M-mode runtime firmware provide SBI calls for debug prints. This patch adds earlycon support using RISC-V SBI console calls. To enable it, just pass "earlycon=sbi" in kernel parameters.
Signed-off-by Anup Patel <[email protected]>
This makes more sense to take through the riscv tree, so feel free to add:
to it and take it that way.
thanks,
greg k-h
Re: [PATCH 1/3] tty/serial: Add RISC-V SBI earlycon support
Quoted 6 lines · Greg KH
Quoted 5 lines · Anup Patel
In RISC-V, the M-mode runtime firmware provide SBI calls for debug prints. This patch adds earlycon support using RISC-V SBI console calls. To enable it, just pass "earlycon=sbi" in kernel parameters.
Quoted 8 lines
Quoted 1 line
Signed-off-by Anup Patel <[email protected]>This makes more sense to take through the riscv tree, so feel free to add:
to it and take it that way.
It should be in my for-next now.
Thanks!
Re: [PATCH 1/3] tty/serial: Add RISC-V SBI earlycon support
In reply to Anup PatelQuoted 72 lines · On Tue, 04 Dec 2018 05:55:05 PST (-0800), [email protected] wrote:
In RISC-V, the M-mode runtime firmware provide SBI calls for debug prints. This patch adds earlycon support using RISC-V SBI console calls. To enable it, just pass "earlycon=sbi" in kernel parameters.
Signed-off-by Anup Patel <[email protected]>--- drivers/tty/serial/Kconfig | 12 +++++++++++ drivers/tty/serial/Makefile | 1 + drivers/tty/serial/earlycon-riscv-sbi.c | 28 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 drivers/tty/serial/earlycon-riscv-sbi.cdrivers/tty/serial/Kconfig +12
-0@@ -85,6 +85,18 @@ config SERIAL_EARLYCON_ARM_SEMIHOST with "earlycon=smh" on the kernel command line. The console is enabled when early_param is processed. +config SERIAL_EARLYCON_RISCV_SBI + bool "Early console using RISC-V SBI" + depends on RISCV + select SERIAL_CORE + select SERIAL_CORE_CONSOLE + select SERIAL_EARLYCON + help + Support for early debug console using RISC-V SBI. This enables + the console before standard serial driver is probed. This is enabled + with "earlycon=sbi" on the kernel command line. The console is + enabled when early_param is processed. + config SERIAL_SB1250_DUART tristate "BCM1xxx on-chip DUART serial support" depends on SIBYTE_SB1xxx_SOC=ydrivers/tty/serial/Makefile +1
-0@@ -7,6 +7,7 @@ obj-$(CONFIG_SERIAL_CORE) += serial_core.o obj-$(CONFIG_SERIAL_EARLYCON) += earlycon.o obj-$(CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST) += earlycon-arm-semihost.o +obj-$(CONFIG_SERIAL_EARLYCON_RISCV_SBI) += earlycon-riscv-sbi.o # These Sparc drivers have to appear before others such as 8250 # which share ttySx minor node space. Otherwise console devicedrivers/tty/serial/earlycon-riscv-sbi.c new file +18
-0@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* RISC-V SBI based earlycon +* +* Copyright (C) 2018 Anup Patel <[email protected]> +*/ +#include <linux/kernel.h> +#include <linux/console.h> +#include <linux/init.h> +#include <linux/serial_core.h> +#include <asm/sbi.h> + +static void sbi_console_write (struct console *con, +const char *s,unsigned int n) +{ +int i; + +for (i =0 ; i < n; ++i)
drivers/tty/serial/earlycon-riscv-sbi.c line 28
Quoted 10 lines
drivers/tty/serial/earlycon-riscv-sbi.c new file +10
-0+sbi_console_putchar (s[i]); +} + +static int __init early_sbi_setup (struct earlycon_device *device, +const char *opt) +{ + device->con->write = sbi_console_write; +return 0 ; +} +EARLYCON_DECLARE (sbi, early_sbi_setup);
PATCH 1/1 tty/serial: emit CR before NL in RISC-V SBL console
In reply to Anup Patel--- drivers/tty/serial/earlycon-riscv-sbi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/earlycon-riscv-sbi.c +4 -1
@@ -15,8 +15,11 @@ static void sbi_console_write(struct console *con, {int i; -for (i =0 ; i < n; ++i) +for (i =0 ; i < n; ++i) { +if (s[i] =='\n' ) +sbi_console_putchar ('\r' );sbi_console_putchar (s[i]); + } } static int __init early_sbi_setup(struct earlycon_device *device,
Signature · 6 lines
2.20.1 -- Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Re: [PATCH] tty/serial: emit CR before NL in RISC-V SBL console
Quoted 11 lines · Andreas Schwab
Signed-off-by Andreas Schwab <[email protected]>--- drivers/tty/serial/earlycon-riscv-sbi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/tty/serial/earlycon-riscv-sbi.c +0
-0
drivers/tty/serial/earlycon-riscv-sbi.c static void sbi_console_write(struct console *con, · line 20
Quoted 7 lines
drivers/tty/serial/earlycon-riscv-sbi.c +3
-1@@ -15,8 +15,11 @@ static void sbi_console_write(struct console *con, {int i; -for (i =0 ; i < n; ++i) +for (i =0 ; i < n; ++i) { +if (s[i] =='\n' ) +sbi_console_putchar ('\r' );
Instead of doing '\n' handling here, we should do it in BBL or OpenSBI (i.e. SBI runtime firmware) otherwise all users of SBI_CONSOLE_PUTCHAR (namely, Linux, FreeBSD, FreeRTOS, U-Boot S-mode, etc) will endup having '\n' handling.
Currently, the BBL does not handle it but we have already handled this in upcoming OpenSBI.
The SBI_CONSOLE_PUTCHAR is comparable to ARM
semihosting early prints (refer, tty/serial/earlycon-arm-semihost.c). Even in ARM semihosting early prints the '\n' is not explicitly handled.
Regards,
Anup
Re: [PATCH] tty/serial: emit CR before NL in RISC-V SBL console
Quoted 5 lines · Anup Patel
Instead of doing '\n' handling here, we should do it in BBL or OpenSBI (i.e. SBI runtime firmware) otherwise all users of
SBI_CONSOLE_PUTCHAR(namely, Linux, FreeBSD, FreeRTOS, U-Boot S-mode, etc) will endup having '\n' handling.
I don't think the serial driver should do NLCR handling on its own, without being instructed by the tty layer. Since the earlycon does not have a tty layer, it needs to handle it explicitly.
Andreas.
Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Re: [PATCH] tty/serial: emit CR before NL in RISC-V SBL console
Quoted 9 lines · Andreas Schwab
Quoted 5 lines · Anup Patel
Instead of doing '\n' handling here, we should do it in BBL or OpenSBI (i.e. SBI runtime firmware) otherwise all users of
SBI_CONSOLE_PUTCHAR(namely, Linux, FreeBSD, FreeRTOS, U-Boot S-mode, etc) will endup having '\n' handling.
Quoted 3 lines
I don't think the serial driver should do NLCR handling on its own, without being instructed by the tty layer. Since the earlycon does not have a tty layer, it needs to handle it explicitly.
I tried to investigate more. What you suggest is correct but we should use uart_console_write() API.
Instead of explicitly doing NLCR here, we should do something as follows:
static void sbi_putc(struct uart_port *port, int c)
{
sbi_console_putchar(c);
}static void sbi_console_write(struct console *con,
const char *s, unsigned n)
{
struct earlycon_device *dev = con->data;
uart_console_write(&dev->port, s, n, sbi_putc);
}The uart_console_write() does the NLCR handling.
Regards,
Anup
PATCH 1/1 tty/serial: use uart_console_write in the RISC-V SBL early console
This enables proper NLCR processing.
--- drivers/tty/serial/earlycon-riscv-sbi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/tty/serial/earlycon-riscv-sbi.c +8 -5
@@ -10,13 +10,16 @@#include <linux/serial_core.h> #include <asm/sbi.h> -static void sbi_console_write (struct console *con, -const char *s,unsigned int n) +static void sbi_putc (struct uart_port *port,int c) { -int i; +sbi_console_putchar (c); +} -for (i =0 ; i < n; ++i) -sbi_console_putchar (s[i]); +static void sbi_console_write (struct console *con, +const char *s,unsigned n) +{ +struct earlycon_device *dev = con->data; +uart_console_write (&dev->port, s, n, sbi_putc); } static int __init early_sbi_setup(struct earlycon_device *device,
Signature · 6 lines
2.20.1 -- Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Re: [PATCH] tty/serial: use uart_console_write in the RISC-V SBL early console
Quoted 38 lines · Andreas Schwab
This enables proper NLCR processing.
Suggested-by Anup Patel <[email protected]>Signed-off-by Andreas Schwab <[email protected]>--- drivers/tty/serial/earlycon-riscv-sbi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)drivers/tty/serial/earlycon-riscv-sbi.c +8
-6@@ -10,13 +10,16 @@#include <linux/serial_core.h> #include <asm/sbi.h> -static void sbi_console_write (struct console *con, -const char *s,unsigned int n) +static void sbi_putc (struct uart_port *port,int c) { -int i; +sbi_console_putchar (c); +} -for (i =0 ; i < n; ++i) -sbi_console_putchar (s[i]); +static void sbi_console_write (struct console *con, +const char *s,unsigned n) +{ +struct earlycon_device *dev = con->data; +uart_console_write (&dev->port, s, n, sbi_putc); } static int __init early_sbi_setup(struct earlycon_device *device, --2.20.1
Quoted 4 lines
--
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Looks good to me.
Regards,
Anup
Re: [PATCH] tty/serial: use uart_console_write in the RISC-V SBL early console
Quoted 46 lines · On Fri, 11 Jan 2019 03:13:30 PST (-0800), [email protected] wrote:
Quoted 38 lines · Andreas Schwab
This enables proper NLCR processing.
Suggested-by Anup Patel <[email protected]>Signed-off-by Andreas Schwab <[email protected]>--- drivers/tty/serial/earlycon-riscv-sbi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)drivers/tty/serial/earlycon-riscv-sbi.c +8
-6@@ -10,13 +10,16 @@#include <linux/serial_core.h> #include <asm/sbi.h> -static void sbi_console_write (struct console *con, -const char *s,unsigned int n) +static void sbi_putc (struct uart_port *port,int c) { -int i; +sbi_console_putchar (c); +} -for (i =0 ; i < n; ++i) -sbi_console_putchar (s[i]); +static void sbi_console_write (struct console *con, +const char *s,unsigned n) +{ +struct earlycon_device *dev = con->data; +uart_console_write (&dev->port, s, n, sbi_putc); } static int __init early_sbi_setup(struct earlycon_device *device, --2.20.1
Quoted 4 lines
--
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."Looks good to me.
Quoted 4 lines
Reviewed-by Anup Patel <[email protected]>Regards,
Anup
Thanks. I'm going to include this in my next PR, as it's pretty self contained and is necessary to actually use this sanely.
Re: [PATCH] tty/serial: use uart_console_write in the RISC-V SBL early console
In reply to Andreas SchwabQuoted 4 lines · Andreas Schwab
This enables proper NLCR processing.
Suggested-by Anup Patel <[email protected]>Signed-off-by Andreas Schwab <[email protected]>
Looks good,
Re: [PATCH] tty/serial: emit CR before NL in RISC-V SBL console
In reply to Andreas SchwabQuoted 11 lines · On Thu, 10 Jan 2019 07:26:46 PST (-0800), [email protected] wrote:
Quoted 5 lines · Anup Patel
Instead of doing '\n' handling here, we should do it in BBL or OpenSBI (i.e. SBI runtime firmware) otherwise all users of
SBI_CONSOLE_PUTCHAR(namely, Linux, FreeBSD, FreeRTOS, U-Boot S-mode, etc) will endup having '\n' handling.I don't think the serial driver should do NLCR handling on its own, without being instructed by the tty layer. Since the earlycon does not have a tty layer, it needs to handle it explicitly.
I think it's best if we have the SBI interfaces be defined to be bit-exact. It does mean that everyone who uses the interfaces needs to do this handling, but I think that's actually a feature because it'll be subtly different everywhere.
This also has the advantage of being compatible with what we currently do in BBL and what we current expect in Linux everywhere but this earlycon driver (and will do assuming we merge this patch).
Quoted 25 lines · On Thu, 10 Jan 2019 08:17:07 PST (-0800), [email protected] wrote:
Quoted 9 lines · Andreas Schwab
Quoted 5 lines · Anup Patel
Instead of doing '\n' handling here, we should do it in BBL or OpenSBI (i.e. SBI runtime firmware) otherwise all users of
SBI_CONSOLE_PUTCHAR(namely, Linux, FreeBSD, FreeRTOS, U-Boot S-mode, etc) will endup having '\n' handling.Quoted 3 lines
I don't think the serial driver should do NLCR handling on its own, without being instructed by the tty layer. Since the earlycon does not have a tty layer, it needs to handle it explicitly.
I tried to investigate more. What you suggest is correct but we should use
uart_console_write()API.Instead of explicitly doing NLCR here, we should do something as follows:
static void
sbi_putc(struct uart_port *port, int c){ sbi_console_putchar(c); }
Quoted 8 lines
static void sbi_console_write(struct console *con,
const char *s, unsigned n){ struct earlycon_device *dev = con->data; uart_console_write(&dev->port, s, n, sbi_putc); }The
uart_console_write()does the NLCR handling.
That does look cleaner. I'll expect a v2 :)
PATCH 2/3 RISC-V: defconfig: Enable RISC-V SBI earlycon support
In reply to Anup PatelThis patch enables RISC-V SBI earlycon support in default defconfig so that we can use "earlycon=sbi" in kernel parameters for early debug prints.
--- arch/riscv/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/riscv/configs/defconfig +1 -0
@@ -46,6 +46,7 @@ CONFIG_INPUT_MOUSEDEV=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_EARLYCON_RISCV_SBI=y CONFIG_HVC_RISCV_SBI=y # CONFIG_PTP_1588_CLOCK is not set CONFIG_DRM=y
Signature · 1 line
2.17.1
Re: [PATCH 2/3] RISC-V: defconfig: Enable RISC-V SBI earlycon support
Quoted 14 lines · On Tue, 04 Dec 2018 05:55:06 PST (-0800), [email protected] wrote:
This patch enables RISC-V SBI earlycon support in default defconfig so that we can use "earlycon=sbi" in kernel parameters for early debug prints.
Signed-off-by Anup Patel <[email protected]>--- arch/riscv/configs/defconfig | 1 + 1 file changed, 1 insertion(+)arch/riscv/configs/defconfig +0
-0
arch/riscv/configs/defconfig CONFIG_INPUT_MOUSEDEV=y · line 52
Quoted 7 lines
arch/riscv/configs/defconfig +1
-0@@ -46,6 +46,7 @@ CONFIG_INPUT_MOUSEDEV=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_EARLYCON_RISCV_SBI=y CONFIG_HVC_RISCV_SBI=y # CONFIG_PTP_1588_CLOCK is not set CONFIG_DRM=y
PATCH 3/3 RISC-V: Remove EARLY_PRINTK support
In reply to Anup PatelThe EARLY_PRINTK using SBI console calls is not required any more because we now have RISC-V SBI support in generic earlycon framework.
--- arch/riscv/Kconfig.debug | 2 -- arch/riscv/kernel/setup.c | 28 ---------------------------- 2 files changed, 30 deletions(-)
arch/riscv/Kconfig.debug +0 -2
@@ -1,2 +0,0 @@ -config EARLY_PRINTK - def_bool y
arch/riscv/kernel/setup.c +0 -28
@@ -35,31 +35,9 @@#include <asm/sections.h> #include <asm/pgtable.h> #include <asm/smp.h> -#include <asm/sbi.h> #include <asm/tlbflush.h> #include <asm/thread_info.h> -#ifdef CONFIG_EARLY_PRINTK -static void sbi_console_write (struct console *co,const char *buf, -unsigned int n) -{ -int i; - -for (i =0 ; i < n; ++i) { -if (buf[i] =='\n' ) -sbi_console_putchar ('\r' ); -sbi_console_putchar (buf[i]); - } -} - -struct console riscv_sbi_early_console_dev__initdata = { - .name ="early" , - .write = sbi_console_write, - .flags =CON_PRINTBUFFER |CON_BOOT |CON_ANYTIME , - .index =-1 -}; -#endif -#ifdef CONFIG_DUMMY_CONSOLE struct screen_info screen_info = { .orig_video_lines = 30,
@@ -219,12 +197,6 @@ static void __init setup_bootmem(void)void __init setup_arch (char **cmdline_p) { -#if defined(CONFIG_EARLY_PRINTK ) -if (likely (early_console ==NULL )) { - early_console = &riscv_sbi_early_console_dev; -register_console (early_console); - } -#endif *cmdline_p = boot_command_line;parse_early_param ();
Signature · 1 line
2.17.1
Re: [PATCH 3/3] RISC-V: Remove EARLY_PRINTK support
Quoted 56 lines · On Tue, 04 Dec 2018 05:55:07 PST (-0800), [email protected] wrote:
The
EARLY_PRINTKusing SBI console calls is not required any more because we now have RISC-V SBI support in generic earlycon framework.Signed-off-by Anup Patel <[email protected]>--- arch/riscv/Kconfig.debug | 2 -- arch/riscv/kernel/setup.c | 28 ---------------------------- 2 files changed, 30 deletions(-)arch/riscv/Kconfig.debug +0
-2@@ -1,2 +0,0 @@ -config EARLY_PRINTK - def_bool yarch/riscv/kernel/setup.c +0
-22@@ -35,31 +35,9 @@#include <asm/sections.h> #include <asm/pgtable.h> #include <asm/smp.h> -#include <asm/sbi.h> #include <asm/tlbflush.h> #include <asm/thread_info.h> -#ifdef CONFIG_EARLY_PRINTK -static void sbi_console_write (struct console *co,const char *buf, -unsigned int n) -{ -int i; - -for (i =0 ; i < n; ++i) { -if (buf[i] =='\n' ) -sbi_console_putchar ('\r' ); -sbi_console_putchar (buf[i]); - } -} - -struct console riscv_sbi_early_console_dev__initdata = { - .name ="early" , - .write = sbi_console_write, - .flags =CON_PRINTBUFFER |CON_BOOT |CON_ANYTIME , - .index =-1 -}; -#endif -#ifdef CONFIG_DUMMY_CONSOLE struct screen_info screen_info = { .orig_video_lines = 30,@@ -219,12 +197,6 @@ static void __init setup_bootmem(void)void __init setup_arch (char **cmdline_p)
arch/riscv/kernel/setup.c static void __init setup_bootmem(void) · line 202
Quoted 10 lines
arch/riscv/kernel/setup.c +0
-6{ -#if defined(CONFIG_EARLY_PRINTK ) -if (likely (early_console ==NULL )) { - early_console = &riscv_sbi_early_console_dev; -register_console (early_console); - } -#endif *cmdline_p = boot_command_line;parse_early_param ();
Quoted 19 lines · On Tue, 04 Dec 2018 05:55:04 PST (-0800), [email protected] wrote:
This patchset adds RISC-V SBI earlycon and removes RISC-V
EARLY_PRINTK.We should use earlycon over existing
EARLY_PRINTKfor SBI console because:
1. It's a more generic way of implementing early console for debugging
2. Current RISC-VEARLY_PRINTKis a compile-time option whereas earlycon is enabled at run-time via kernel parameters.
3. To use earlycon with SBI, we have to pass "earlycon=sbi" in kernel parameters. If earlycon kernel parameter is not provided then kernel boots much faster which is very useful in real-world RISC-V deployments.The patchset is tested on QEMU virt machine. It is based on Linux-4.20-rc5 and can be found at
riscv_earlycon_v1branch of:
https://github.com/avpatel/linux.gitAnup Patel (3):
tty/serial: Add RISC-V SBI earlycon support
RISC-V: defconfig: Enable RISC-V SBI earlycon support
RISC-V: RemoveEARLY_PRINTKsupport
Quoted 8 lines
arch/riscv/Kconfig.debug | 2 -- arch/riscv/configs/defconfig | 1 + arch/riscv/kernel/setup.c | 28 ------------------------- drivers/tty/serial/Kconfig | 12 +++++++++++ drivers/tty/serial/Makefile | 1 + drivers/tty/serial/earlycon-riscv-sbi.c | 28 +++++++++++++++++++++++++ 6 files changed, 42 insertions(+), 30 deletions(-) create mode 100644 drivers/tty/serial/earlycon-riscv-sbi.c
I'm adding these to my for-next.
Thanks!
Quoted 9 lines · Anup Patel
This patchset adds RISC-V SBI earlycon and removes RISC-V
EARLY_PRINTK.We should use earlycon over existing
EARLY_PRINTKfor SBI console because:
1. It's a more generic way of implementing early console for debugging
2. Current RISC-VEARLY_PRINTKis a compile-time option whereas earlycon is enabled at run-time via kernel parameters.
3. To use earlycon with SBI, we have to pass "earlycon=sbi" in kernel parameters. If earlycon kernel parameter is not provided then kernel boots much faster which is very useful in real-world RISC-V deployments.
Why doesn't this earlycon disable itself when the real console kicks in?
Andreas.
Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."