SpacemiT k1: Linux crashes setting up smp with mainline U-Boot

Michael Opdenacker michael.opdenacker at rootcommit.com
Thu Dec 11 22:43:40 PST 2025


Hi Junhui

On 12/12/25 06:40, Junhui Liu wrote:
> OpenSBI v1.7-89-g51fe6a8b
>    ____                    _____ ____ _____
>   / __ \                  / ____|  _ \_   _|
>  | |  | |_ __   ___ _ __ | (___ | |_) || |
>  | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
>  | |__| | |_) |  __/ | | |____) | |_) || |_
>   \____/| .__/ \___|_| |_|_____/|____/_____|
>         | |
>         |_|
>
> Platform Name               : Banana Pi BPI-F3
> Platform Features           : medeleg
> Platform HART Count         : 8
> Platform IPI Device         : aclint-mswi
> Platform Timer Device       : aclint-mtimer @ 24000000Hz
> Platform Console Device     : uart8250
> Platform HSM Device         : spacemit-hsm
> Platform PMU Device         : ---
> Platform Reboot Device      : ---
> Platform Shutdown Device    : ---
> Platform Suspend Device     : ---
> Platform CPPC Device        : ---
> Firmware Base               : 0x0
> Firmware Size               : 407 KB
> Firmware RW Offset          : 0x40000
> Firmware RW Size            : 151 KB
> Firmware Heap Offset        : 0x55000
> Firmware Heap Size          : 67 KB (total), 1 KB (reserved), 13 KB 
> (used), 52 KB (free)
> Firmware Scratch Size       : 4096 B (total), 1464 B (used), 2632 B 
> (free)
> Runtime SBI Version         : 3.0
> Standard SBI Extensions     : 
> time,rfnc,ipi,base,hsm,pmu,dbcn,fwft,legacy,dbtr,sse
> Experimental SBI Extensions : none
>
> Domain0 Name                : root
> Domain0 Boot HART           : 0
> Domain0 HARTs               : 0*,1*,2*,3*,4*,5*,6*,7*
> Domain0 Region00            : 0x0000000000000000-0x000000000003ffff M: 
> (F,R,X) S/U: ()
> Domain0 Region01            : 0x0000000000040000-0x000000000007ffff M: 
> (F,R,W) S/U: ()
> Domain0 Region02            : 0x00000000d4017000-0x00000000d4017fff M: 
> (I,R,W) S/U: (R,W)
> Domain0 Region03            : 0x00000000e4000000-0x00000000e400ffff M: 
> (I,R,W) S/U: ()
> Domain0 Region04            : 0x00000000e0000000-0x00000000e3ffffff M: 
> (I,R,W) S/U: (R,W)
> Domain0 Region05            : 0x0000000000000000-0xffffffffffffffff M: 
> () S/U: (R,W,X)
> Domain0 Next Address        : 0x0000000000200000
> Domain0 Next Arg1           : 0x00000000002610b8
> Domain0 Next Mode           : S-mode
> Domain0 SysReset            : yes
> Domain0 SysSuspend          : yes
>
> Boot HART ID                : 0
> Boot HART Domain            : root
> Boot HART Priv Version      : v1.12
> Boot HART Base ISA          : rv64imafdcbvx
> Boot HART ISA Extensions    : 
> sscofpmf,sstc,zicntr,zihpm,zicboz,zicbom,svpbmt,sdtrig
> Boot HART PMP Count         : 32
> Boot HART PMP Granularity   : 12 bits
> Boot HART PMP Address Bits  : 38
> Boot HART MHPM Info         : 16 (0x0007fff8)
> Boot HART Debug Triggers    : 8 triggers
> Boot HART MIDELEG           : 0x0000000000002222
> Boot HART MEDELEG           : 0x000000000000b109
>
>
> The log above is from my OpenSBI boot. Although I haven't had the time to
> test booting the mainline kernel with mainline U-Boot yet, I noticed some
> differences:
>
> 1. the version printed in my log is "OpenSBI v1.7-89-g51fe6a8b" (which
>    corresponds to the latest commit 
> 51fe6a8bc958166ff79805cf69bafe5e297776f4),
>    whereas your output shows only "OpenSBI v1.7".
> 2. your boot log does not seem to list the HSM device:
>    Platform HSM Device         : spacemit-hsm
>
> I personally suggest checking these two points:
>
> 1. After updating the OpenSBI repository, run "rm -r build" to clear
>    previous build cache before recompiling. This ensures that all the
>    necessary files are effectively included in the build.
> 2. Check if the compatible in U-Boot's device tree (which should
>    be used by OpenSBI) matches the one in the OpenSBI code 
> (specifically in
>    platform/generic/spacemit/k1.c and lib/utils/hsm/fdt_hsm_spacemit.c).


Thanks a lot for your help!
It turned out I copied the old image, not the new one. My apologies!

Now indeed, the bug is gone and I can boot mainline Linux on mainline 
U-Boot and mainline OpenSBI.
I will publish Yocto recipes (meta-riscv layer) in the next days to 
allow everyone to build such images.

This will help with supporting other K1-based platforms too.
Thanks a lot for your contributions,  guidance and patience.
Cheers
Michael.


-- 
Michael Opdenacker
Root Commit
Yocto Project and OpenEmbedded Training course - Learn by doing:
https://rootcommit.com/training/yocto/




More information about the linux-riscv mailing list