Bug ID 1208173
Summary Can't boot devel:RISCV:Factory:Contrib:StarFive:VisionFive2/JeOS-starfivevisionfive2, "sbi_trap_error: hart0: trap handler failed (error -2)"
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware RISC-V
OS openSUSE Tumbleweed
Status NEW
Severity Minor
Priority P5 - None
Component Bootloader
Assignee screening-team-bugs@suse.de
Reporter aaronpuchert@alice-dsl.net
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

This is not technically Tumbleweed, so I open with lower severity.

This is on a VisionFive 2 V1.3B, with u-boot-spl.bin.normal.out and
visionfive2_fw_payload.img from [1], and JeOS-starfivevisionfive2 on an SD
card. The initial boot produces the error mentioned in the Wiki [2]:

Loading Linux 6.2.0-rc7-12-default ...
Loading initial ramdisk ...
EFI stub: Booting Linux Kernel...
Unhandled exception: Store/AMO access fault
EPC: 00000000fff47a98 RA: 00000000fff8684a TVAL: 0000000040000000
EPC: 0000000040201a98 RA: 000000004024084a reloc adjusted

[...]
UEFI image [0x00000000fe460000:0x00000000fe716fff] '/efi\boot\bootriscv64.efi'
UEFI image [0x00000000cb23a000:0x00000000ccf42fff]

Ok, let's mark that region as reserved as the Wiki says:

StarFive # fdt addr ${fdtcontroladdr}; fdt rsvmem add 0x40000000 0x00001000
StarFive # boot
## Warning: defaulting to text format
## Error: "boot2" not defined
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Card did not respond to voltage select! : -110
** Unable to read file ubootefi.var **
Failed to load EFI variables
Found EFI removable media binary efi/boot/bootriscv64.efi
2846720 bytes read in 122 ms (22.3 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Welcome to GRUB!
[...]
Loading Linux 6.2.0-rc7-12-default ...
Loading initial ramdisk ...
EFI stub: Booting Linux Kernel...
EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services...
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
sbi_trap_error: hart0: trap handler failed (error -2)
sbi_trap_error: hart0: mcause=0x0000000000000005 mtval=0x0000000040047060
sbi_trap_error: hart0: mepc=0x0000000040004cac mstatus=0x0000000200001800
sbi_trap_error: hart0: ra=0x0000000040009ee2 sp=0x0000000040046f10
sbi_trap_error: hart0: gp=0x0000000000000000 tp=0x0000000040047000
sbi_trap_error: hart0: s0=0x0000000040046f20 s1=0x0000000040047000
sbi_trap_error: hart0: a0=0x0000000040047060 a1=0x0000000000000002
sbi_trap_error: hart0: a2=0x0000000000000000 a3=0x0000000000000019
sbi_trap_error: hart0: a4=0x0000000000000001 a5=0x0000000040047060
sbi_trap_error: hart0: a6=0x00000000400470a8 a7=0x0000000000000004
sbi_trap_error: hart0: s2=0x00000000400241a8 s3=0x0000000000000000
sbi_trap_error: hart0: s4=0x0000000000000000 s5=0x0000000040028000
sbi_trap_error: hart0: s6=0x0000000040028020 s7=0x0000000000000000
sbi_trap_error: hart0: s8=0x000000000000001c s9=0x0000000040034ab0
sbi_trap_error: hart0: s10=0x0000000000000000 s11=0x0000000000000000
sbi_trap_error: hart0: t0=0x0000000000000000 t1=0x0000000000000000
sbi_trap_error: hart0: t2=0x0000000000000000 t3=0x0000000000002000
sbi_trap_error: hart0: t4=0x0000000000000000 t5=0x0000000000000000
sbi_trap_error: hart0: t6=0x0000000000000000

and then it hangs. Now OpenSBI tells me this:

Domain0 Region00          : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01          : 0x0000000040000000-0x000000004007ffff ()
Domain0 Region02          : 0x0000000000000000-0xffffffffffffffff (R,W,X)

so maybe the region wasn't big enough? But a size of 0x80000 doesn't do it
either, and the error is a different one.

Booting the SDK kernel (e.g. image.fit from [1]) with the instructions given in
the repository README (i.e. via tftpboot) works fine.

Out of curiosity, I tried to switch roles: put the SDK kernel on the SD card,
and tried tftpboot with the openSUSE kernel. The SDK kernel on the SD card
produces pretty much the same sbi_trap_error, whereas the openSUSE kernel via
tftp can at least start itself and some services. It's then missing things,
because it expects a disk around, but that's expected:

StarFive # setenv bootfile vmlinuz; setenv fileaddr a0000000; setenv
fdtcontroladdr 0xffffffffffffffff
StarFive # setenv kernel_comp_addr_r 0xb0000000; setenv kernel_comp_size
0x10000000;
StarFive # tftpboot ${fdt_addr_r} jh7110-starfive-visionfive-2-vb.dtb
[...]
StarFive # tftpboot ${kernel_addr_r} Image-6.2.0-rc7-12-default
[...]
StarFive # tftpboot ${ramdisk_addr_r} initrd-6.2.0-rc7-12-default
[...]
StarFive # run chipa_set_linux
StarFive # booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
## Flattened Device Tree blob at 46000000
   Booting using the fdt blob at 0x46000000
   Using Device Tree in place at 0000000046000000, end 0000000046008140

Starting kernel ...

[    0.000000][    T0] Linux version 6.2.0-rc7-12-default (geeko@buildhost)
(gcc (SUSE Linux) 12.2.1 20230124 [revision
193f7e62815b4089dfaed4c2bd34fd4f10209e27], GNU ld (GNU Binutils; openS)
[    0.000000][    T0] OF: fdt: Ignoring memory range 0x40000000 - 0x40200000
[    0.000000][    T0] Machine model: StarFive VisionFive 2 VB
[...]
[    0.000000][    T0] CPU with hartid=0 is not available
[    0.000000][    T0] CPU with hartid=0 is not available
[    0.000000][    T0] CPU with hartid=0 is not available
[...]
[   19.230279][  T711] dracut: FATAL: No root device found
[   19.235549][  T711] dracut: Refusing to continue

But that's expected. So I don't think there is anything wrong with the kernel.
It seems to be an issue either with the firmware or with the bootloader. For
what it's worth, I see that devel:RISCV:Factory:Contrib:StarFive:VisionFive2
has some kind of u-boot, but I can't find a pendant for
visionfive2_fw_payload.img.

Likely I'm just doing something wrong though and maybe the documentation could
be improved a bit.

[1] https://github.com/starfive-tech/VisionFive2/releases/tag/VF2_v2.8.0
[2] https://en.opensuse.org/HCL:VisionFive2


You are receiving this mail because: