Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Junhui Liu <junhui.liu@pigmoral.tech>
To: Michael Opdenacker <michael.opdenacker@rootcommit.com>,
	Junhui Liu <junhui.liu@pigmoral.tech>
Cc: linux-riscv <linux-riscv@lists.infradead.org>
Subject: Re: SpacemiT k1: Linux crashes setting up smp with mainline U-Boot
Date: Fri, 12 Dec 2025 13:40:22 +0800	[thread overview]
Message-ID: <fb38c759-b7e0-4cff-91f6-7ad3e4313f55@pigmoral.tech> (raw)
In-Reply-To: <5965fad0-ab24-4db4-9ee4-647fe503a8ff@rootcommit.com>

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

  reply	other threads:[~2025-12-12  5:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-12-12  6:43       ` Michael Opdenacker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb38c759-b7e0-4cff-91f6-7ad3e4313f55@pigmoral.tech \
    --to=junhui.liu@pigmoral.tech \
    --cc=linux-riscv@lists.infradead.org \
    --cc=michael.opdenacker@rootcommit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox