public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Add early console functionality
@ 2024-04-10  6:34 Jinglin Wen
  2024-04-10  6:34 ` [PATCH 1/3] riscv: Support for early console Jinglin Wen
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jinglin Wen @ 2024-04-10  6:34 UTC (permalink / raw)
  To: palmer
  Cc: paul.walmsley, aou, gregkh, atishp, linux-kernel, linux-riscv,
	Jinglin Wen

The following patch series implements support for the early
console on the RISC-V platform.

Jinglin Wen (3):
  riscv: Support for early console.
  riscv: Support SBI as the interface for the RISC-V early console
  riscv: Add information for MAINTAINERS

 MAINTAINERS                            |   6 ++
 arch/riscv/include/asm/early_console.h |  23 ++++++
 arch/riscv/kernel/Makefile             |   1 +
 arch/riscv/kernel/early_console.c      | 108 +++++++++++++++++++++++++
 arch/riscv/kernel/setup.c              |   2 +
 drivers/tty/hvc/Kconfig                |  12 +++
 drivers/tty/hvc/hvc_riscv_sbi.c        |  29 +++++++
 7 files changed, 181 insertions(+)
 create mode 100644 arch/riscv/include/asm/early_console.h
 create mode 100644 arch/riscv/kernel/early_console.c

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] riscv: Support for early console.
  2024-04-10  6:34 [PATCH 0/3] Add early console functionality Jinglin Wen
@ 2024-04-10  6:34 ` Jinglin Wen
  2024-04-10 19:57   ` kernel test robot
  2024-04-11  4:36   ` kernel test robot
  2024-04-10  6:34 ` [PATCH 2/3] riscv: SBI as the interface for the " Jinglin Wen
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 10+ messages in thread
From: Jinglin Wen @ 2024-04-10  6:34 UTC (permalink / raw)
  To: palmer
  Cc: paul.walmsley, aou, gregkh, atishp, linux-kernel, linux-riscv,
	Jinglin Wen

This feature is mainly used for debugging during the early startup
process. Currently, the implementation of this function is based
on the sbi interface.

By setting the CONFIG_RISCV_EARLY_CONSOLE option, this
function can be enabled, which subsequently sets the log level
to CONSOLE_LOGLEVEL_MOTORMOUT.

Signed-off-by: Jinglin Wen <jinglin.wen@shingroup.cn>
---
 arch/riscv/include/asm/early_console.h |  23 ++++++
 arch/riscv/kernel/Makefile             |   1 +
 arch/riscv/kernel/early_console.c      | 108 +++++++++++++++++++++++++
 arch/riscv/kernel/setup.c              |   2 +
 4 files changed, 134 insertions(+)
 create mode 100644 arch/riscv/include/asm/early_console.h
 create mode 100644 arch/riscv/kernel/early_console.c

diff --git a/arch/riscv/include/asm/early_console.h b/arch/riscv/include/asm/early_console.h
new file mode 100644
index 000000000000..0683a42e9207
--- /dev/null
+++ b/arch/riscv/include/asm/early_console.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef _ASM_EARLY_CONSOLE_H
+#define _ASM_EARLY_CONSOLE_H
+#ifdef __KERNEL__
+
+#include <linux/compiler.h>
+#include <linux/init.h>
+
+void __init early_console_init(void);
+
+/* early_console libs */
+void early_console_puts(const char *s);
+int early_console_write(const char *s, int n);
+void early_console_printf(const char *fmt, ...);
+void early_console_progress(char *s, unsigned short hex);
+
+#ifdef CONFIG_RISCV_EARLY_CONSOLE_SBI
+void __init hvc_sbi_early_init(void (**putc)(char c));
+#endif /* CONFIG_HVC_RISCV_SBI */
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_EARLY_CONSOLE_H */
diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile
index 81d94a8ee10f..ef037e3762f1 100644
--- a/arch/riscv/kernel/Makefile
+++ b/arch/riscv/kernel/Makefile
@@ -48,6 +48,7 @@ obj-y	+= ptrace.o
 obj-y	+= reset.o
 obj-y	+= return_address.o
 obj-y	+= setup.o
+obj-y	+= early_console.o
 obj-y	+= signal.o
 obj-y	+= syscall_table.o
 obj-y	+= sys_riscv.o
diff --git a/arch/riscv/kernel/early_console.c b/arch/riscv/kernel/early_console.c
new file mode 100644
index 000000000000..64f3a5705413
--- /dev/null
+++ b/arch/riscv/kernel/early_console.c
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Early console support for RISCV
+ */
+
+#include <linux/stdarg.h>
+#include <linux/types.h>
+#include <linux/console.h>
+#include <asm/sbi.h>
+#include <asm/early_console.h>
+
+/* interface for early console output characters */
+void (*riscv_early_console_putc)(char c);
+
+void early_console_puts(const char *s)
+{
+	if (riscv_early_console_putc) {
+		char c;
+
+		if (s && *s != '\0') {
+			while ((c = *s++) != '\0')
+				riscv_early_console_putc(c);
+		}
+	}
+}
+
+int early_console_write(const char *s, int n)
+{
+	int remain = n;
+	char c;
+
+	if (!riscv_early_console_putc)
+		return 0;
+
+	if (s && *s != '\0') {
+		while (((c = *s++) != '\0') && (remain-- > 0))
+			riscv_early_console_putc(c);
+	}
+
+	return n - remain;
+}
+
+#define EARLY_CONSOLE_BUFSIZE 256
+void early_console_printf(const char *fmt, ...)
+{
+	if (riscv_early_console_putc) {
+		char buf[EARLY_CONSOLE_BUFSIZE];
+		va_list args;
+
+		va_start(args, fmt);
+		vsnprintf(buf, EARLY_CONSOLE_BUFSIZE, fmt, args);
+		early_console_puts(buf);
+		va_end(args);
+	}
+}
+
+void __init early_console_progress(char *s, unsigned short hex)
+{
+	early_console_puts(s);
+	early_console_puts("\n");
+}
+
+/*
+ * Console based on early console
+ */
+static void riscv_early_console_write(struct console *con, const char *s,
+		unsigned int n)
+{
+	early_console_write(s, n);
+}
+
+static struct console riscv_early_console = {
+	.name	= "riscv_early_con",
+	.write	= riscv_early_console_write,
+	.flags	= CON_PRINTBUFFER | CON_ENABLED | CON_BOOT | CON_ANYTIME,
+	.index	= 0,
+};
+
+static void __init register_early_console(void)
+{
+	if (!riscv_early_console_putc)
+		return;
+
+	add_preferred_console("riscv_early_con", 0, NULL);
+	register_console(&riscv_early_console);
+}
+
+/*
+ * This is called after sbi_init.
+ */
+void __init early_console_init(void)
+{
+	/*
+	 * Set riscv_early_console_putc.
+	 * If there are other output interfaces, you can add corresponding code
+	 * to initialize riscv_early_console_putc.
+	 */
+#if defined(CONFIG_RISCV_EARLY_CONSOLE_SBI)
+	/* using the sbi */
+	hvc_sbi_early_init(&riscv_early_console_putc);
+#else
+	/* using other */
+#endif
+
+	console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
+	register_early_console();
+}
+
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 4f73c0ae44b2..1b48630f0861 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -36,6 +36,7 @@
 #include <asm/thread_info.h>
 #include <asm/kasan.h>
 #include <asm/efi.h>
+#include <asm/early_console.h>
 
 #include "head.h"
 
@@ -255,6 +256,7 @@ void __init setup_arch(char **cmdline_p)
 
 	early_ioremap_setup();
 	sbi_init();
+	early_console_init();
 	jump_label_init();
 	parse_early_param();
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] riscv: SBI as the interface for the early console
  2024-04-10  6:34 [PATCH 0/3] Add early console functionality Jinglin Wen
  2024-04-10  6:34 ` [PATCH 1/3] riscv: Support for early console Jinglin Wen
@ 2024-04-10  6:34 ` Jinglin Wen
  2024-04-17  8:03   ` kernel test robot
  2024-04-10  6:34 ` [PATCH 3/3] riscv: Add information for MAINTAINERS Jinglin Wen
  2024-04-10  7:10 ` [PATCH 0/3] Add early console functionality Björn Töpel
  3 siblings, 1 reply; 10+ messages in thread
From: Jinglin Wen @ 2024-04-10  6:34 UTC (permalink / raw)
  To: palmer
  Cc: paul.walmsley, aou, gregkh, atishp, linux-kernel, linux-riscv,
	Jinglin Wen

Use the SBI interface as the early console output interface
for the RISC-V platform.

Signed-off-by: Jinglin Wen <jinglin.wen@shingroup.cn>
---
 drivers/tty/hvc/Kconfig         | 12 ++++++++++++
 drivers/tty/hvc/hvc_riscv_sbi.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
index c2a4e88b328f..48658d2b700c 100644
--- a/drivers/tty/hvc/Kconfig
+++ b/drivers/tty/hvc/Kconfig
@@ -118,6 +118,18 @@ config HVC_RISCV_SBI
 
 	  If you don't know what do to here, say N.
 
+config RISCV_EARLY_CONSOLE_SBI
+	bool "Use SBI as the interface for RISC-V early console"
+	depends on RISCV
+	help
+	  Choose 'Y' to use the SBI interface as the early console
+	  output interface for the RISC-V platform.
+
+	  This configuration is a temporary setup for debugging
+	  purposes during the boot process to address issues as
+	  early as possible. It should not be enabled in production
+	  kernel.
+
 config HVCS
 	tristate "IBM Hypervisor Virtual Console Server support"
 	depends on PPC_PSERIES && HVC_CONSOLE
diff --git a/drivers/tty/hvc/hvc_riscv_sbi.c b/drivers/tty/hvc/hvc_riscv_sbi.c
index cede8a572594..6686dcf62853 100644
--- a/drivers/tty/hvc/hvc_riscv_sbi.c
+++ b/drivers/tty/hvc/hvc_riscv_sbi.c
@@ -12,6 +12,7 @@
 #include <linux/types.h>
 
 #include <asm/sbi.h>
+#include <asm/early_console.h>
 
 #include "hvc_console.h"
 
@@ -81,3 +82,31 @@ static int __init hvc_sbi_init(void)
 	return 0;
 }
 device_initcall(hvc_sbi_init);
+
+#ifdef CONFIG_RISCV_EARLY_CONSOLE_SBI
+static ssize_t (*sbi_early_putc_common)(uint32_t vtermno, const u8 *buf, size_t count);
+
+static void sbi_early_putc(char c)
+{
+	unsigned int termno = 0;
+	int count = -1;
+
+	if (c == '\n')
+		sbi_early_putc('\r');
+
+	do {
+		count = sbi_early_putc_common(termno, &c, 1);
+	} while (count == 0 || count == -EAGAIN);
+}
+
+void __init hvc_sbi_early_init(void (**putc)(char c))
+{
+	if (sbi_debug_console_available)
+		sbi_early_putc_common = hvc_sbi_dbcn_tty_put;
+	else if (IS_ENABLED(CONFIG_RISCV_SBI_V01))
+		sbi_early_putc_common = hvc_sbi_tty_put;
+
+	if (sbi_early_putc_common)
+		*putc = sbi_early_putc;
+}
+#endif
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] riscv: Add information for MAINTAINERS
  2024-04-10  6:34 [PATCH 0/3] Add early console functionality Jinglin Wen
  2024-04-10  6:34 ` [PATCH 1/3] riscv: Support for early console Jinglin Wen
  2024-04-10  6:34 ` [PATCH 2/3] riscv: SBI as the interface for the " Jinglin Wen
@ 2024-04-10  6:34 ` Jinglin Wen
  2024-04-10  7:10 ` [PATCH 0/3] Add early console functionality Björn Töpel
  3 siblings, 0 replies; 10+ messages in thread
From: Jinglin Wen @ 2024-04-10  6:34 UTC (permalink / raw)
  To: palmer
  Cc: paul.walmsley, aou, gregkh, atishp, linux-kernel, linux-riscv,
	Jinglin Wen

Add the description of the RISC-V early console to
MAINTAINERS.

Signed-off-by: Jinglin Wen <jinglin.wen@shingroup.cn>
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index aa3b947fb080..bdc013ac4e75 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18936,6 +18936,12 @@ F:	arch/riscv/
 N:	riscv
 K:	riscv
 
+RISC-V EARLY CONSOLE SUPPORT
+M:	Jinglin Wen <jinglin.wen@shingroup.cn>
+S:	Supported
+F:	arch/riscv/include/asm/early_console.h
+F:	arch/riscv/kernel/early_console.c
+
 RISC-V MICROCHIP FPGA SUPPORT
 M:	Conor Dooley <conor.dooley@microchip.com>
 M:	Daire McNamara <daire.mcnamara@microchip.com>
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] Add early console functionality
  2024-04-10  6:34 [PATCH 0/3] Add early console functionality Jinglin Wen
                   ` (2 preceding siblings ...)
  2024-04-10  6:34 ` [PATCH 3/3] riscv: Add information for MAINTAINERS Jinglin Wen
@ 2024-04-10  7:10 ` Björn Töpel
  2024-04-10  9:35   ` Jinglin Wen
  2024-04-11  1:51   ` Jinglin Wen
  3 siblings, 2 replies; 10+ messages in thread
From: Björn Töpel @ 2024-04-10  7:10 UTC (permalink / raw)
  To: Jinglin Wen, palmer
  Cc: paul.walmsley, aou, gregkh, atishp, linux-kernel, linux-riscv,
	Jinglin Wen

Jinglin Wen <jinglin.wen@shingroup.cn> writes:

> The following patch series implements support for the early
> console on the RISC-V platform.

I fail to see how this is different from earlycon=sbi?


Björn

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] Add early console functionality
  2024-04-10  7:10 ` [PATCH 0/3] Add early console functionality Björn Töpel
@ 2024-04-10  9:35   ` Jinglin Wen
  2024-04-11  1:51   ` Jinglin Wen
  1 sibling, 0 replies; 10+ messages in thread
From: Jinglin Wen @ 2024-04-10  9:35 UTC (permalink / raw)
  To: bjorn; +Cc: palmer, paul.walmsley, aou, gregkh, atishp, linux-kernel,
	linux-riscv

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 425 bytes --]

Thank you for taking the time to review this patch.

Björn <bjorn@kernel.org> writes:
> Jinglin Wen <jinglin.wen@shingroup.cn> writes:
> 
> > The following patch series implements support for the early
> > console on the RISC-V platform.
> 
> I fail to see how this is different from earlycon=3Dsbi

Yep, you are right, this patch duplicates the functionality of
earlycon=sbi, and should be discarded.

Thanks,

Jinglin Wen

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] riscv: Support for early console.
  2024-04-10  6:34 ` [PATCH 1/3] riscv: Support for early console Jinglin Wen
@ 2024-04-10 19:57   ` kernel test robot
  2024-04-11  4:36   ` kernel test robot
  1 sibling, 0 replies; 10+ messages in thread
From: kernel test robot @ 2024-04-10 19:57 UTC (permalink / raw)
  To: Jinglin Wen, palmer
  Cc: oe-kbuild-all, paul.walmsley, aou, gregkh, atishp, linux-kernel,
	linux-riscv, Jinglin Wen

Hi Jinglin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on tty/tty-next tty/tty-linus linus/master v6.9-rc3 next-20240410]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jinglin-Wen/riscv-Support-for-early-console/20240410-143840
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link:    https://lore.kernel.org/r/20240410063432.23058-2-jinglin.wen%40shingroup.cn
patch subject: [PATCH 1/3] riscv: Support for early console.
config: riscv-allnoconfig (https://download.01.org/0day-ci/archive/20240411/202404110326.Qa9YV4bV-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240411/202404110326.Qa9YV4bV-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404110326.Qa9YV4bV-lkp@intel.com/

All warnings (new ones prefixed by >>):

   arch/riscv/kernel/early_console.c: In function 'early_console_printf':
>> arch/riscv/kernel/early_console.c:51:17: warning: function 'early_console_printf' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
      51 |                 vsnprintf(buf, EARLY_CONSOLE_BUFSIZE, fmt, args);
         |                 ^~~~~~~~~


vim +51 arch/riscv/kernel/early_console.c

    42	
    43	#define EARLY_CONSOLE_BUFSIZE 256
    44	void early_console_printf(const char *fmt, ...)
    45	{
    46		if (riscv_early_console_putc) {
    47			char buf[EARLY_CONSOLE_BUFSIZE];
    48			va_list args;
    49	
    50			va_start(args, fmt);
  > 51			vsnprintf(buf, EARLY_CONSOLE_BUFSIZE, fmt, args);
    52			early_console_puts(buf);
    53			va_end(args);
    54		}
    55	}
    56	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] Add early console functionality
  2024-04-10  7:10 ` [PATCH 0/3] Add early console functionality Björn Töpel
  2024-04-10  9:35   ` Jinglin Wen
@ 2024-04-11  1:51   ` Jinglin Wen
  1 sibling, 0 replies; 10+ messages in thread
From: Jinglin Wen @ 2024-04-11  1:51 UTC (permalink / raw)
  To: palmer; +Cc: bjorn, paul.walmsley, aou, gregkh, atishp, linux-kernel,
	linux-riscv

Thank you for taking the time to review this patch.

Bjorn <bjorn@kernel.org> writes:
> Jinglin Wen <jinglin.wen@shingroup.cn> writes:
> 
> > The following patch series implements support for the early
> > console on the RISC-V platform.
> 
> I fail to see how this is different from earlycon=3Dsbi

Yep, you are right, this patch duplicates the functionality of
earlycon=sbi, and should be discarded.

Thanks,

Jinglin Wen

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] riscv: Support for early console.
  2024-04-10  6:34 ` [PATCH 1/3] riscv: Support for early console Jinglin Wen
  2024-04-10 19:57   ` kernel test robot
@ 2024-04-11  4:36   ` kernel test robot
  1 sibling, 0 replies; 10+ messages in thread
From: kernel test robot @ 2024-04-11  4:36 UTC (permalink / raw)
  To: Jinglin Wen, palmer
  Cc: oe-kbuild-all, paul.walmsley, aou, gregkh, atishp, linux-kernel,
	linux-riscv, Jinglin Wen

Hi Jinglin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on tty/tty-next tty/tty-linus linus/master v6.9-rc3 next-20240410]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jinglin-Wen/riscv-Support-for-early-console/20240410-143840
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link:    https://lore.kernel.org/r/20240410063432.23058-2-jinglin.wen%40shingroup.cn
patch subject: [PATCH 1/3] riscv: Support for early console.
config: riscv-randconfig-r112-20240411 (https://download.01.org/0day-ci/archive/20240411/202404111237.OOIpC9KS-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 8b3b4a92adee40483c27f26c478a384cd69c6f05)
reproduce: (https://download.01.org/0day-ci/archive/20240411/202404111237.OOIpC9KS-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404111237.OOIpC9KS-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> arch/riscv/kernel/early_console.c:13:6: sparse: sparse: symbol 'riscv_early_console_putc' was not declared. Should it be static?

vim +/riscv_early_console_putc +13 arch/riscv/kernel/early_console.c

    11	
    12	/* interface for early console output characters */
  > 13	void (*riscv_early_console_putc)(char c);
    14	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] riscv: SBI as the interface for the early console
  2024-04-10  6:34 ` [PATCH 2/3] riscv: SBI as the interface for the " Jinglin Wen
@ 2024-04-17  8:03   ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2024-04-17  8:03 UTC (permalink / raw)
  To: Jinglin Wen, palmer
  Cc: oe-kbuild-all, paul.walmsley, aou, gregkh, atishp, linux-kernel,
	linux-riscv, Jinglin Wen

Hi Jinglin,

kernel test robot noticed the following build errors:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on tty/tty-next tty/tty-linus linus/master v6.9-rc4 next-20240416]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jinglin-Wen/riscv-Support-for-early-console/20240410-143840
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link:    https://lore.kernel.org/r/20240410063432.23058-3-jinglin.wen%40shingroup.cn
patch subject: [PATCH 2/3] riscv: SBI as the interface for the early console
config: riscv-randconfig-r071-20240417 (https://download.01.org/0day-ci/archive/20240417/202404171502.Yz861Nvd-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240417/202404171502.Yz861Nvd-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404171502.Yz861Nvd-lkp@intel.com/

All errors (new ones prefixed by >>):

   riscv64-linux-ld: arch/riscv/kernel/early_console.o: in function `early_console_init':
>> arch/riscv/kernel/early_console.c:100:(.init.text+0x18): undefined reference to `hvc_sbi_early_init'


vim +100 arch/riscv/kernel/early_console.c

f4e6608ec4adae Jinglin Wen 2024-04-10   87  
f4e6608ec4adae Jinglin Wen 2024-04-10   88  /*
f4e6608ec4adae Jinglin Wen 2024-04-10   89   * This is called after sbi_init.
f4e6608ec4adae Jinglin Wen 2024-04-10   90   */
f4e6608ec4adae Jinglin Wen 2024-04-10   91  void __init early_console_init(void)
f4e6608ec4adae Jinglin Wen 2024-04-10   92  {
f4e6608ec4adae Jinglin Wen 2024-04-10   93  	/*
f4e6608ec4adae Jinglin Wen 2024-04-10   94  	 * Set riscv_early_console_putc.
f4e6608ec4adae Jinglin Wen 2024-04-10   95  	 * If there are other output interfaces, you can add corresponding code
f4e6608ec4adae Jinglin Wen 2024-04-10   96  	 * to initialize riscv_early_console_putc.
f4e6608ec4adae Jinglin Wen 2024-04-10   97  	 */
f4e6608ec4adae Jinglin Wen 2024-04-10   98  #if defined(CONFIG_RISCV_EARLY_CONSOLE_SBI)
f4e6608ec4adae Jinglin Wen 2024-04-10   99  	/* using the sbi */
f4e6608ec4adae Jinglin Wen 2024-04-10 @100  	hvc_sbi_early_init(&riscv_early_console_putc);
f4e6608ec4adae Jinglin Wen 2024-04-10  101  #else
f4e6608ec4adae Jinglin Wen 2024-04-10  102  	/* using other */
f4e6608ec4adae Jinglin Wen 2024-04-10  103  #endif
f4e6608ec4adae Jinglin Wen 2024-04-10  104  
f4e6608ec4adae Jinglin Wen 2024-04-10  105  	console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
f4e6608ec4adae Jinglin Wen 2024-04-10  106  	register_early_console();
f4e6608ec4adae Jinglin Wen 2024-04-10  107  }
f4e6608ec4adae Jinglin Wen 2024-04-10  108  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-04-17  8:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-10  6:34 [PATCH 0/3] Add early console functionality Jinglin Wen
2024-04-10  6:34 ` [PATCH 1/3] riscv: Support for early console Jinglin Wen
2024-04-10 19:57   ` kernel test robot
2024-04-11  4:36   ` kernel test robot
2024-04-10  6:34 ` [PATCH 2/3] riscv: SBI as the interface for the " Jinglin Wen
2024-04-17  8:03   ` kernel test robot
2024-04-10  6:34 ` [PATCH 3/3] riscv: Add information for MAINTAINERS Jinglin Wen
2024-04-10  7:10 ` [PATCH 0/3] Add early console functionality Björn Töpel
2024-04-10  9:35   ` Jinglin Wen
2024-04-11  1:51   ` Jinglin Wen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox