All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Add RustSBI firmware support
@ 2026-11-15 14:38 Zhouqi Jiang
  2026-11-15 17:10 ` Tom Rini
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Zhouqi Jiang @ 2026-11-15 14:38 UTC (permalink / raw)
  To: u-boot; +Cc: tim609, leo.liang, me, sjg, alpernebiyasak, trini

RustSBI is a security-focused, open-source RISC-V SBI implementation
written in Rust. It is listed in the SBI specification with
implementation ID 4.

Add RustSBI support to U-Boot:
- Add SPL firmware selection and dynamic handoff.
- Add the RustSBI FIT image type and RUSTSBI binman input.
- Update RISC-V FIT templates, documentation and tests.

Ref: https://docs.riscv.org/reference/sbi/_attachments/riscv-sbi.pdf
Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
---
 MAINTAINERS                             |  1 +
 Makefile                                |  1 +
 arch/riscv/Kconfig                      | 10 +++----
 arch/riscv/dts/binman.dtsi              | 23 ++++++++++++++-
 arch/riscv/dts/thead-th1520-binman.dtsi | 24 ++++++++++++++++
 boot/image.c                            |  1 +
 common/spl/Kconfig                      | 37 +++++++++++++++++++------
 common/spl/Makefile                     |  1 +
 common/spl/spl.c                        |  3 ++
 common/spl/spl_fit.c                    |  3 +-
 common/spl/spl_rustsbi.c                | 13 +++++++++
 doc/board/emulation/qemu-riscv.rst      |  9 ++++++
 include/image.h                         |  1 +
 include/spl.h                           |  5 ++++
 tools/binman/etype/rustsbi.py           | 18 ++++++++++++
 tools/binman/ftest.py                   | 16 +++++++++++
 tools/binman/missing-blob-help          |  4 +++
 tools/binman/test/fip/rustsbi.dts       | 11 ++++++++
 18 files changed, 165 insertions(+), 16 deletions(-)
 create mode 100644 common/spl/spl_rustsbi.c
 create mode 100644 tools/binman/etype/rustsbi.py
 create mode 100644 tools/binman/test/fip/rustsbi.dts

diff --git a/MAINTAINERS b/MAINTAINERS
index 3b38ffee288..35980cf8459 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1519,6 +1519,7 @@ M:	Leo Liang <leo.liang@sifive.com>
 R:	Yao Zi <me@ziyao.cc>
 S:	Maintained
 T:	git https://git.u-boot-project.org/u-boot/custodians/u-boot-riscv.git
+F:	common/spl/spl_rustsbi.c
 F:	drivers/sysreset/sysreset_sbi.c
 F:	drivers/timer/andes_plmt_timer.c
 N:	riscv
diff --git a/Makefile b/Makefile
index 519866b82ea..cf58788a007 100644
--- a/Makefile
+++ b/Makefile
@@ -1695,6 +1695,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		-a tee-os-path=${TEE} \
 		-a ti-dm-path=${TI_DM} \
 		-a opensbi-path=${OPENSBI} \
+		-a rustsbi-path=${RUSTSBI} \
 		-a default-dt=$(default_dt) \
 		-a scp-path=$(SCP) \
 		-a rockchip-tpl-path=$(ROCKCHIP_TPL) \
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 386241efd4a..4bd562437cb 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -476,8 +476,7 @@ config SBI_V02
 	  single hart needs to boot and enter the operating system. The booting
 	  hart can bring up secondary harts one by one afterwards.
 
-	  Choose this option if OpenSBI release v0.7 or above is used together
-	  with U-Boot.
+	  Choose this option if the SBI firmware implements SBI v0.2 or later.
 
 endchoice
 
@@ -625,12 +624,11 @@ config TPL_USE_ARCH_MEMSET
 endmenu
 
 config SPL_LOAD_FIT_OPENSBI_OS_BOOT
-	bool "Enable SPL (OpenSBI OS boot mode) applying linux from FIT"
+	bool "Boot Linux from a FIT through SBI firmware"
 	depends on SPL_LOAD_FIT
 	help
-	  Use fw_dynamic from the FIT image, and u-boot SPL will invoke it directly.
-	  This is a shortcut boot flow, from u-boot SPL -> OpenSBI -> u-boot proper
-	  -> linux to u-boot SPL -> OpenSBI -> linux.
+	  Load SBI firmware and Linux from the FIT image. SPL starts the SBI
+	  firmware, which starts Linux directly instead of U-Boot proper.
 
 config SPL_OPTEE_LOAD_ADDR
 	hex "OP-TEE Trusted OS image load address"
diff --git a/arch/riscv/dts/binman.dtsi b/arch/riscv/dts/binman.dtsi
index 84c261c6849..12be2e73f04 100644
--- a/arch/riscv/dts/binman.dtsi
+++ b/arch/riscv/dts/binman.dtsi
@@ -21,7 +21,7 @@
 #endif
 
 		fit {
-			description = "Configuration to load OpenSBI before U-Boot";
+			description = "Configuration to load SBI firmware before U-Boot";
 			#address-cells = <2>;
 			fit,fdt-list = "of-list";
 
@@ -66,6 +66,7 @@
 				};
 #endif
 
+#ifdef CONFIG_SPL_OPENSBI
 				opensbi {
 					description = "OpenSBI fw_dynamic Firmware";
 					type = "firmware";
@@ -80,6 +81,22 @@
 						missing-msg = "opensbi";
 					};
 				};
+#elif defined(CONFIG_SPL_RUSTSBI)
+				rustsbi {
+					description = "RustSBI dynamic Firmware";
+					type = "firmware";
+					os = "rustsbi";
+					arch = "riscv";
+					compression = "none";
+					load = /bits/ 64 <CONFIG_SPL_OPENSBI_LOAD_ADDR>;
+					entry = /bits/ 64 <CONFIG_SPL_OPENSBI_LOAD_ADDR>;
+
+					rustsbi_blob: rustsbi {
+						filename = "rustsbi-prototyper-dynamic.bin";
+						missing-msg = "rustsbi";
+					};
+				};
+#endif
 
 #if !defined(CONFIG_OF_BOARD) || defined(CONFIG_MULTI_DTB_FIT)
 				@fdt-SEQ {
@@ -101,7 +118,11 @@
 				conf-1 {
 #endif
 					description = "NAME";
+#ifdef CONFIG_SPL_OPENSBI
 					firmware = "opensbi";
+#elif defined(CONFIG_SPL_RUSTSBI)
+					firmware = "rustsbi";
+#endif
 #ifdef CONFIG_OPTEE
 #ifdef CONFIG_SPL_LOAD_FIT_OPENSBI_OS_BOOT
 					loadables = "linux", "tee";
diff --git a/arch/riscv/dts/thead-th1520-binman.dtsi b/arch/riscv/dts/thead-th1520-binman.dtsi
index 7b535e8402c..ee9716d157e 100644
--- a/arch/riscv/dts/thead-th1520-binman.dtsi
+++ b/arch/riscv/dts/thead-th1520-binman.dtsi
@@ -30,6 +30,7 @@
 		fit,fdt-list = "of-list";
 
 		images {
+#ifdef CONFIG_SPL_OPENSBI
 			opensbi {
 				description = "OpenSBI fw_dynamic Firmware";
 				type = "firmware";
@@ -43,11 +44,30 @@
 					missing-msg = "opensbi";
 				};
 			};
+#elif defined(CONFIG_SPL_RUSTSBI)
+			rustsbi {
+				description = "RustSBI dynamic Firmware";
+				type = "firmware";
+				os = "rustsbi";
+				arch = "riscv";
+				load = /bits/ 64 <CONFIG_SPL_OPENSBI_LOAD_ADDR>;
+				entry = /bits/ 64 <CONFIG_SPL_OPENSBI_LOAD_ADDR>;
+
+				rustsbi_blob: rustsbi {
+					filename = "rustsbi-prototyper-dynamic.bin";
+					missing-msg = "rustsbi";
+				};
+			};
+#endif
 
 			uboot {
 				description = "U-Boot";
 				type = "standalone";
+#ifdef CONFIG_SPL_OPENSBI
 				firmware = "opensbi";
+#elif defined(CONFIG_SPL_RUSTSBI)
+				firmware = "rustsbi";
+#endif
 				os = "U-boot";
 				arch = "riscv";
 				compression = "none";
@@ -71,7 +91,11 @@
 			@conf-SEQ {
 				description = "NAME";
 				fdt = "fdt-SEQ";
+#ifdef CONFIG_SPL_OPENSBI
 				firmware = "opensbi";
+#elif defined(CONFIG_SPL_RUSTSBI)
+				firmware = "rustsbi";
+#endif
 				loadables = "uboot";
 			};
 		};
diff --git a/boot/image.c b/boot/image.c
index 289e80f23a7..5a9d11f4015 100644
--- a/boot/image.c
+++ b/boot/image.c
@@ -123,6 +123,7 @@ static const table_entry_t uimage_os[] = {
 	{	IH_OS_OPENRTOS,	"openrtos",	"OpenRTOS",		},
 #endif
 	{	IH_OS_OPENSBI,	"opensbi",	"RISC-V OpenSBI",	},
+	{	IH_OS_RUSTSBI,	"rustsbi",	"RISC-V RustSBI",	},
 	{	IH_OS_EFI,	"efi",		"EFI Firmware"		},
 #ifdef CONFIG_BOOTM_ELF
 	{	IH_OS_ELF,	"elf",		"ELF Image"		},
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 4930ecb0861..abb6964794c 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1735,10 +1735,17 @@ config SPL_OPTEE_IMAGE
 	  OP-TEE is an open source Trusted OS which is loaded by SPL.
 	  More detail at: https://github.com/OP-TEE/optee_os
 
-config SPL_OPENSBI
-	bool "Support RISC-V OpenSBI"
+choice
+	prompt "RISC-V SBI firmware"
 	depends on RISCV && SPL_RISCV_MMODE && RISCV_SMODE
 	depends on SPL_LOAD_FIT && !SPL_FIT_IMAGE_TINY
+	default SPL_OPENSBI
+	help
+	  Select the SBI firmware that U-Boot SPL will load and start.
+	  OpenSBI is selected by default.
+
+config SPL_OPENSBI
+	bool "Support RISC-V OpenSBI firmware"
 	help
 	  OpenSBI is an open-source implementation of the RISC-V Supervisor Binary
 	  Interface (SBI) specification. U-Boot supports the OpenSBI FW_DYNAMIC
@@ -1747,16 +1754,30 @@ config SPL_OPENSBI
 	  More details are available at https://github.com/riscv/opensbi and
 	  https://github.com/riscv/riscv-sbi-doc
 
+config SPL_RUSTSBI
+	bool "Support RISC-V RustSBI firmware"
+	help
+	  RustSBI is a security-focused RISC-V Supervisor Binary Interface (SBI)
+	  implementation written in Rust. U-Boot supports RustSBI Prototyper
+	  dynamic firmware, which is loaded and started by U-Boot SPL.
+
+	  More details are available at https://github.com/rustsbi/rustsbi and
+	  https://github.com/riscv/riscv-sbi-doc
+
+endchoice
+
 config SPL_OPENSBI_LOAD_ADDR
-	hex "OpenSBI load address"
-	depends on SPL_OPENSBI
+	hex "SBI firmware load address"
+	depends on SPL_OPENSBI || SPL_RUSTSBI
 	help
-	  Load address of the OpenSBI binary.
+	  Load address of the SBI firmware binary.
 
 config SPL_OPENSBI_SCRATCH_OPTIONS
-	hex "Scratch options passed to OpenSBI"
-	default 0x1
-	depends on SPL_OPENSBI
+	hex "Scratch options passed to OpenSBI" if SPL_OPENSBI
+	default 0x1 if SPL_OPENSBI
+	# RustSBI shares the dynamic handoff but does not use OpenSBI options.
+	default 0x0 if SPL_RUSTSBI
+	depends on SPL_OPENSBI || SPL_RUSTSBI
 	help
 	  This bitmap of options is passed from U-Boot SPL to OpenSBI.
 	  As of OpenSBI 1.3 the following bits are defined:
diff --git a/common/spl/Makefile b/common/spl/Makefile
index 9c94e8f143e..2b03b7e8282 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_$(PHASE_)MMC) += spl_mmc.o
 obj-$(CONFIG_$(PHASE_)ATF) += spl_atf.o
 obj-$(CONFIG_$(PHASE_)OPTEE_IMAGE) += spl_optee.o
 obj-$(CONFIG_$(PHASE_)OPENSBI) += spl_opensbi.o
+obj-$(CONFIG_$(PHASE_)RUSTSBI) += spl_rustsbi.o spl_opensbi.o
 obj-$(CONFIG_$(PHASE_)USB_STORAGE) += spl_usb.o
 obj-$(CONFIG_$(PHASE_)FS_FAT) += spl_fat.o
 obj-$(CONFIG_$(PHASE_)FS_EXT4) += spl_ext.o
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 6c9a1a1cbcc..6214074c824 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -791,6 +791,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	} else if (CONFIG_IS_ENABLED(OPENSBI) && os == IH_OS_OPENSBI) {
 		debug("Jumping to U-Boot via RISC-V OpenSBI\n");
 		jumper = &spl_invoke_opensbi;
+	} else if (CONFIG_IS_ENABLED(RUSTSBI) && os == IH_OS_RUSTSBI) {
+		debug("Jumping to U-Boot via RISC-V RustSBI\n");
+		jumper = &spl_invoke_rustsbi;
 	} else if (CONFIG_IS_ENABLED(OS_BOOT) && os == IH_OS_LINUX) {
 		debug("Jumping to Linux\n");
 		if (CONFIG_IS_ENABLED(OS_BOOT_ARGS))
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 64e5f95546f..dabf60b28ad 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -466,7 +466,8 @@ static bool os_takes_devicetree(uint8_t os)
 		return true;
 	case IH_OS_LINUX:
 		return IS_ENABLED(CONFIG_SPL_OS_BOOT) ||
-		       IS_ENABLED(CONFIG_SPL_OPENSBI);
+		       IS_ENABLED(CONFIG_SPL_OPENSBI) ||
+		       IS_ENABLED(CONFIG_SPL_RUSTSBI);
 	default:
 		return false;
 	}
diff --git a/common/spl/spl_rustsbi.c b/common/spl/spl_rustsbi.c
new file mode 100644
index 00000000000..60d85993bcd
--- /dev/null
+++ b/common/spl/spl_rustsbi.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2026 Institute of Software Chinese Academy of Sciences,
+ * Zhouqi Jiang <jiangzhouqi2025@iscas.ac.cn>
+ */
+
+#include <spl.h>
+
+void __noreturn spl_invoke_rustsbi(struct spl_image_info *spl_image)
+{
+	/* RustSBI and OpenSBI use the same dynamic handoff protocol. */
+	spl_invoke_opensbi(spl_image);
+}
diff --git a/doc/board/emulation/qemu-riscv.rst b/doc/board/emulation/qemu-riscv.rst
index a76a1a8bf75..1be2f53f54e 100644
--- a/doc/board/emulation/qemu-riscv.rst
+++ b/doc/board/emulation/qemu-riscv.rst
@@ -124,6 +124,15 @@ with the following commands.
     make qemu-riscv64_spl_defconfig
     make
 
+To use RustSBI firmware, build RustSBI Prototyper in dynamic mode for the
+target with the SPL firmware load address. See https://github.com/rustsbi/rustsbi
+for details. Set RUSTSBI to the firmware binary and build U-Boot::
+
+    make qemu-riscv32_spl_defconfig  # Or qemu-riscv64_spl_defconfig
+    scripts/config --disable SPL_OPENSBI --enable SPL_RUSTSBI
+    make olddefconfig
+    make RUSTSBI=/path/to/rustsbi-prototyper-dynamic.bin
+
 The minimal QEMU commands to run U-Boot SPL in both 32-bit and 64-bit
 configurations are:
 
diff --git a/include/image.h b/include/image.h
index a424206bedf..c9b129589d5 100644
--- a/include/image.h
+++ b/include/image.h
@@ -100,6 +100,7 @@ enum {
 	IH_OS_OPENSBI,			/* RISC-V OpenSBI */
 	IH_OS_EFI,			/* EFI Firmware (e.g. GRUB2) */
 	IH_OS_ELF,			/* ELF Image (e.g. seL4) */
+	IH_OS_RUSTSBI,			/* RISC-V RustSBI */
 
 	IH_OS_COUNT,
 };
diff --git a/include/spl.h b/include/spl.h
index 390d18fd9d5..5d0a329ce60 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -1144,6 +1144,11 @@ void __noreturn spl_optee_entry(void *arg0, void *arg1, void *arg2, void *arg3);
  */
 void __noreturn spl_invoke_opensbi(struct spl_image_info *spl_image);
 
+/**
+ * spl_invoke_rustsbi - boot using a RISC-V RustSBI image
+ */
+void __noreturn spl_invoke_rustsbi(struct spl_image_info *spl_image);
+
 /**
  * board_return_to_bootrom - allow for boards to continue with the boot ROM
  *
diff --git a/tools/binman/etype/rustsbi.py b/tools/binman/etype/rustsbi.py
new file mode 100644
index 00000000000..2fe2b6ac559
--- /dev/null
+++ b/tools/binman/etype/rustsbi.py
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0+
+"""Binman entry for a RustSBI dynamic firmware binary."""
+
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+
+
+class Entry_rustsbi(Entry_blob_named_by_arg):
+    """RISC-V RustSBI dynamic firmware blob
+
+    Properties / Entry arguments:
+        - rustsbi-path: Filename of the RustSBI firmware binary
+
+    This entry holds the M-mode firmware started by U-Boot SPL.
+    """
+
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node, 'rustsbi')
+        self.external = True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 567ffa96b2b..30528974e0f 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -97,6 +97,7 @@ TEE_OS_DATA           = b'this is some tee OS data'
 TI_DM_DATA            = b'tidmtidm'
 ATF_BL2U_DATA         = b'bl2u'
 OPENSBI_DATA          = b'opensbi'
+RUSTSBI_DATA          = b'rustsbi'
 SCP_DATA              = b'scp'
 ROCKCHIP_TPL_DATA     = b'rockchip-tpl'
 TEST_FDT1_DATA        = b'fdt1'
@@ -236,6 +237,7 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('dm.bin', TI_DM_DATA)
         TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA)
         TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
+        TestFunctional._MakeInputFile('rustsbi-test.bin', RUSTSBI_DATA)
         TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
         TestFunctional._MakeInputFile('rockchip-tpl.bin', ROCKCHIP_TPL_DATA)
         TestFunctional._MakeInputFile('ti_unsecure.bin', TI_UNSECURE_DATA)
@@ -5059,6 +5061,20 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('fip/opensbi.dts')
         self.assertEqual(OPENSBI_DATA, data[:len(OPENSBI_DATA)])
 
+    def testPackRustSBI(self):
+        """Test that rustsbi-path selects the supplied firmware binary"""
+        data, _, _, _ = self._DoReadFileDtb(
+            'fip/rustsbi.dts', entry_args={'rustsbi-path': 'rustsbi-test.bin'})
+        self.assertEqual(RUSTSBI_DATA, data)
+
+    def testPackRustSBIMissing(self):
+        """Test that a missing RustSBI binary is reported"""
+        with self.assertRaises(ValueError) as exc:
+            self._DoReadFileDtb(
+                'fip/rustsbi.dts', entry_args={'rustsbi-path': 'missing-rustsbi.bin'})
+        self.assertIn("Filename 'missing-rustsbi.bin' not found in input path",
+                      str(exc.exception))
+
     def testSectionsSingleThread(self):
         """Test sections without multithreading"""
         data = self._DoReadFileDtb('entry/sections.dts', threads=0)[0]
diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help
index 27dc620bd35..5c1bb1e7482 100644
--- a/tools/binman/missing-blob-help
+++ b/tools/binman/missing-blob-help
@@ -38,6 +38,10 @@ https://github.com/riscv/opensbi.git
 You may need to build fw_dynamic.bin first and re-build u-boot with
 OPENSBI=/path/to/fw_dynamic.bin
 
+rustsbi:
+Build RustSBI Prototyper in dynamic mode for the configured SPL SBI load
+address, then re-build U-Boot with RUSTSBI=/path/to/firmware.bin.
+
 rockchip-tpl:
 An external TPL is required to initialize DRAM. Get the external TPL
 binary and build with ROCKCHIP_TPL=/path/to/ddr.bin. One possible source
diff --git a/tools/binman/test/fip/rustsbi.dts b/tools/binman/test/fip/rustsbi.dts
new file mode 100644
index 00000000000..2275cca5414
--- /dev/null
+++ b/tools/binman/test/fip/rustsbi.dts
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	binman {
+		rustsbi {
+			filename = "rustsbi-prototyper-dynamic.bin";
+		};
+	};
+};
-- 
2.53.0.windows.2


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

* Re: [PATCH] riscv: Add RustSBI firmware support
  2026-11-15 14:38 [PATCH] riscv: Add RustSBI firmware support Zhouqi Jiang
@ 2026-11-15 17:10 ` Tom Rini
  2026-11-16  5:42   ` Zhouqi Jiang
  2026-11-16 12:45 ` Yao Zi
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 18+ messages in thread
From: Tom Rini @ 2026-11-15 17:10 UTC (permalink / raw)
  To: Zhouqi Jiang; +Cc: u-boot, tim609, leo.liang, me, sjg, alpernebiyasak

[-- Attachment #1: Type: text/plain, Size: 2141 bytes --]

On Sun, Nov 15, 2026 at 10:38:08PM +0800, Zhouqi Jiang wrote:

> RustSBI is a security-focused, open-source RISC-V SBI implementation
> written in Rust. It is listed in the SBI specification with
> implementation ID 4.
> 
> Add RustSBI support to U-Boot:
> - Add SPL firmware selection and dynamic handoff.
> - Add the RustSBI FIT image type and RUSTSBI binman input.
> - Update RISC-V FIT templates, documentation and tests.
> 
> Ref: https://docs.riscv.org/reference/sbi/_attachments/riscv-sbi.pdf
> Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
[snip]
> +config SPL_RUSTSBI
> +	bool "Support RISC-V RustSBI firmware"
> +	help
> +	  RustSBI is a security-focused RISC-V Supervisor Binary Interface (SBI)
> +	  implementation written in Rust. U-Boot supports RustSBI Prototyper
> +	  dynamic firmware, which is loaded and started by U-Boot SPL.
> +
> +	  More details are available at https://github.com/rustsbi/rustsbi and
> +	  https://github.com/riscv/riscv-sbi-doc
> +
> +endchoice
> +
>  config SPL_OPENSBI_LOAD_ADDR
> -	hex "OpenSBI load address"
> -	depends on SPL_OPENSBI
> +	hex "SBI firmware load address"
> +	depends on SPL_OPENSBI || SPL_RUSTSBI
>  	help
> -	  Load address of the OpenSBI binary.
> +	  Load address of the SBI firmware binary.
>  
>  config SPL_OPENSBI_SCRATCH_OPTIONS
> -	hex "Scratch options passed to OpenSBI"
> -	default 0x1
> -	depends on SPL_OPENSBI
> +	hex "Scratch options passed to OpenSBI" if SPL_OPENSBI
> +	default 0x1 if SPL_OPENSBI
> +	# RustSBI shares the dynamic handoff but does not use OpenSBI options.
> +	default 0x0 if SPL_RUSTSBI
> +	depends on SPL_OPENSBI || SPL_RUSTSBI
>  	help
>  	  This bitmap of options is passed from U-Boot SPL to OpenSBI.
>  	  As of OpenSBI 1.3 the following bits are defined:

To be clear, I think all of the changes to make things more clearly
generic here are good. At first read, it looks like aside from display
strings and a different scratch options value, RustSBI and OpenSBI are
interchangeable as far as U-Boot is concerned? If so, I'd like to
explore continuing down that path more.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH] riscv: Add RustSBI firmware support
  2026-11-15 17:10 ` Tom Rini
@ 2026-11-16  5:42   ` Zhouqi Jiang
  2026-11-16 13:02     ` Yao Zi
  0 siblings, 1 reply; 18+ messages in thread
From: Zhouqi Jiang @ 2026-11-16  5:42 UTC (permalink / raw)
  To: trini
  Cc: u-boot, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky

Hi Tom,

Thanks. You are right: RustSBI and OpenSBI are interchangeable here because
RustSBI implements OpenSBI's FW_DYNAMIC handoff protocol. This reflects
ecosystem compatibility rather than a formal RISC-V standard for
inter-firmware handoff.

I initially considered merging the tags, but I now prefer to keep
SPL_OPENSBI and SPL_RUSTSBI separate while moving the shared handoff code into
a common path. This keeps firmware-specific details, such as scratch options,
explicit and leaves room for other SBI implementations.

If this matches your understanding, I'll prepare a v2 along these lines.

Best,
Zhouqi

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

* Re: [PATCH] riscv: Add RustSBI firmware support
  2026-11-15 14:38 [PATCH] riscv: Add RustSBI firmware support Zhouqi Jiang
  2026-11-15 17:10 ` Tom Rini
@ 2026-11-16 12:45 ` Yao Zi
  2026-11-19  9:18 ` [PATCH v2 0/3] riscv: Support RustSBI through the FW_DYNAMIC handoff Zhouqi Jiang
       [not found] ` <20261119091842.3062208-1-luojia@rustsbi.com>
  3 siblings, 0 replies; 18+ messages in thread
From: Yao Zi @ 2026-11-16 12:45 UTC (permalink / raw)
  To: Zhouqi Jiang, u-boot; +Cc: tim609, leo.liang, me, sjg, alpernebiyasak, trini

On Sun, Nov 15, 2026 at 10:38:08PM +0800, Zhouqi Jiang wrote:
> RustSBI is a security-focused, open-source RISC-V SBI implementation
> written in Rust. It is listed in the SBI specification with
> implementation ID 4.
> 
> Add RustSBI support to U-Boot:
> - Add SPL firmware selection and dynamic handoff.
> - Add the RustSBI FIT image type and RUSTSBI binman input.
> - Update RISC-V FIT templates, documentation and tests.
> 
> Ref: https://docs.riscv.org/reference/sbi/_attachments/riscv-sbi.pdf
> Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
> ---
>  MAINTAINERS                             |  1 +
>  Makefile                                |  1 +
>  arch/riscv/Kconfig                      | 10 +++----
>  arch/riscv/dts/binman.dtsi              | 23 ++++++++++++++-
>  arch/riscv/dts/thead-th1520-binman.dtsi | 24 ++++++++++++++++
>  boot/image.c                            |  1 +
>  common/spl/Kconfig                      | 37 +++++++++++++++++++------
>  common/spl/Makefile                     |  1 +
>  common/spl/spl.c                        |  3 ++
>  common/spl/spl_fit.c                    |  3 +-
>  common/spl/spl_rustsbi.c                | 13 +++++++++
>  doc/board/emulation/qemu-riscv.rst      |  9 ++++++
>  include/image.h                         |  1 +
>  include/spl.h                           |  5 ++++
>  tools/binman/etype/rustsbi.py           | 18 ++++++++++++
>  tools/binman/ftest.py                   | 16 +++++++++++
>  tools/binman/missing-blob-help          |  4 +++
>  tools/binman/test/fip/rustsbi.dts       | 11 ++++++++

These changes should be defnitely split into separate commits, since
they're related to too many different components (riscv, boot flow,
spl loaders, binman, and doc).

>  18 files changed, 165 insertions(+), 16 deletions(-)
>  create mode 100644 common/spl/spl_rustsbi.c
>  create mode 100644 tools/binman/etype/rustsbi.py
>  create mode 100644 tools/binman/test/fip/rustsbi.dts

[...]

> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 386241efd4a..4bd562437cb 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -476,8 +476,7 @@ config SBI_V02
>  	  single hart needs to boot and enter the operating system. The booting
>  	  hart can bring up secondary harts one by one afterwards.
>  
> -	  Choose this option if OpenSBI release v0.7 or above is used together
> -	  with U-Boot.
> +	  Choose this option if the SBI firmware implements SBI v0.2 or later.

This change itself looks like a good clean-up, and could be accepted
independently with RustSBI support. Please split it into a separate
commit.

[...]

> diff --git a/doc/board/emulation/qemu-riscv.rst b/doc/board/emulation/qemu-riscv.rst
> index a76a1a8bf75..1be2f53f54e 100644
> --- a/doc/board/emulation/qemu-riscv.rst
> +++ b/doc/board/emulation/qemu-riscv.rst
> @@ -124,6 +124,15 @@ with the following commands.
>      make qemu-riscv64_spl_defconfig
>      make
>  
> +To use RustSBI firmware, build RustSBI Prototyper in dynamic mode for the
> +target with the SPL firmware load address. See https://github.com/rustsbi/rustsbi
> +for details. Set RUSTSBI to the firmware binary and build U-Boot::
> +
> +    make qemu-riscv32_spl_defconfig  # Or qemu-riscv64_spl_defconfig
> +    scripts/config --disable SPL_OPENSBI --enable SPL_RUSTSBI
> +    make olddefconfig
> +    make RUSTSBI=/path/to/rustsbi-prototyper-dynamic.bin
> +
>  The minimal QEMU commands to run U-Boot SPL in both 32-bit and 64-bit
>  configurations are:

We should probably not cover every possible SBI implementations in a
board-specific documentation. A better option might be explaining the
support status of different SBI implementations in RISC-V-specific
doc doc/arch/riscv.rst, and keep all the board-level ones as-is.

[...]

-- 
Thanks,
Yao Zi

Meow-mrrp-mrow, I'm a cat.

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

* Re: [PATCH] riscv: Add RustSBI firmware support
  2026-11-16  5:42   ` Zhouqi Jiang
@ 2026-11-16 13:02     ` Yao Zi
  2026-11-16 15:15       ` Zhouqi Jiang
  0 siblings, 1 reply; 18+ messages in thread
From: Yao Zi @ 2026-11-16 13:02 UTC (permalink / raw)
  To: Zhouqi Jiang, trini
  Cc: u-boot, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky

Hi Zhouqi,

Please quote the context on reply, so the mail is easier to read. I'm
adding Tom's comment back here.

> > To be clear, I think all of the changes to make things more clearly
> > generic here are good. At first read, it looks like aside from display
> > strings and a different scratch options value, RustSBI and OpenSBI are
> > interchangeable as far as U-Boot is concerned? If so, I'd like to
> > explore continuing down that path more.

On Mon, Nov 16, 2026 at 01:42:33PM +0800, Zhouqi Jiang wrote:
> Hi Tom,
> 
> Thanks. You are right: RustSBI and OpenSBI are interchangeable here because
> RustSBI implements OpenSBI's FW_DYNAMIC handoff protocol. This reflects
> ecosystem compatibility rather than a formal RISC-V standard for
> inter-firmware handoff.

So if RustSBI could be supported through OpenSBI's handoff protocol, why
not simply keep the current OpenSBI stuff as-is, only replace the
fw_dynamic.bin with RustSBI's binary?

From the view of this patch, I don't see any improvements by separating
RustSBI stuff out for the current situation.

> I initially considered merging the tags, but I now prefer to keep
> SPL_OPENSBI and SPL_RUSTSBI separate while moving the shared handoff code into
> a common path. This keeps firmware-specific details, such as scratch options,
> explicit and leaves room for other SBI implementations.

However, scratch options could be modified through Kconfig options
easily. Even with a separate Kconfig option introduced, others still
need to alternate it to use RustSBI-compatible scratch options.

So I think, like what I have said before, a documentation to explain
support status of different SBI implementations, and
SPL_OPENSBI_SCRATCH_OPTIONS' effects on them, might be more appropriate.

A documentation would also help users of boards whose maintainers
haven't/won't update their defconfig/documentation for RustSBI.

> If this matches your understanding, I'll prepare a v2 along these lines.

Thus I'm against the idea of adding a separate Kconfig option for
RustSBI, at least for now where it brings no real benefits.

> Best,
> Zhouqi

-- 
Thanks,
Yao Zi

Meow-mrrp-mrow, I'm a cat.

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

* Re: [PATCH] riscv: Add RustSBI firmware support
  2026-11-16 13:02     ` Yao Zi
@ 2026-11-16 15:15       ` Zhouqi Jiang
  2026-11-19 11:41         ` Yao Zi
  0 siblings, 1 reply; 18+ messages in thread
From: Zhouqi Jiang @ 2026-11-16 15:15 UTC (permalink / raw)
  To: Yao Zi
  Cc: u-boot, trini, tim609, leo.liang, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky

Hi Ziyao,

> Please quote the context on reply, so the mail is easier to read. I'm
> adding Tom's comment back here.

Thanks, and sorry I omitted the context in my previous reply.

> > > To be clear, I think all of the changes to make things more clearly
> > > generic here are good. At first read, it looks like aside from display
> > > strings and a different scratch options value, RustSBI and OpenSBI are
> > > interchangeable as far as U-Boot is concerned? If so, I'd like to
> > > explore continuing down that path more.
>
> On Mon, Nov 16, 2026 at 01:42:33PM +0800, Zhouqi Jiang wrote:
> > Thanks. You are right: RustSBI and OpenSBI are interchangeable here because
> > RustSBI implements OpenSBI's FW_DYNAMIC handoff protocol. This reflects
> > ecosystem compatibility rather than a formal RISC-V standard for
> > inter-firmware handoff.
>
> So if RustSBI could be supported through OpenSBI's handoff protocol, why
> not simply keep the current OpenSBI stuff as-is, only replace the
> fw_dynamic.bin with RustSBI's binary?
>
> From the view of this patch, I don't see any improvements by separating
> RustSBI stuff out for the current situation.

I agree. For v2, I will remove the separate SPL_RUSTSBI option and use the
existing FW_DYNAMIC handoff. The current draft keeps RUSTSBI= as an alias
for OPENSBI=; both use the same FIT entry and handoff. Would that alias be
useful, or would you prefer using OPENSBI= for both?

> > I initially considered merging the tags, but I now prefer to keep
> > SPL_OPENSBI and SPL_RUSTSBI separate while moving the shared handoff code into
> > a common path. This keeps firmware-specific details, such as scratch options,
> > explicit and leaves room for other SBI implementations.
>
> However, scratch options could be modified through Kconfig options
> easily. Even with a separate Kconfig option introduced, others still
> need to alternate it to use RustSBI-compatible scratch options.
>
> So I think, like what I have said before, a documentation to explain
> support status of different SBI implementations, and
> SPL_OPENSBI_SCRATCH_OPTIONS' effects on them, might be more appropriate.

Agreed. I have documented the supported implementations, firmware input and
scratch options in the RISC-V architecture documentation.

In your earlier review of the original patch [1], you also wrote:

> These changes should be defnitely split into separate commits, since
> they're related to too many different components (riscv, boot flow, spl
> loaders, binman, and doc).

> > @@ -476,8 +476,7 @@ config SBI_V02
> > -	  Choose this option if OpenSBI release v0.7 or above is used together
> > -	  with U-Boot.
> > +	  Choose this option if the SBI firmware implements SBI v0.2 or later.
>
> This change itself looks like a good clean-up, and could be accepted
> independently with RustSBI support. Please split it into a separate
> commit.

I plan to split v2 into three patches:

1. Make the SBI_V02 Kconfig help text generic.
2. Add the RUSTSBI= firmware input alias, binman test and missing-blob help.
3. Document SBI firmware support and scratch options in the RISC-V
   architecture documentation and SPL Kconfig help.

> We should probably not cover every possible SBI implementations in a
> board-specific documentation. A better option might be explaining the
> support status of different SBI implementations in RISC-V-specific doc
> doc/arch/riscv.rst, and keep all the board-level ones as-is.

Agreed. I have kept the board documentation unchanged and moved the
firmware information to doc/arch/riscv.rst.

One point I'd appreciate your and Tom's thoughts on: the existing FIT
description and SPL debug message say OpenSBI even when the binary is
RustSBI, although the U-Boot "sbi" command can identify the implementation
at runtime. Would carrying a firmware name for display be useful, or should
the existing labels remain as they are?

[1] https://lore.kernel.org/all/avr68Io04mE4YFs-@pie/

Thanks,
Zhouqi

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

* [PATCH v2 0/3] riscv: Support RustSBI through the FW_DYNAMIC handoff
  2026-11-15 14:38 [PATCH] riscv: Add RustSBI firmware support Zhouqi Jiang
  2026-11-15 17:10 ` Tom Rini
  2026-11-16 12:45 ` Yao Zi
@ 2026-11-19  9:18 ` Zhouqi Jiang
  2026-11-19 10:31   ` E Shattow
       [not found] ` <20261119091842.3062208-1-luojia@rustsbi.com>
  3 siblings, 1 reply; 18+ messages in thread
From: Zhouqi Jiang @ 2026-11-19  9:18 UTC (permalink / raw)
  To: u-boot
  Cc: trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

RustSBI Prototyper dynamic firmware accepts the FW_DYNAMIC handoff
already used by U-Boot SPL. This series documents that compatibility
and lets users provide the firmware with RUSTSBI= through the
existing opensbi binman entry.

The first patch makes the SBI_V02 help text firmware-independent.
The second adds the build input alias, a binman test and help for a
missing firmware blob. The third describes supported firmware and
the effects of the scratch options in the architecture guide and
SPL Kconfig help.

I'd appreciate Tom's and Yao's feedback on two points from the v1
discussion.

1. Patch 2 keeps RUSTSBI= as an alias for OPENSBI=. Both use the same
   FIT entry and SPL handoff. Would you prefer to keep the alias or
   use OPENSBI= for both firmware implementations?

2. The FIT description and SPL debug message currently say OpenSBI
   for both firmware binaries. The U-Boot "sbi" command identifies
   the implementation at runtime. Would it be useful to pass the
   firmware name through for display, or should we keep the current
   labels?

Changes in v2:
- Split the series into three focused patches.
- Reuse the existing SPL handoff and opensbi FIT entry.
- Put the firmware documentation in the RISC-V architecture guide.

v1: https://lore.kernel.org/u-boot/2744044E69DD25E5%2B20261115143808.1812787-1-luojia@rustsbi.com/

Zhouqi Jiang (3):
  riscv: Describe SBI_V02 in terms of the SBI version
  binman: Accept RUSTSBI as an alias for OPENSBI
  riscv: Document SBI firmware support in SPL

 Makefile                       |  6 ++++--
 arch/riscv/Kconfig             |  3 +--
 common/spl/Kconfig             |  8 +++++++-
 doc/arch/riscv.rst             | 17 +++++++++++++++++
 tools/binman/ftest.py          |  9 +++++++++
 tools/binman/missing-blob-help |  2 ++
 6 files changed, 40 insertions(+), 5 deletions(-)

base-commit: f6e8f09ed39347359ebddd983b96993c78b4ec7d
-- 
2.53.0.windows.2

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

* [PATCH v2 1/3] riscv: Describe SBI_V02 in terms of the SBI version
       [not found] ` <20261119091842.3062208-1-luojia@rustsbi.com>
@ 2026-11-19  9:18   ` Zhouqi Jiang
  2026-11-19 10:43     ` E Shattow
  2026-11-19  9:18   ` [PATCH v2 2/3] binman: Accept RUSTSBI as an alias for OPENSBI Zhouqi Jiang
  2026-11-19  9:18   ` [PATCH v2 3/3] riscv: Document SBI firmware support in SPL Zhouqi Jiang
  2 siblings, 1 reply; 18+ messages in thread
From: Zhouqi Jiang @ 2026-11-19  9:18 UTC (permalink / raw)
  To: u-boot
  Cc: trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

Describe SBI_V02 by the SBI version it requires so the help applies
to any SBI firmware implementing v0.2 or later.

Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
---
Changes in v2:
- Split the SBI_V02 help update into a standalone patch.

 arch/riscv/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 386241efd4a..0edf0247983 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -476,8 +476,7 @@ config SBI_V02
 	  single hart needs to boot and enter the operating system. The booting
 	  hart can bring up secondary harts one by one afterwards.
 
-	  Choose this option if OpenSBI release v0.7 or above is used together
-	  with U-Boot.
+	  Choose this option if the SBI firmware implements SBI v0.2 or later.
 
 endchoice
 
-- 
2.53.0.windows.2

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

* [PATCH v2 2/3] binman: Accept RUSTSBI as an alias for OPENSBI
       [not found] ` <20261119091842.3062208-1-luojia@rustsbi.com>
  2026-11-19  9:18   ` [PATCH v2 1/3] riscv: Describe SBI_V02 in terms of the SBI version Zhouqi Jiang
@ 2026-11-19  9:18   ` Zhouqi Jiang
  2026-11-19 10:47     ` E Shattow
  2026-11-19  9:18   ` [PATCH v2 3/3] riscv: Document SBI firmware support in SPL Zhouqi Jiang
  2 siblings, 1 reply; 18+ messages in thread
From: Zhouqi Jiang @ 2026-11-19  9:18 UTC (permalink / raw)
  To: u-boot
  Cc: trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

RustSBI Prototyper dynamic firmware accepts the FW_DYNAMIC handoff
used by the existing opensbi FIT entry. Let users pass its binary
with RUSTSBI= and forward it to the same binman entry. Reject builds
which specify both firmware inputs to make the choice explicit.

Exercise the opensbi entry with an alternate firmware filename and
describe the RustSBI input in the missing-blob help.

Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
---
Would you prefer to keep RUSTSBI= as an alias for the existing
firmware input, or use OPENSBI= for both implementations?

Changes in v2:
- Route RUSTSBI through the existing opensbi entry.
- Reject simultaneous OPENSBI and RUSTSBI inputs.
- Test the shared entry and update its missing-blob help.

 Makefile                       | 6 ++++--
 tools/binman/ftest.py          | 9 +++++++++
 tools/binman/missing-blob-help | 2 ++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 519866b82ea..85638310395 100644
--- a/Makefile
+++ b/Makefile
@@ -1679,7 +1679,9 @@ endif
 endif
 
 quiet_cmd_binman = BINMAN  $@
-cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
+cmd_binman = $(if $(and $(strip $(OPENSBI)),$(strip $(RUSTSBI))), \
+		$(error Specify only one of OPENSBI and RUSTSBI)) \
+		$(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		$(foreach f,$(BINMAN_TOOLPATHS),--toolpath $(f)) \
                 --toolpath $(objtree)/tools \
 		$(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
@@ -1694,7 +1696,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		-a atf-bl31-path=${BL31} \
 		-a tee-os-path=${TEE} \
 		-a ti-dm-path=${TI_DM} \
-		-a opensbi-path=${OPENSBI} \
+		-a opensbi-path=$(if $(strip $(RUSTSBI)),${RUSTSBI},${OPENSBI}) \
 		-a default-dt=$(default_dt) \
 		-a scp-path=$(SCP) \
 		-a rockchip-tpl-path=$(ROCKCHIP_TPL) \
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 567ffa96b2b..e8b58ce2ea8 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -97,6 +97,7 @@ TEE_OS_DATA           = b'this is some tee OS data'
 TI_DM_DATA            = b'tidmtidm'
 ATF_BL2U_DATA         = b'bl2u'
 OPENSBI_DATA          = b'opensbi'
+RUSTSBI_DATA          = b'rustsbi'
 SCP_DATA              = b'scp'
 ROCKCHIP_TPL_DATA     = b'rockchip-tpl'
 TEST_FDT1_DATA        = b'fdt1'
@@ -236,6 +237,7 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('dm.bin', TI_DM_DATA)
         TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA)
         TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
+        TestFunctional._MakeInputFile('rustsbi.bin', RUSTSBI_DATA)
         TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
         TestFunctional._MakeInputFile('rockchip-tpl.bin', ROCKCHIP_TPL_DATA)
         TestFunctional._MakeInputFile('ti_unsecure.bin', TI_UNSECURE_DATA)
@@ -5059,6 +5061,13 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('fip/opensbi.dts')
         self.assertEqual(OPENSBI_DATA, data[:len(OPENSBI_DATA)])
 
+    def testPackRustSBIWithOpenSBIEntry(self):
+        """Test RustSBI firmware as input to the existing OpenSBI entry"""
+        data = self._DoReadFileDtb(
+            'fip/opensbi.dts',
+            entry_args={'opensbi-path': 'rustsbi.bin'})[0]
+        self.assertEqual(RUSTSBI_DATA, data)
+
     def testSectionsSingleThread(self):
         """Test sections without multithreading"""
         data = self._DoReadFileDtb('entry/sections.dts', threads=0)[0]
diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help
index 27dc620bd35..8020e6cca76 100644
--- a/tools/binman/missing-blob-help
+++ b/tools/binman/missing-blob-help
@@ -37,6 +37,8 @@ See the documentation for your board. The OpenSBI git repo is at
 https://github.com/riscv/opensbi.git
 You may need to build fw_dynamic.bin first and re-build u-boot with
 OPENSBI=/path/to/fw_dynamic.bin
+RustSBI Prototyper dynamic firmware can be supplied with
+RUSTSBI=/path/to/rustsbi-prototyper-dynamic.bin
 
 rockchip-tpl:
 An external TPL is required to initialize DRAM. Get the external TPL
-- 
2.53.0.windows.2

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

* [PATCH v2 3/3] riscv: Document SBI firmware support in SPL
       [not found] ` <20261119091842.3062208-1-luojia@rustsbi.com>
  2026-11-19  9:18   ` [PATCH v2 1/3] riscv: Describe SBI_V02 in terms of the SBI version Zhouqi Jiang
  2026-11-19  9:18   ` [PATCH v2 2/3] binman: Accept RUSTSBI as an alias for OPENSBI Zhouqi Jiang
@ 2026-11-19  9:18   ` Zhouqi Jiang
  2026-11-19 11:14     ` E Shattow
  2 siblings, 1 reply; 18+ messages in thread
From: Zhouqi Jiang @ 2026-11-19  9:18 UTC (permalink / raw)
  To: u-boot
  Cc: trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

Document how to supply OpenSBI and RustSBI Prototyper dynamic
firmware to the existing SPL handoff. Explain the firmware load
address, the FIT OS label, and how each implementation handles
SPL_OPENSBI_SCRATCH_OPTIONS.

Mention RustSBI compatibility in the SPL Kconfig help so users can
find it when configuring U-Boot.

Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
---
Changes in v2:
- Document the shared handoff in the RISC-V architecture guide.
- Explain scratch options in the architecture guide and SPL help.

 common/spl/Kconfig |  8 +++++++-
 doc/arch/riscv.rst | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 4930ecb0861..07548094e38 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1744,7 +1744,10 @@ config SPL_OPENSBI
 	  Interface (SBI) specification. U-Boot supports the OpenSBI FW_DYNAMIC
 	  firmware. It is loaded and started by U-Boot SPL.
 
-	  More details are available at https://github.com/riscv/opensbi and
+	  RustSBI Prototyper dynamic firmware also supports this handoff.
+
+	  More details are available at https://github.com/riscv/opensbi,
+	  https://github.com/rustsbi/rustsbi and
 	  https://github.com/riscv/riscv-sbi-doc
 
 config SPL_OPENSBI_LOAD_ADDR
@@ -1763,6 +1766,9 @@ config SPL_OPENSBI_SCRATCH_OPTIONS
 	  - SBI_SCRATCH_NO_BOOT_PRINTS = 0x1 (Disable prints during boot)
 	  - SBI_SCRATCH_DEBUG_PRINTS   = 0x2 (Enable runtime debug prints)
 
+	  RustSBI Prototyper currently does not use these options. See the
+	  RISC-V architecture documentation for details.
+
 config SPL_TARGET
 	string "Addtional build targets for 'make'"
 	default "spl/u-boot-spl.srec" if RCAR_GEN2
diff --git a/doc/arch/riscv.rst b/doc/arch/riscv.rst
index af0c48b8982..dc4cc853baa 100644
--- a/doc/arch/riscv.rst
+++ b/doc/arch/riscv.rst
@@ -72,6 +72,23 @@ To examine the boot process with the QEMU virt machine, you can follow the
 steps in the "Running U-Boot SPL" section of the following document:
 :doc:`../board/emulation/qemu-riscv`.
 
+SBI firmware for SPL
+--------------------
+
+With ``CONFIG_SPL_OPENSBI``, SPL passes FW_DYNAMIC handoff information to
+the firmware loaded from the FIT image. Supported implementations include:
+
+* `OpenSBI FW_DYNAMIC <https://github.com/riscv-software-src/opensbi>`_.
+* `RustSBI Prototyper dynamic firmware <https://github.com/rustsbi/rustsbi/tree/main/firmware>`_.
+
+Provide the firmware using either ``OPENSBI=/path/to/firmware.bin`` or
+``RUSTSBI=/path/to/firmware.bin``. Its link address must match
+``CONFIG_SPL_OPENSBI_LOAD_ADDR``. Both use the ``opensbi`` FIT OS label.
+
+``CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS`` passes options to the firmware. OpenSBI
+uses ``0x1`` to disable boot prints and ``0x2`` for runtime debug prints;
+RustSBI Prototyper currently ignores these options.
+
 Toolchain
 ---------
 
-- 
2.53.0.windows.2

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

* Re: [PATCH v2 0/3] riscv: Support RustSBI through the FW_DYNAMIC handoff
  2026-11-19  9:18 ` [PATCH v2 0/3] riscv: Support RustSBI through the FW_DYNAMIC handoff Zhouqi Jiang
@ 2026-11-19 10:31   ` E Shattow
  0 siblings, 0 replies; 18+ messages in thread
From: E Shattow @ 2026-11-19 10:31 UTC (permalink / raw)
  To: Zhouqi Jiang, u-boot
  Cc: trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

Hi Zhougi,

On 11/19/26 01:18, Zhouqi Jiang wrote:
> RustSBI Prototyper dynamic firmware accepts the FW_DYNAMIC handoff
> already used by U-Boot SPL. This series documents that compatibility
> and lets users provide the firmware with RUSTSBI= through the
> existing opensbi binman entry.
> 
> The first patch makes the SBI_V02 help text firmware-independent.
> The second adds the build input alias, a binman test and help for a
> missing firmware blob. The third describes supported firmware and
> the effects of the scratch options in the architecture guide and
> SPL Kconfig help.
> 
> I'd appreciate Tom's and Yao's feedback on two points from the v1
> discussion.
> 
> 1. Patch 2 keeps RUSTSBI= as an alias for OPENSBI=. Both use the same
>    FIT entry and SPL handoff. Would you prefer to keep the alias or
>    use OPENSBI= for both firmware implementations?

Correct, keep OPENSBI= and no additional aliases please.

Arguably this should be a few bytes shorter as 'SBI=' however the effort
to change this and all the documentation and all references to U-Boot
from external write-ups and documentation is without any particular
purpose. "OpenSBI" was the first mover, and as that goes in technology
the first mover tends to be the "Google it" or "Open up your Excel"...

OPENSBI= has the meaning here of "an SBI implementation" and we must use
that for consistency. Adding an alias adds to technical debt without any
particular purpose.

> 
> 2. The FIT description and SPL debug message currently say OpenSBI
>    for both firmware binaries. The U-Boot "sbi" command identifies
>    the implementation at runtime. Would it be useful to pass the
>    firmware name through for display, or should we keep the current
>    labels?

If you have "sbi" command enabled then you probably already know the SBI
implementation linked or packaged with a build of U-Boot, and if you do
not then (depending on scratch options at OpenSBI build time e.g.) a
huge banner gets printed with this information before U-Boot main app
invocation. Is there a common use for this that "sbi" command should be
enabled for most users?

> 
> Changes in v2:
> - Split the series into three focused patches.
> - Reuse the existing SPL handoff and opensbi FIT entry.
> - Put the firmware documentation in the RISC-V architecture guide.
> 
> v1: https://lore.kernel.org/u-boot/2744044E69DD25E5%2B20261115143808.1812787-1-luojia@rustsbi.com/
> 
> Zhouqi Jiang (3):
>   riscv: Describe SBI_V02 in terms of the SBI version
>   binman: Accept RUSTSBI as an alias for OPENSBI
>   riscv: Document SBI firmware support in SPL
> 
>  Makefile                       |  6 ++++--
>  arch/riscv/Kconfig             |  3 +--
>  common/spl/Kconfig             |  8 +++++++-
>  doc/arch/riscv.rst             | 17 +++++++++++++++++
>  tools/binman/ftest.py          |  9 +++++++++
>  tools/binman/missing-blob-help |  2 ++
>  6 files changed, 40 insertions(+), 5 deletions(-)
> 
> base-commit: f6e8f09ed39347359ebddd983b96993c78b4ec7d

-E

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

* Re: [PATCH v2 1/3] riscv: Describe SBI_V02 in terms of the SBI version
  2026-11-19  9:18   ` [PATCH v2 1/3] riscv: Describe SBI_V02 in terms of the SBI version Zhouqi Jiang
@ 2026-11-19 10:43     ` E Shattow
  2026-11-19 12:08       ` Yao Zi
  0 siblings, 1 reply; 18+ messages in thread
From: E Shattow @ 2026-11-19 10:43 UTC (permalink / raw)
  To: Zhouqi Jiang, u-boot
  Cc: trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

Hi Zhougi,

On 11/19/26 01:18, Zhouqi Jiang wrote:
> Describe SBI_V02 by the SBI version it requires so the help applies
> to any SBI firmware implementing v0.2 or later.
> 
> Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
> ---
> Changes in v2:
> - Split the SBI_V02 help update into a standalone patch.
> 
>  arch/riscv/Kconfig | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 386241efd4a..0edf0247983 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -476,8 +476,7 @@ config SBI_V02
>  	  single hart needs to boot and enter the operating system. The booting
>  	  hart can bring up secondary harts one by one afterwards.
>  
> -	  Choose this option if OpenSBI release v0.7 or above is used together
> -	  with U-Boot.
> +	  Choose this option if the SBI firmware implements SBI v0.2 or later.

SBI is not necessarily firmware in that sense.

"Choose this option if a RISC-V Supervisor Binary Interface
Specification v0.2-or-later conformant implementation is used together
with U-Boot. For example, OpenSBI release v0.7 or above."

Most users do not know or care about the specification. However if you
want this to be applicable to all OpenSBI compatible implementations at
this specific level of compatibility then we should mention it in terms
of OpenSBI or else it becomes very confusing to see OPENSBI= in
documentation.

[..]

-E

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

* Re: [PATCH v2 2/3] binman: Accept RUSTSBI as an alias for OPENSBI
  2026-11-19  9:18   ` [PATCH v2 2/3] binman: Accept RUSTSBI as an alias for OPENSBI Zhouqi Jiang
@ 2026-11-19 10:47     ` E Shattow
  0 siblings, 0 replies; 18+ messages in thread
From: E Shattow @ 2026-11-19 10:47 UTC (permalink / raw)
  To: Zhouqi Jiang, u-boot
  Cc: trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

Hi Zhougi,

On 11/19/26 01:18, Zhouqi Jiang wrote:
> RustSBI Prototyper dynamic firmware accepts the FW_DYNAMIC handoff
> used by the existing opensbi FIT entry. Let users pass its binary
> with RUSTSBI= and forward it to the same binman entry. Reject builds
> which specify both firmware inputs to make the choice explicit.
> 
> Exercise the opensbi entry with an alternate firmware filename and
> describe the RustSBI input in the missing-blob help.
> 
> Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
> ---
> Would you prefer to keep RUSTSBI= as an alias for the existing
> firmware input, or use OPENSBI= for both implementations?
> 
> Changes in v2:
> - Route RUSTSBI through the existing opensbi entry.
> - Reject simultaneous OPENSBI and RUSTSBI inputs.
> - Test the shared entry and update its missing-blob help.
> 
>  Makefile                       | 6 ++++--
>  tools/binman/ftest.py          | 9 +++++++++
>  tools/binman/missing-blob-help | 2 ++
>  3 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 519866b82ea..85638310395 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1679,7 +1679,9 @@ endif
>  endif
>  
>  quiet_cmd_binman = BINMAN  $@
> -cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
> +cmd_binman = $(if $(and $(strip $(OPENSBI)),$(strip $(RUSTSBI))), \
> +		$(error Specify only one of OPENSBI and RUSTSBI)) \
> +		$(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
>  		$(foreach f,$(BINMAN_TOOLPATHS),--toolpath $(f)) \
>                  --toolpath $(objtree)/tools \
>  		$(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
> @@ -1694,7 +1696,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
>  		-a atf-bl31-path=${BL31} \
>  		-a tee-os-path=${TEE} \
>  		-a ti-dm-path=${TI_DM} \
> -		-a opensbi-path=${OPENSBI} \
> +		-a opensbi-path=$(if $(strip $(RUSTSBI)),${RUSTSBI},${OPENSBI}) \
>  		-a default-dt=$(default_dt) \
>  		-a scp-path=$(SCP) \
>  		-a rockchip-tpl-path=$(ROCKCHIP_TPL) \
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index 567ffa96b2b..e8b58ce2ea8 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -97,6 +97,7 @@ TEE_OS_DATA           = b'this is some tee OS data'
>  TI_DM_DATA            = b'tidmtidm'
>  ATF_BL2U_DATA         = b'bl2u'
>  OPENSBI_DATA          = b'opensbi'
> +RUSTSBI_DATA          = b'rustsbi'
>  SCP_DATA              = b'scp'
>  ROCKCHIP_TPL_DATA     = b'rockchip-tpl'
>  TEST_FDT1_DATA        = b'fdt1'
> @@ -236,6 +237,7 @@ class TestFunctional(unittest.TestCase):
>          TestFunctional._MakeInputFile('dm.bin', TI_DM_DATA)
>          TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA)
>          TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
> +        TestFunctional._MakeInputFile('rustsbi.bin', RUSTSBI_DATA)
>          TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
>          TestFunctional._MakeInputFile('rockchip-tpl.bin', ROCKCHIP_TPL_DATA)
>          TestFunctional._MakeInputFile('ti_unsecure.bin', TI_UNSECURE_DATA)
> @@ -5059,6 +5061,13 @@ class TestFunctional(unittest.TestCase):
>          data = self._DoReadFile('fip/opensbi.dts')
>          self.assertEqual(OPENSBI_DATA, data[:len(OPENSBI_DATA)])
>  
> +    def testPackRustSBIWithOpenSBIEntry(self):
> +        """Test RustSBI firmware as input to the existing OpenSBI entry"""
> +        data = self._DoReadFileDtb(
> +            'fip/opensbi.dts',
> +            entry_args={'opensbi-path': 'rustsbi.bin'})[0]
> +        self.assertEqual(RUSTSBI_DATA, data)
> +
>      def testSectionsSingleThread(self):
>          """Test sections without multithreading"""
>          data = self._DoReadFileDtb('entry/sections.dts', threads=0)[0]
> diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help
> index 27dc620bd35..8020e6cca76 100644
> --- a/tools/binman/missing-blob-help
> +++ b/tools/binman/missing-blob-help
> @@ -37,6 +37,8 @@ See the documentation for your board. The OpenSBI git repo is at
>  https://github.com/riscv/opensbi.git
>  You may need to build fw_dynamic.bin first and re-build u-boot with
>  OPENSBI=/path/to/fw_dynamic.bin
> +RustSBI Prototyper dynamic firmware can be supplied with
> +RUSTSBI=/path/to/rustsbi-prototyper-dynamic.bin
>  
>  rockchip-tpl:
>  An external TPL is required to initialize DRAM. Get the external TPL

NAK.  No alias additional to OPENSBI=, please.

-E

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

* Re: [PATCH v2 3/3] riscv: Document SBI firmware support in SPL
  2026-11-19  9:18   ` [PATCH v2 3/3] riscv: Document SBI firmware support in SPL Zhouqi Jiang
@ 2026-11-19 11:14     ` E Shattow
  2026-11-19 12:05       ` Zhouqi Jiang
  0 siblings, 1 reply; 18+ messages in thread
From: E Shattow @ 2026-11-19 11:14 UTC (permalink / raw)
  To: Zhouqi Jiang, u-boot
  Cc: trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

Hi Zhougi,

On 11/19/26 01:18, Zhouqi Jiang wrote:
> Document how to supply OpenSBI and RustSBI Prototyper dynamic
> firmware to the existing SPL handoff. Explain the firmware load
> address, the FIT OS label, and how each implementation handles
> SPL_OPENSBI_SCRATCH_OPTIONS.
> 
> Mention RustSBI compatibility in the SPL Kconfig help so users can
> find it when configuring U-Boot.
> 
> Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
> ---
> Changes in v2:
> - Document the shared handoff in the RISC-V architecture guide.
> - Explain scratch options in the architecture guide and SPL help.
> 
>  common/spl/Kconfig |  8 +++++++-
>  doc/arch/riscv.rst | 17 +++++++++++++++++
>  2 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 4930ecb0861..07548094e38 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -1744,7 +1744,10 @@ config SPL_OPENSBI
>  	  Interface (SBI) specification. U-Boot supports the OpenSBI FW_DYNAMIC
>  	  firmware. It is loaded and started by U-Boot SPL.
>  
> -	  More details are available at https://github.com/riscv/opensbi and
> +	  RustSBI Prototyper dynamic firmware also supports this handoff.

How is 'RustSBI Prototyper' distinct from 'RustSBI'. Is this a
registered trademark? Is it a company name?

It should be enough to simply introduce that SBI implementations can be
passed to the build process with OPENSBI= and then to list (in 'LANG=C
sort' order) or link to specific build instructions for the available
implementations where different from OpenSBI.

> +
> +	  More details are available at https://github.com/riscv/opensbi,
the trailing comma at the end of URL here is problematic since it is a
valid component of any URI

> +	  https://github.com/rustsbi/rustsbi and
>  	  https://github.com/riscv/riscv-sbi-doc
>  
>  config SPL_OPENSBI_LOAD_ADDR
> @@ -1763,6 +1766,9 @@ config SPL_OPENSBI_SCRATCH_OPTIONS
>  	  - SBI_SCRATCH_NO_BOOT_PRINTS = 0x1 (Disable prints during boot)
>  	  - SBI_SCRATCH_DEBUG_PRINTS   = 0x2 (Enable runtime debug prints)
>  
> +	  RustSBI Prototyper currently does not use these options. See the
> +	  RISC-V architecture documentation for details.
> +

What does the RISC-V architecture documentation have to say about
'RustSBI Prototyper' lacking support for OpenSBI scratch options. This
sounds like four unrelated topics in one sentence.

>  config SPL_TARGET
>  	string "Addtional build targets for 'make'"
>  	default "spl/u-boot-spl.srec" if RCAR_GEN2
> diff --git a/doc/arch/riscv.rst b/doc/arch/riscv.rst
> index af0c48b8982..dc4cc853baa 100644
> --- a/doc/arch/riscv.rst
> +++ b/doc/arch/riscv.rst
> @@ -72,6 +72,23 @@ To examine the boot process with the QEMU virt machine, you can follow the
>  steps in the "Running U-Boot SPL" section of the following document:
>  :doc:`../board/emulation/qemu-riscv`.
>  
> +SBI firmware for SPL
> +--------------------
> +
> +With ``CONFIG_SPL_OPENSBI``, SPL passes FW_DYNAMIC handoff information to
> +the firmware loaded from the FIT image. Supported implementations include:

U-Boot main app build for SpacemiT K3 packages OpenSBI fw_dynamic.bin
and so I'm not understanding this explanation you have provided.

$ ls build/opensbi/platform/generic/firmware/fw_*bin
build/opensbi/platform/generic/firmware/fw_dynamic.bin
build/opensbi/platform/generic/firmware/fw_jump.bin
build/opensbi/platform/generic/firmware/fw_payload.bin

At some point in OpenSBI development, if I remember correctly v1.5 tag
or so, fw_dynamic.bin transitioned to be built fully dynamic /
relocatable. Previous to then it required the .text section address
specified at build time.

> +
> +* `OpenSBI FW_DYNAMIC <https://github.com/riscv-software-src/opensbi>`_.
> +* `RustSBI Prototyper dynamic firmware <https://github.com/rustsbi/rustsbi/tree/main/firmware>`_.
> +
> +Provide the firmware using either ``OPENSBI=/path/to/firmware.bin`` or
> +``RUSTSBI=/path/to/firmware.bin``. Its link address must match
> +``CONFIG_SPL_OPENSBI_LOAD_ADDR``. Both use the ``opensbi`` FIT OS label.
> +
> +``CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS`` passes options to the firmware. OpenSBI
> +uses ``0x1`` to disable boot prints and ``0x2`` for runtime debug prints;

It could be 0x3 for both options?

> +RustSBI Prototyper currently ignores these options.
> +

Is that a bug? Why mention this, here?

>  Toolchain
>  ---------
>  

-E

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

* Re: [PATCH] riscv: Add RustSBI firmware support
  2026-11-16 15:15       ` Zhouqi Jiang
@ 2026-11-19 11:41         ` Yao Zi
  2026-11-19 12:00           ` Zhouqi Jiang
  0 siblings, 1 reply; 18+ messages in thread
From: Yao Zi @ 2026-11-19 11:41 UTC (permalink / raw)
  To: Zhouqi Jiang, Yao Zi
  Cc: u-boot, trini, tim609, leo.liang, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky

On Mon, Nov 16, 2026 at 11:15:56PM +0800, Zhouqi Jiang wrote:
> Hi Ziyao,
> 
> > Please quote the context on reply, so the mail is easier to read. I'm
> > adding Tom's comment back here.
> 
> Thanks, and sorry I omitted the context in my previous reply.
> 
> > > > To be clear, I think all of the changes to make things more clearly
> > > > generic here are good. At first read, it looks like aside from display
> > > > strings and a different scratch options value, RustSBI and OpenSBI are
> > > > interchangeable as far as U-Boot is concerned? If so, I'd like to
> > > > explore continuing down that path more.
> >
> > On Mon, Nov 16, 2026 at 01:42:33PM +0800, Zhouqi Jiang wrote:
> > > Thanks. You are right: RustSBI and OpenSBI are interchangeable here because
> > > RustSBI implements OpenSBI's FW_DYNAMIC handoff protocol. This reflects
> > > ecosystem compatibility rather than a formal RISC-V standard for
> > > inter-firmware handoff.
> >
> > So if RustSBI could be supported through OpenSBI's handoff protocol, why
> > not simply keep the current OpenSBI stuff as-is, only replace the
> > fw_dynamic.bin with RustSBI's binary?
> >
> > From the view of this patch, I don't see any improvements by separating
> > RustSBI stuff out for the current situation.
> 
> I agree. For v2, I will remove the separate SPL_RUSTSBI option and use the
> existing FW_DYNAMIC handoff. The current draft keeps RUSTSBI= as an alias
> for OPENSBI=; both use the same FIT entry and handoff. Would that alias be
> useful, or would you prefer using OPENSBI= for both?

I prefer to keep using OPENSBI=.

> > > I initially considered merging the tags, but I now prefer to keep
> > > SPL_OPENSBI and SPL_RUSTSBI separate while moving the shared handoff code into
> > > a common path. This keeps firmware-specific details, such as scratch options,
> > > explicit and leaves room for other SBI implementations.
> >
> > However, scratch options could be modified through Kconfig options
> > easily. Even with a separate Kconfig option introduced, others still
> > need to alternate it to use RustSBI-compatible scratch options.
> >
> > So I think, like what I have said before, a documentation to explain
> > support status of different SBI implementations, and
> > SPL_OPENSBI_SCRATCH_OPTIONS' effects on them, might be more appropriate.
> 
> Agreed. I have documented the supported implementations, firmware input and
> scratch options in the RISC-V architecture documentation.
> 
> In your earlier review of the original patch [1], you also wrote:
> 
> > These changes should be defnitely split into separate commits, since
> > they're related to too many different components (riscv, boot flow, spl
> > loaders, binman, and doc).
> 
> > > @@ -476,8 +476,7 @@ config SBI_V02
> > > -	  Choose this option if OpenSBI release v0.7 or above is used together
> > > -	  with U-Boot.
> > > +	  Choose this option if the SBI firmware implements SBI v0.2 or later.
> >
> > This change itself looks like a good clean-up, and could be accepted
> > independently with RustSBI support. Please split it into a separate
> > commit.
> 
> I plan to split v2 into three patches:
> 
> 1. Make the SBI_V02 Kconfig help text generic.

Makes sense.

> 2. Add the RUSTSBI= firmware input alias, binman test and missing-blob help.

Whoever, the code would be largely identical to the OpenSBI handling,
no? This is one of the reasons I dislike the idea.

> 3. Document SBI firmware support and scratch options in the RISC-V
>    architecture documentation and SPL Kconfig help.

The documentation itself should probably not stay in SPL Kconfig help
text. You could inform the reader to refer to something in doc/ instead.

> > We should probably not cover every possible SBI implementations in a
> > board-specific documentation. A better option might be explaining the
> > support status of different SBI implementations in RISC-V-specific doc
> > doc/arch/riscv.rst, and keep all the board-level ones as-is.
> 
> Agreed. I have kept the board documentation unchanged and moved the
> firmware information to doc/arch/riscv.rst.
> 
> One point I'd appreciate your and Tom's thoughts on: the existing FIT
> description and SPL debug message say OpenSBI even when the binary is
> RustSBI, although the U-Boot "sbi" command can identify the implementation
> at runtime. Would carrying a firmware name for display be useful, or should
> the existing labels remain as they are?

I prefer to keep them as-is.

> [1] https://lore.kernel.org/all/avr68Io04mE4YFs-@pie/
> 
> Thanks,
> Zhouqi

-- 
Thanks,
Yao Zi

Meow-mrrp-mrow, I'm a cat.

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

* Re: [PATCH] riscv: Add RustSBI firmware support
  2026-11-19 11:41         ` Yao Zi
@ 2026-11-19 12:00           ` Zhouqi Jiang
  0 siblings, 0 replies; 18+ messages in thread
From: Zhouqi Jiang @ 2026-11-19 12:00 UTC (permalink / raw)
  To: Yao Zi
  Cc: u-boot, trini, tim609, leo.liang, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky

Hi Ziyao,

Thanks for following up.

> > Would that alias be
> > useful, or would you prefer using OPENSBI= for both?
>
> I prefer to keep using OPENSBI=.

Agreed. I've dropped the alias patch. Both OpenSBI and RustSBI use
OPENSBI= and the existing FW_DYNAMIC handoff.

> > 3. Document SBI firmware support and scratch options in the RISC-V
> >    architecture documentation and SPL Kconfig help.
>
> The documentation itself should probably not stay in SPL Kconfig help
> text. You could inform the reader to refer to something in doc/ instead.

doc/arch/riscv.rst now explains how to supply the SBI firmware and how
SPL passes the scratch options through the FW_DYNAMIC handoff.

> > Would carrying a firmware name for display be useful, or should
> > the existing labels remain as they are?
>
> I prefer to keep them as-is.

Agreed. v3 keeps the existing FIT descriptions and SPL debug messages.

I'll send v3 as a two-patch series, with the SBI_V02 help cleanup in the
first patch and the RISC-V documentation in the second.

Thanks,
Zhouqi

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

* Re: [PATCH v2 3/3] riscv: Document SBI firmware support in SPL
  2026-11-19 11:14     ` E Shattow
@ 2026-11-19 12:05       ` Zhouqi Jiang
  0 siblings, 0 replies; 18+ messages in thread
From: Zhouqi Jiang @ 2026-11-19 12:05 UTC (permalink / raw)
  To: E Shattow
  Cc: u-boot, trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

Hi E,

Thanks for the review. I'll post a v3 series with two patches covering
the SBI_V02 help text and the RISC-V firmware documentation.

> > +	  RustSBI Prototyper dynamic firmware also supports this handoff.
>
> How is 'RustSBI Prototyper' distinct from 'RustSBI'. Is this a
> registered trademark? Is it a company name?

RustSBI is the project name. RustSBI Prototyper is its SBI firmware,
built on the RustSBI runtime.
The guide now uses "RustSBI dynamic firmware" to identify the
implementation and build mode. It lists OpenSBI and RustSBI with links,
and the example uses the actual filename, rustsbi-prototyper-dynamic.bin.

> U-Boot main app build for SpacemiT K3 packages OpenSBI fw_dynamic.bin
> and so I'm not understanding this explanation you have provided.

The guide now describes OPENSBI= as a build input for packaging firmware
and explains the FW_DYNAMIC handoff in the CONFIG_SPL_OPENSBI case.
It gives the board load address requirement for firmware that needs a
fixed link address.

> > +uses ``0x1`` to disable boot prints and ``0x2`` for runtime debug prints;
>
> It could be 0x3 for both options?

Yes, 0x3 sets both OpenSBI print flags. The guide describes how SPL
passes the options and refers to the OpenSBI flags in the Kconfig help.

From your reply to the cover letter [1]:

> > Would you prefer to keep the alias or
> > use OPENSBI= for both firmware implementations?
>
> Correct, keep OPENSBI= and no additional aliases please.

I've dropped the alias patch and use OPENSBI= for both implementations.

> > The U-Boot "sbi" command identifies the implementation at runtime.
>
> Is there a common use for this that "sbi" command should be
> enabled for most users?

I used it to confirm which firmware was running after booting each
image. The existing optional command is sufficient for that check.

[1] https://lists.u-boot-project.org/pipermail/u-boot/2026-November/641123.html

Thanks,
Zhouqi

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

* Re: [PATCH v2 1/3] riscv: Describe SBI_V02 in terms of the SBI version
  2026-11-19 10:43     ` E Shattow
@ 2026-11-19 12:08       ` Yao Zi
  0 siblings, 0 replies; 18+ messages in thread
From: Yao Zi @ 2026-11-19 12:08 UTC (permalink / raw)
  To: E Shattow, Zhouqi Jiang, u-boot
  Cc: trini, tim609, leo.liang, me, sjg, alpernebiyasak,
	jiangzhouqi2025, plucky, Chao Liu, Daniel Maslowski

On Thu, Nov 19, 2026 at 02:43:12AM -0800, E Shattow wrote:
> Hi Zhougi,
> 
> On 11/19/26 01:18, Zhouqi Jiang wrote:
> > Describe SBI_V02 by the SBI version it requires so the help applies
> > to any SBI firmware implementing v0.2 or later.
> > 
> > Signed-off-by: Zhouqi Jiang <luojia@rustsbi.com>
> > ---
> > Changes in v2:
> > - Split the SBI_V02 help update into a standalone patch.
> > 
> >  arch/riscv/Kconfig | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 386241efd4a..0edf0247983 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -476,8 +476,7 @@ config SBI_V02
> >  	  single hart needs to boot and enter the operating system. The booting
> >  	  hart can bring up secondary harts one by one afterwards.
> >  
> > -	  Choose this option if OpenSBI release v0.7 or above is used together
> > -	  with U-Boot.
> > +	  Choose this option if the SBI firmware implements SBI v0.2 or later.
> 
> SBI is not necessarily firmware in that sense.
> 
> "Choose this option if a RISC-V Supervisor Binary Interface
> Specification v0.2-or-later conformant implementation is used together
> with U-Boot. For example, OpenSBI release v0.7 or above."

I'll second the idea of keeping OpenSBI-related stuff here for more
users to benefit. But also, most users don't care the full form of
"SBI". So let's say

> Choose this option if the SBI implementation used with U-Boot conforms
> to RISC-V SBI specification v0.2 or later.

One really interested in what SBI is could easily find its meaning by
searching the web.

> Most users do not know or care about the specification. However if you
> want this to be applicable to all OpenSBI compatible implementations at
> this specific level of compatibility then we should mention it in terms
> of OpenSBI or else it becomes very confusing to see OPENSBI= in
> documentation.
> 
> [..]
> 
> -E

-- 
Thanks,
Yao Zi

Meow-mrrp-mrow, I'm a cat.

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

end of thread, other threads:[~2026-11-19 12:09 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 14:38 [PATCH] riscv: Add RustSBI firmware support Zhouqi Jiang
2026-11-15 17:10 ` Tom Rini
2026-11-16  5:42   ` Zhouqi Jiang
2026-11-16 13:02     ` Yao Zi
2026-11-16 15:15       ` Zhouqi Jiang
2026-11-19 11:41         ` Yao Zi
2026-11-19 12:00           ` Zhouqi Jiang
2026-11-16 12:45 ` Yao Zi
2026-11-19  9:18 ` [PATCH v2 0/3] riscv: Support RustSBI through the FW_DYNAMIC handoff Zhouqi Jiang
2026-11-19 10:31   ` E Shattow
     [not found] ` <20261119091842.3062208-1-luojia@rustsbi.com>
2026-11-19  9:18   ` [PATCH v2 1/3] riscv: Describe SBI_V02 in terms of the SBI version Zhouqi Jiang
2026-11-19 10:43     ` E Shattow
2026-11-19 12:08       ` Yao Zi
2026-11-19  9:18   ` [PATCH v2 2/3] binman: Accept RUSTSBI as an alias for OPENSBI Zhouqi Jiang
2026-11-19 10:47     ` E Shattow
2026-11-19  9:18   ` [PATCH v2 3/3] riscv: Document SBI firmware support in SPL Zhouqi Jiang
2026-11-19 11:14     ` E Shattow
2026-11-19 12:05       ` Zhouqi Jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.