Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* SpacemiT k1: Linux crashes setting up smp with mainline U-Boot
@ 2025-12-11 20:34 Michael Opdenacker
  2025-12-12  1:50 ` Junhui Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Opdenacker @ 2025-12-11 20:34 UTC (permalink / raw)
  To: linux-riscv; +Cc: michael.opdenacker

Greetings,

I'm trying to boot mainline Linux with *mainline* U-Boot on SpacemiT K1 
(Banana Pi F3) and I'm very close!

Since mainline U-Boot supports Banana Pi F3 without mmc for the moment, 
I tweaked u-boot.itb to include the Linux kernel and k1-bananapi-f3.dtb 
binaries, so that they are loaded into RAM by U-Boot SPL 2022.10spacemit 
(sorry, this part with DRAM training is still vendor specific).

Here's what I get so far:

U-Boot 2026.01-rc4 (Dec 10 2025 - 15:28:43 +0000)

DRAM:  4 GiB
Core:  21 devices, 9 uclasses, devicetree: separate
MMC:
Loading Environment from EXT4... In:    serial@d4017000
Out:   serial@d4017000
Err:   serial@d4017000
Net:   No ethernet found.
=> setenv bootargs console=ttyS0,115200 earlycon=sbi
=> booti 0x2000000 - 0x5000000
Moving Image from 0x2000000 to 0x200000, end=0x1a7d000
## Flattened Device Tree blob at 05000000
    Booting using the fdt blob at 0x5000000
Working FDT set to 5000000
    Loading Device Tree to 000000007df41000, end 000000007df49dff ... OK
Working FDT set to 7df41000

Starting kernel ...

[    0.000000] Booting Linux on hartid 0
[    0.000000] Linux version 6.18.0-12930-gd358e5254674 (mike@a8) 
(Ubuntu clang version 18.1.3 (1ubuntu1), Ubuntu LLD 18.1.3) #24 SMP Thu 
Dec 11 20:26:18 CET 2025
[    0.000000] Machine model: Banana Pi BPI-F3
[    0.000000] SBI specification v3.0 detected
[    0.000000] SBI implementation ID=0x1 Version=0x10007
[    0.000000] SBI TIME extension detected
[    0.000000] SBI IPI extension detected
[    0.000000] SBI RFENCE extension detected
[    0.000000] SBI DBCN extension detected
[    0.000000] SBI FWFT extension detected
[    0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[    0.000000] printk: legacy bootconsole [sbi0] enabled
[    0.000000] efi: UEFI not found.
[    0.000000] OF: reserved mem: 0x0000000000000000..0x000000000003ffff 
(256 KiB) nomap non-reusable mmode_resv0@0
[    0.000000] OF: reserved mem: 0x0000000000040000..0x000000000007ffff 
(256 KiB) nomap non-reusable mmode_resv1@40000
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000000000000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000017fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000007ffff]
[    0.000000]   node   0: [mem 0x0000000000080000-0x000000007fffffff]
[    0.000000]   node   0: [mem 0x0000000100000000-0x000000017fffffff]
[    0.000000] Initmem setup node 0 [mem 
0x0000000000000000-0x000000017fffffff]
[    0.000000] SBI HSM extension detected
[    0.000000] riscv: base ISA extensions acdfimv
[    0.000000] riscv: ELF capabilities acdfimv
[    0.000000] Ticket spinlock: enabled
[    0.000000] percpu: Embedded 31 pages/cpu s86808 r8192 d31976 u126976
[    0.000000] Kernel command line: console=ttyS0,115200 earlycon=sbi
[    0.000000] printk: log buffer data + meta data: 131072 + 458752 = 
589824 bytes
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 
4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 
bytes, linear)
[    0.000000] software IO TLB: area num 8.
[    0.000000] software IO TLB: mapped [mem 
0x0000000079f41000-0x000000007df41000] (64MB)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 
1048576
[    0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=64 to 
nr_cpu_ids=8.
[    0.000000]     Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay 
is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=8
[    0.000000] RCU Tasks Trace: Setting shift to 3 and lim to 1 
rcu_task_cb_adjust=1 rcu_task_cpu_ids=8.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] riscv: providing IPIs using SBI IPI extension
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on 
contention.
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff 
max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000001] sched_clock: 64 bits at 24MHz, resolution 41ns, wraps 
every 4398046511097ns
[    0.008110] riscv-timer: Timer interrupt in S-mode is available via 
sstc extension
[    0.016005] Console: colour dummy device 80x25
[    0.020354] Calibrating delay loop (skipped), value calculated using 
timer frequency.. 48.00 BogoMIPS (lpj=96000)
[    0.030683] pid_max: default: 32768 minimum: 301
[    0.035614] Mount-cache hash table entries: 8192 (order: 4, 65536 
bytes, linear)
[    0.042860] Mountpoint-cache hash table entries: 8192 (order: 4, 
65536 bytes, linear)
[    0.052920] riscv: ELF compat mode unsupported
[    0.052947] ASID allocator using 16 bits (65536 entries)
[    0.060752] rcu: Hierarchical SRCU implementation.
[    0.065510] rcu:     Max phase no-delay instances is 1000.
[    0.070983] Timer migration: 1 hierarchy levels; 8 children per 
group; 1 crossnode level
[    0.079110] EFI services will not be available.
syys 0.083956] smp: Bringing upsysysys: sys: 0xss
1.  sys:t:: r  y00 xxs01fxdcfe121.0
210c.

   b0
m:3
j...


Here, the machine gets back to U-Boot SPL.

If I add "maxcpus=1", the kernel boots to completion (yoohoo!). This 
shows there's an issue with SMP setup.

With the same kernel and DTB, this doesn't happen with the SpacemiT 
version of U-Boot.

Any clue what could happen here? As anyone experience anything similar?

Note that I'm using the latest mainline kernel (pre 6.19-rc1) and 
mainlne U-Boot.

Note that this works exactly the same on Orange Pi RV2 (yoohoo!), so 
once this works, I'll sent a patch to mainline U-Boot to support Orange 
Pi RV2 too :D

Thanks in advance for your tips
Cheers
Michael.

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


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: SpacemiT k1: Linux crashes setting up smp with mainline U-Boot
  2025-12-11 20:34 SpacemiT k1: Linux crashes setting up smp with mainline U-Boot Michael Opdenacker
@ 2025-12-12  1:50 ` Junhui Liu
  2025-12-12  4:37   ` Michael Opdenacker
  0 siblings, 1 reply; 5+ messages in thread
From: Junhui Liu @ 2025-12-12  1:50 UTC (permalink / raw)
  To: Michael Opdenacker, linux-riscv

Hi Michael,

On 12/12/25 4:34 AM, Michael Opdenacker wrote:
[...]
> [   0.000000] SBI specification v3.0 detected
> [    0.000000] SBI implementation ID=0x1 Version=0x10007
> [    0.000000] SBI TIME extension detected
> [    0.000000] SBI IPI extension detected
> [    0.000000] SBI RFENCE extension detected
> [    0.000000] SBI DBCN extension detected
> [    0.000000] SBI FWFT extension detected
>
[...]
> syys 0.083956] smp: Bringing upsysysys: sys: 0xss
> 1.  sys:t:: r  y00 xxs01fxdcfe121.0
> 210c.
>
>   b0
> m:3
> j...

This might actually not a "crash". Instead, it seems the boot address for
CPUs 1-7 hasn't been set correctly, causing them to boot from the BootROM.

I believe this is not a U-Boot issue, but rather an OpenSBI one. According
to the log, it looks like you are using mainline OpenSBI. Could you please
confirm the OpenSBI you are using includes this fix:

126c9d34 ("platform: generic: spacemit: add missing objects.mk")

-- 
Best regards,
Junhui Liu


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: SpacemiT k1: Linux crashes setting up smp with mainline U-Boot
  2025-12-12  1:50 ` Junhui Liu
