* [PATCH] riscv: Add RustSBI firmware support
@ 2026-11-15 14:38 Zhouqi Jiang
2026-11-15 17:10 ` Tom Rini
2026-11-16 12:45 ` Yao Zi
0 siblings, 2 replies; 6+ 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] 6+ 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
1 sibling, 1 reply; 6+ 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] 6+ 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; 6+ 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] 6+ 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; 6+ 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] 6+ messages in thread
* Re: [PATCH] riscv: Add RustSBI firmware support
2026-11-16 13:02 ` Yao Zi
@ 2026-11-16 15:15 ` Zhouqi Jiang
0 siblings, 0 replies; 6+ 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] 6+ 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
1 sibling, 0 replies; 6+ 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] 6+ messages in thread
end of thread, other threads:[~2026-11-16 16:30 UTC | newest]
Thread overview: 6+ 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-16 12:45 ` Yao Zi
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.