diff mbox series

[1/1] tty/serial: RISC-V SBI earlycon via DBCN extension

Message ID 20231115133127.107575-1-heinrich.schuchardt@canonical.com (mailing list archive)
State Superseded
Headers show
Series [1/1] tty/serial: RISC-V SBI earlycon via DBCN extension | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-1-test-1 success .github/scripts/patches/build_rv32_defconfig.sh
conchuod/patch-1-test-2 success .github/scripts/patches/build_rv64_clang_allmodconfig.sh
conchuod/patch-1-test-3 success .github/scripts/patches/build_rv64_gcc_allmodconfig.sh
conchuod/patch-1-test-4 success .github/scripts/patches/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-1-test-5 success .github/scripts/patches/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-1-test-6 success .github/scripts/patches/checkpatch.sh
conchuod/patch-1-test-7 success .github/scripts/patches/dtb_warn_rv64.sh
conchuod/patch-1-test-8 success .github/scripts/patches/header_inline.sh
conchuod/patch-1-test-9 success .github/scripts/patches/kdoc.sh
conchuod/patch-1-test-10 success .github/scripts/patches/module_param.sh
conchuod/patch-1-test-11 success .github/scripts/patches/verify_fixes.sh
conchuod/patch-1-test-12 success .github/scripts/patches/verify_signedoff.sh

Commit Message

Heinrich Schuchardt Nov. 15, 2023, 1:31 p.m. UTC
Up to now an SBI based early console was limited to SBI version 0.1.
With the DBCN SBI extension we can provide an early console on systems that
have a recent SBI implementation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/riscv/kernel/sbi.c    | 14 ++++++++++++++
 drivers/tty/serial/Kconfig |  1 -
 2 files changed, 14 insertions(+), 1 deletion(-)

Comments

Anup Patel Nov. 15, 2023, 4:22 p.m. UTC | #1
On Wed, Nov 15, 2023 at 7:01 PM Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Up to now an SBI based early console was limited to SBI version 0.1.
> With the DBCN SBI extension we can provide an early console on systems that
> have a recent SBI implementation.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

There is already a series in-flight adding SBI DBCN support.
Refer, https://lore.kernel.org/lkml/20231020072140.900967-1-apatel@ventanamicro.com/

Regards,
Anup

> ---
>  arch/riscv/kernel/sbi.c    | 14 ++++++++++++++
>  drivers/tty/serial/Kconfig |  1 -
>  2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index 5a62ed1da453..6e1644a95bb7 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -195,6 +195,20 @@ static void sbi_set_power_off(void)
>         pm_power_off = sbi_shutdown;
>  }
>  #else
> +
> +/**
> + * sbi_console_putchar() - Writes given character to the console device.
> + * @ch: The data to be written to the console.
> + *
> + * Return: None
> + */
> +void sbi_console_putchar(int ch)
> +{
> +       sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE_BYTE,
> +                 ch, 0, 0, 0, 0, 0);
> +}
> +EXPORT_SYMBOL(sbi_console_putchar);
> +
>  static void __sbi_set_timer_v01(uint64_t stime_value)
>  {
>         pr_warn("Timer extension is not available in SBI v%lu.%lu\n",
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 732c893c8d16..454c2a612389 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -87,7 +87,6 @@ config SERIAL_EARLYCON_SEMIHOST
>
>  config SERIAL_EARLYCON_RISCV_SBI
>         bool "Early console using RISC-V SBI"
> -       depends on RISCV_SBI_V01
>         select SERIAL_CORE
>         select SERIAL_CORE_CONSOLE
>         select SERIAL_EARLYCON
> --
> 2.40.1
>
kernel test robot Nov. 20, 2023, 9:27 p.m. UTC | #2
Hi Heinrich,

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.7-rc2 next-20231120]
[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/Heinrich-Schuchardt/tty-serial-RISC-V-SBI-earlycon-via-DBCN-extension/20231115-213355
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link:    https://lore.kernel.org/r/20231115133127.107575-1-heinrich.schuchardt%40canonical.com
patch subject: [PATCH 1/1] tty/serial: RISC-V SBI earlycon via DBCN extension
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20231121/202311210512.n4evtQf6-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231121/202311210512.n4evtQf6-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/202311210512.n4evtQf6-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/tty/serial/earlycon-riscv-sbi.c:11:10: fatal error: 'asm/sbi.h' file not found
      11 | #include <asm/sbi.h>
         |          ^~~~~~~~~~~
   1 error generated.


vim +11 drivers/tty/serial/earlycon-riscv-sbi.c

27de1f541f1f91 Anup Patel 2018-12-04 @11  #include <asm/sbi.h>
27de1f541f1f91 Anup Patel 2018-12-04  12
diff mbox series

Patch

diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 5a62ed1da453..6e1644a95bb7 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -195,6 +195,20 @@  static void sbi_set_power_off(void)
 	pm_power_off = sbi_shutdown;
 }
 #else
+
+/**
+ * sbi_console_putchar() - Writes given character to the console device.
+ * @ch: The data to be written to the console.
+ *
+ * Return: None
+ */
+void sbi_console_putchar(int ch)
+{
+	sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE_BYTE,
+		  ch, 0, 0, 0, 0, 0);
+}
+EXPORT_SYMBOL(sbi_console_putchar);
+
 static void __sbi_set_timer_v01(uint64_t stime_value)
 {
 	pr_warn("Timer extension is not available in SBI v%lu.%lu\n",
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 732c893c8d16..454c2a612389 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -87,7 +87,6 @@  config SERIAL_EARLYCON_SEMIHOST
 
 config SERIAL_EARLYCON_RISCV_SBI
 	bool "Early console using RISC-V SBI"
-	depends on RISCV_SBI_V01
 	select SERIAL_CORE
 	select SERIAL_CORE_CONSOLE
 	select SERIAL_EARLYCON