@ 2025-12-12  4:37   ` Michael Opdenacker
  2025-12-12  5:40     ` Junhui Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Opdenacker @ 2025-12-12  4:37 UTC (permalink / raw)
  To: Junhui Liu; +Cc: michael.opdenacker, linux-riscv

Hi Junhui

Thanks a lot for having a look at this issue!

On 12/12/25 02:50, Junhui Liu wrote:
> Hi Michael,
>
> On 12/12/25 4:34 AM, Michael Opdenacker wrote:
> [...]
>> [   0.000000] SBI specification v3.0 detected
>> [    0.000000] SBI implementation ID=0x1 Version=0x10007
>> [    0.000000] SBI TIME extension detected
>> [    0.000000] SBI IPI extension detected
>> [    0.000000] SBI RFENCE extension detected
>> [    0.000000] SBI DBCN extension detected
>> [    0.000000] SBI FWFT extension detected
>>
> [...]
>> syys 0.083956] smp: Bringing upsysysys: sys: 0xss
>> 1.  sys:t:: r  y00 xxs01fxdcfe121.0
>> 210c.
>>
>>   b0
>> m:3
>> j...
>
> This might actually not a "crash". Instead, it seems the boot address for
> CPUs 1-7 hasn't been set correctly, causing them to boot from the 
> BootROM.
>
> I believe this is not a U-Boot issue, but rather an OpenSBI one. 
> According
> to the log, it looks like you are using mainline OpenSBI. Could you 
> please
> confirm the OpenSBI you are using includes this fix:
>
> 126c9d34 ("platform: generic: spacemit: add missing objects.mk")

