Do not reserve memory for coprocessor FW
Subsystems (3)
cover Do not reserve memory for coprocessor FW
Milk-V Duo and Duo-256M reserve a region for coprocessor FW at the end of RAM. It is not correct because:
- FSBL can be configured to load FW into a different region
- if no firmware is loaded, the reserved memory is wasted
As explained in [1, 2], FSBL should reserve the region at runtime.
The latest FSBL can boot the system without coprocessor FW:
FSBL Jb2829:g6f8962c394dd-dirty:2026-09-20T13:04:17+00:00 st_on_reason=d0000
st_off_reason=0
P2S/0x1000/0xc00fa00.
SD/0xaa00/0x1000/0x1000/0.P2E.
cv181x DDR init.
ddr_param[0]=0x0.
pkg_type=5
D1_3_2
DDR3-2G-QFN
Data rate=1866.
DDR BIST PASS
PLLS.
PLLE.
C2S/0x0/0x0/0x0.
No C906L image.
MS/0xba00/0x80000000/0x43e00.
SD/0xba00/0x43e00/0x43e00/0.ME.
L2/0x4f800. SD/0x4f800/0x200/0x200/0.L2/0x33334c42/0xcafe4b49/0x80200000/0x8c200/0x8c200 SD/0x4f800/0x8c200/0x8c200/0.sys_switch_all_to_pll... Loader_2nd loaded.
Use internal 32k
So it is safe to remove coprocessor_rtos nodes.
[1]: https://lore.kernel.org/sophgo/[email protected]/
[2]: https://lore.kernel.org/sophgo/aqrhRic7Ww6fPhxg@pie/
---
Andrei Lalaev (2):
riscv: dts: sophgo: cv1800b-milkv-duo: drop reserved memory node
riscv: dts: sophgo: sg2002-milkv-duo256m: drop reserved memory node
arch/riscv/boot/dts/sophgo/cv1800b-milkv-duo.dts | 11 ----------- arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts | 11 ----------- 2 files changed, 22 deletions(-)
---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260921-sophgo-remove-coprocessor-node-4e6c59ab58d2
Best regards,
Signature · 1 line
Andrei Lalaev <[email protected]>
PATCH 1/2 riscv: dts: sophgo: cv1800b-milkv-duo: drop reserved memory node
The current FSBL can load firmware to any address and can also disable the coprocessor. Therefore, FSBL should modify the device tree at runtime. Remove the node accordingly.
--- arch/riscv/boot/dts/sophgo/cv1800b-milkv-duo.dts | 11 ----------- 1 file changed, 11 deletions(-)
arch/riscv/boot/dts/sophgo/cv1800b-milkv-duo.dts +0 -11
@@ -22,17 +22,6 @@ aliases { chosen { stdout-path = "serial0:115200n8"; }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - coprocessor_rtos: region@83f40000 { - reg = <0x83f40000 0xc0000>; - no-map; - }; - }; }; &osc {
Signature · 1 line
2.55.0
PATCH 2/2 riscv: dts: sophgo: sg2002-milkv-duo256m: drop reserved memory node
In reply to Andrei LalaevThe current FSBL can load firmware to any address and can also disable the coprocessor. Therefore, FSBL should modify the device tree at runtime. Remove the node accordingly.
--- arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts | 11 ----------- 1 file changed, 11 deletions(-)
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts +0 -11
@@ -36,17 +36,6 @@ led-0 { linux,default-trigger = "heartbeat"; }; }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - coprocessor_rtos: region@8fe00000 { - reg = <0x8fe00000 0x200000>; - no-map; - }; - }; }; &osc {
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 2/2] riscv: dts: sophgo: sg2002-milkv-duo256m: drop reserved memory node
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Critical] dts: ABI breakage by dropping coprocessor reserved-memory node --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] dts: ABI breakage by dropping coprocessor reserved-memory node --
commit fa1a6e529f0f63c13f25ecb8772efefbd481942e
Author: Andrei Lalaev <[email protected]>
riscv: dts: sophgo: sg2002-milkv-duo256m: drop reserved memory node
This commit drops the reserved-memory node for the coprocessor from the sg2002-milkv-duo256m device tree. The change is based on the premise that the current FSBL handles this dynamically at runtime.
Quoted 9 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts +0
-1@@ -36,17 +36,6 @@ led-0 { linux,default-trigger = "heartbeat"; }; }; -
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts led-0 { · line 49
Quoted 10 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts +0
-10- reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - coprocessor_rtos: region@8fe00000 { - reg = <0x8fe00000 0x200000>; - no-map; - }; - };
[Severity: Critical]
Does removing this static fallback node introduce a regression for systems using an older bootloader?
While newer FSBLs might dynamically inject or update the reserved-memory node, older FSBLs rely on this static reservation in the device tree. Without the no-map property for 0x8fe00000, will the kernel treat the 2MB coprocessor region as general-purpose RAM, since it falls within the standard memory space?
This could lead to memory corruption if Linux and the active coprocessor overwrite each other's memory when users upgrade their kernel and device tree without also upgrading their bootloader, breaking the standard backward compatibility contract.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260921-sophgo-remove-coprocessor-node-v1-0-ace29446b327@gmail.com?part=2
Quoted 8 lines · Andrei Lalaev
Milk-V Duo and Duo-256M reserve a region for coprocessor FW at the end of RAM. It is not correct because:
- FSBL can be configured to load FW into a different region
- if no firmware is loaded, the reserved memory is wastedAs explained in [1, 2], FSBL should reserve the region at runtime.
[...]
Applied to for-next, thanks!
[1/2] riscv: dts: sophgo: cv1800b-milkv-duo: drop reserved memory node
https://github.com/sophgo/linux/commit/6645398c46219e97fd153ae6188ae86c493d2d6a [2/2] riscv: dts: sophgo: sg2002-milkv-duo256m: drop reserved memory node https://github.com/sophgo/linux/commit/60e4cafd30908e7d8cdfdb4fa1a74dabed9f47b5
Thanks,
Inochi
This series was applied to riscv/linux.git (fixes) by Inochi Amaoto <[email protected]>:
Hello:
This series was applied to riscv/linux.git (fixes) by Inochi Amaoto <[email protected]>:
Quoted 8 lines · On Mon, 21 Sep 2026 17:08:58 +0200 you wrote:
Milk-V Duo and Duo-256M reserve a region for coprocessor FW at the end of RAM. It is not correct because:
- FSBL can be configured to load FW into a different region
- if no firmware is loaded, the reserved memory is wastedAs explained in [1, 2], FSBL should reserve the region at runtime.
[...]
Here is the summary with links:
- [1/2] riscv: dts: sophgo: cv1800b-milkv-duo: drop reserved memory node
https://git.kernel.org/riscv/c/6645398c4621 - [2/2] riscv: dts: sophgo: sg2002-milkv-duo256m: drop reserved memory node https://git.kernel.org/riscv/c/60e4cafd3090
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html