Yes, I made sure I'm building the latest commit on the "master" branch 
as of today (51fe6a8bc958166ff79805cf69bafe5e297776f4), and that it 
contains the fix you mentioned.
However, it doesn't fix my issue yet.

Here's the OpenSBI output, which unfortunately doesn't confirm the commit:

OpenSBI v1.7
    ____                    _____ ____ _____
   / __ \                  / ____|  _ \_   _|
  | |  | |_ __   ___ _ __ | (___ | |_) || |
  | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
  | |__| | |_) |  __/ | | |____) | |_) || |_
   \____/| .__/ \___|_| |_|_____/|____/_____|
         | |
         |_|

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         : ---
Platform PMU Device         : ---
Platform Reboot Device      : ---
Platform Shutdown Device    : ---
Platform Suspend Device     : ---
Platform CPPC Device        : ---
Firmware Base               : 0x0
Firmware Size               : 403 KB
Firmware RW Offset          : 0x40000
Firmware RW Size            : 147 KB
Firmware Heap Offset        : 0x54000
Firmware Heap Size          : 67 KB (total), 4 KB (reserved), 12 KB 
(used), 50 KB (free)
Firmware Scratch Size       : 4096 B (total), 1400 B (used), 2696 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            : 0x00000000d4017000-0x00000000d4017fff M: 
(I,R,W) S/U: (R,W)
Domain0 Region01            : 0x00000000e4000000-0x00000000e400ffff M: 
(I,R,W) S/U: ()
Domain0 Region02            : 0x0000000000000000-0x000000000003ffff M: 
(R,X) S/U: ()
Domain0 Region03            : 0x0000000000040000-0x000000000007ffff M: 
(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           : 0x0000000000289058
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

Anything else I can try?
Thanks again
Michael.

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


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: SpacemiT k1: Linux crashes setting up smp with mainline U-Boot
  2025-12-12  4:37   ` Michael Opdenacker
@ 2025-12-12  5:40     ` Junhui Liu
  2025-12-12  6:43       ` Michael Opdenacker
  0 siblings, 1 reply; 5+ messages in thread
From: Junhui Liu @ 2025-12-12  5:40 UTC (permalink / raw)
  To: Michael Opdenacker, Junhui Liu; +Cc: linux-riscv

Hi Michael,

On 12/12/25 12:37 PM, Michael Opdenacker wrote:
> Hi Junhui
>
> Thanks a lot for having a look at this issue!
>
> On 12/12/25 02:50, Junhui Liu wrote:
>> Hi Michael,
>>
>> On 12/12/25 4:34 AM, Michael Opdenacker wrote:
>> [...]
>>> [   0.000000] SBI specification v3.0 detected
>>> [    0.000000] SBI implementation ID=0x1 Version=0x10007
>>> [    0.000000] SBI TIME extension detected
>>> [    0.000000] SBI IPI extension detected
>>> [    0.000000] SBI RFENCE extension detected
>>> [    0.000000] SBI DBCN extension detected
>>> [    0.000000] SBI FWFT extension detected
>>>
>> [...]
>>> syys 0.083956] smp: Bringing upsysysys: sys: 0xss
>>> 1.  sys:t:: r  y00 xxs01fxdcfe121.0
>>> 210c.
>>>
>>>   b0
>>> m:3
>>> j...
>>
>> This might actually not a "crash". Instead, it seems the boot address 
>> for
>> CPUs 1-7 hasn't been set correctly, causing them to boot from the 
>> BootROM.
>>
>> I believe this is not a U-Boot issue, but rather an OpenSBI one. 
>> According
>> to the log, it looks like you are using mainline OpenSBI. Could you 
>> please
>> confirm the OpenSBI you are using includes this fix:
>>
>> 126c9d34 ("platform: generic: spacemit: add missing objects.mk")
>
> Yes, I made sure I'm building the latest commit on the "master" branch 
> as of today (51fe6a8bc958166ff79805cf69bafe5e297776f4), and that it 
> contains the fix you mentioned.
> However, it doesn't fix my issue yet.
>
> Here's the OpenSBI output, which unfortunately doesn't confirm the 
> commit:
>
> OpenSBI v1.7
>    ____                    _____ ____ _____
>   / __ \                  / ____|  _ \_   _|
>  | |  | |_ __   ___ _ __ | (___ | |_) || |
>  | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
>  | |__| | |_) |  __/ | | |____) | |_) || |_
>   \____/| .__/ \___|_| |_|_____/|____/_____|
>         | |
>         |_|
>
> 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         : ---
> Platform PMU Device         : ---
> Platform Reboot Device      : ---
> Platform Shutdown Device    : ---
> Platform Suspend Device     : ---
> Platform CPPC Device        : ---
> Firmware Base               : 0x0
> Firmware Size               : 403 KB
> Firmware RW Offset          : 0x40000
> Firmware RW Size            : 147 KB
> Firmware Heap Offset        : 0x54000
> Firmware Heap Size          : 67 KB (total), 4 KB (reserved), 12 KB 
> (used), 50 KB (free)
> Firmware Scratch Size       : 4096 B (total), 1400 B (used), 2696 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            : 0x00000000d4017000-0x00000000d4017fff M: 
> (I,R,W) S/U: (R,W)
> Domain0 Region01            : 0x00000000e4000000-0x00000000e400ffff M: 
> (I,R,W) S/U: ()
> Domain0 Region02            : 0x0000000000000000-0x000000000003ffff M: 
> (R,X) S/U: ()
> Domain0 Region03            : 0x0000000000040000-0x000000000007ffff M: 
> (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           : 0x0000000000289058
> 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
>
> Anything else I can try?

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).

-- 
Best regards,
Junhui Liu


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: SpacemiT k1: Linux crashes setting up smp with mainline U-Boot
  2025-12-12  5:40     ` Junhui Liu
@ 2025-12-12  6:43       ` Michael Opdenacker
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Opdenacker @ 2025-12-12  6:43 UTC (permalink / raw)
  To: Junhui Liu; +Cc: michael.opdenacker, linux-riscv

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/


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2025-12-12  6:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-11 20:34 SpacemiT k1: Linux crashes setting up smp with mainline U-Boot Michael Opdenacker
2025-12-12  1:50 ` Junhui Liu
2025-12-12  4:37   ` Michael Opdenacker
2025-12-12  5:40     ` Junhui Liu
2025-12-12  6:43       ` Michael Opdenacker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox