risc-v - efi_free_pool: illegal free

Hi All,
I am trying to create a RISC-V Archlinux image for the StarFive VisionFive 2 v1.3B SBC. Everything worked well initially, and I successfully until I upgraded OpenSBI and U-Boot to the latest versions.
I followed the instructions in the U-Boot documentation:
# u-boot/doc/board/starfive/visionfive2.rst
I used the following commands to update the latest image to SPI flash:
sf probe fatload mmc 1:3 $kernel_addr_r u-boot.itb sf update $kernel_addr_r 0x100000 $filesize
fatload mmc 1:3 $kernel_addr_r u-boot-spl.bin.normal.out sf update $kernel_addr_r 0x0 $filesize
However, when booting from SPI flash, it fails and attempts to boot the kernel image from SD card.
Please let me know if you have any way to help resolve this issue.
Here is the log for successful booting.
[1] https://pastebin.com/SnNrpr3H
Thanks -Anand
--- U-Boot SPL 2024.10-00741-g080bb8480a4e (Oct 09 2024 - 04:41:14 +0530) DDR version: dc2e84f0. Trying to boot from SPI
OpenSBI v1.5-82-g2ffa0a1 Build time: 2024-10-09 04:40:49 +0530 Build compiler: gcc version 14.2.0 (GCC) ____ _____ ____ _____ / __ \ / ____| _ _ _| | | | |_ __ ___ _ __ | (___ | |_) || | | | | | '_ \ / _ \ '_ \ ___ | _ < | | | |__| | |_) | __/ | | |____) | |_) || |_ ____/| .__/ ___|_| |_|_____/|____/_____| | | |_|
Platform Name : StarFive VisionFive 2 v1.3B Platform Features : medeleg Platform HART Count : 5 Platform IPI Device : aclint-mswi Platform Timer Device : aclint-mtimer @ 4000000Hz Platform Console Device : uart8250 Platform HSM Device : --- Platform PMU Device : --- Platform Reboot Device : pm-reset Platform Shutdown Device : pm-reset Platform Suspend Device : --- Platform CPPC Device : --- Firmware Base : 0x40000000 Firmware Size : 367 KB Firmware RW Offset : 0x40000 Firmware RW Size : 111 KB Firmware Heap Offset : 0x51000 Firmware Heap Size : 43 KB (total), 2 KB (reserved), 11 KB (used), 29 KB (free) Firmware Scratch Size : 4096 B (total), 424 B (used), 3672 B (free) Runtime SBI Version : 2.0
Domain0 Name : root Domain0 Boot HART : 4 Domain0 HARTs : 0*,1*,2*,3*,4* Domain0 Region00 : 0x0000000010000000-0x0000000010000fff M: (I,R,W) S/U: (R,W) Domain0 Region01 : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: () Domain0 Region02 : 0x0000000040040000-0x000000004005ffff M: (R,W) S/U: () Domain0 Region03 : 0x0000000040000000-0x000000004003ffff M: (R,X) S/U: () Domain0 Region04 : 0x000000000c000000-0x000000000fffffff M: (I,R,W) S/U: (R,W) Domain0 Region05 : 0x0000000000000000-0xffffffffffffffff M: () S/U: (R,W,X) Domain0 Next Address : 0x0000000040200000 Domain0 Next Arg1 : 0x0000000040400000 Domain0 Next Mode : S-mode Domain0 SysReset : yes Domain0 SysSuspend : yes
Boot HART ID : 4 Boot HART Domain : root Boot HART Priv Version : v1.11 Boot HART Base ISA : rv64imafdcbx Boot HART ISA Extensions : zihpm,sdtrig Boot HART PMP Count : 8 Boot HART PMP Granularity : 12 bits Boot HART PMP Address Bits: 34 Boot HART MHPM Info : 2 (0x00000018) Boot HART Debug Triggers : 8 triggers Boot HART MIDELEG : 0x0000000000000222 Boot HART MEDELEG : 0x000000000000b109
U-Boot 2024.10-00741-g080bb8480a4e (Oct 09 2024 - 04:41:14 +0530)
CPU: sifive,u74-mc Model: StarFive VisionFive 2 v1.3B DRAM: 8 GiB Core: 136 devices, 26 uclasses, devicetree: board WDT: Not starting watchdog@13070000 MMC: mmc@16010000: 0, mmc@16020000: 1 Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB *** Warning - bad CRC, using default environment
StarFive EEPROM format v2
--------EEPROM INFO-------- Vendor : StarFive Technology Co., Ltd. Product full SN: VF7110B1-2253-D008E000-00002905 data version: 0x2 PCB revision: 0xb2 BOM revision: A Ethernet MAC0 address: 6c:cf:39:00:38:7b Ethernet MAC1 address: 6c:cf:39:00:38:7c --------EEPROM INFO--------
starfive_7110_pcie pcie@2b000000: Starfive PCIe bus probed. starfive_7110_pcie pcie@2c000000: Starfive PCIe bus probed. In: serial@10000000 Out: serial@10000000 Err: serial@10000000 Net: eth0: ethernet@16030000, eth1: ethernet@16040000 starting USB... Bus xhci_pci: Register 5000420 NbrPorts 5 Starting the controller USB XHCI 1.00 scanning bus xhci_pci for devices... 2 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Working FDT set to ff72da20 Hit any key to stop autoboot: 0 Card did not respond to voltage select! : -110 ** Booting bootflow '<NULL>' with efi_mgr Loading Boot0000 'mmc 1' failed Loading Boot0001 'nvme 0' failed EFI boot manager: Cannot load any image Boot failed (err=-14) Card did not respond to voltage select! : -110 ** Booting bootflow 'mmc@16020000.bootdev.part_3' with extlinux 1: Arch Linux Risc-V Retrieving file: /Image Retrieving file: /initramfs-linux.img append: root=UUID=2b8de04b-ccd2-44f0-9406-5571a51fba02 rw console=tty1 console=ttyS0,115200 earlycon rootwait swiotlb=65536 nvme_core.default_ps_max_latency_us=2000 Retrieving file: /dtbs/starfive/jh7110-starfive-visionfive-2-v1.3b.dtb ## Flattened Device Tree blob at 46000000 Booting using the fdt blob at 0x46000000 Working FDT set to 46000000 Loading Ramdisk to fdd8e000, end fe728d27 ... OK Loading Device Tree to 00000000fdd81000, end 00000000fdd8d480 ... OK Working FDT set to fdd81000
Starting kernel ...
efi_free_pool: illegal free 0x00000000fe725040 efi_free_pool: illegal free 0x00000000fe722040 efi_free_pool: illegal free 0x00000000fe720040 efi_free_pool: illegal free 0x00000000fe71e040 efi_free_pool: illegal free 0x00000000fe71c040 Unhandled exception: Load access fault EPC: 00000000fffad720 RA: 00000000fff99092 TVAL: 0000007501137dc0 EPC: 0000000040267720 RA: 0000000040253092 reloc adjusted
SP: 00000000ff72c5e0 GP: 00000000ff735e40 TP: 0000000000000004 T0: 00000000ff72c690 T1: 00000000fff4739e T2: 72326973635f6d6f S0: 00000000fe6fb040 S1: 00000000fff47060 A0: 00000000fffb50c8 A1: 00000000fffb50c8 A2: 0000000000000010 A3: f253f47501137dc0 A4: 0000000000000000 A5: f253f47501137dc0 A6: e194eddf6491caa3 A7: 0000000000000000 S2: 00000000fffd9cb8 S3: 0000000000000001 S4: 0000000000000000 S5: 0000000000000001 S6: 00000000fffd9cb8 S7: 0000000000000007 S8: 00000000ff7852c0 S9: 00000000fe729000 S10: 0000000000000001 S11: 0000000040000000 T3: 00000000fdd8afff T4: ffffffffffffffe0 T5: 0000000000ff0000 T6: 00000000ff785310
Code: 1463 00e6 4501 8082 87b3 00e6 8533 00e5 (c783 0007)
resetting ... pmic_ops: cannot read pmic power register

On Wed, Oct 16, 2024 at 12:00:01AM +0530, Anand Moon wrote:
Hi All,
I am trying to create a RISC-V Archlinux image for the StarFive VisionFive 2 v1.3B SBC. Everything worked well initially, and I successfully until I upgraded OpenSBI and U-Boot to the latest versions.
Sorry for the problems, this is known and will be fixed shortly.

Hi Tom.
On Wed, 16 Oct 2024 at 00:01, Tom Rini trini@konsulko.com wrote:
On Wed, Oct 16, 2024 at 12:00:01AM +0530, Anand Moon wrote:
Hi All,
I am trying to create a RISC-V Archlinux image for the StarFive VisionFive 2 v1.3B SBC. Everything worked well initially, and I successfully until I upgraded OpenSBI and U-Boot to the latest versions.
Sorry for the problems, this is known and will be fixed shortly.
Just wanted to submit a report.
-- Tom
I have tried to build a u-boot with tag v2024.10, it's a success.
Thanks -Anand

On Wed, 16 Oct 2024 at 10:35, Anand Moon linux.amoon@gmail.com wrote:
Hi Tom.
On Wed, 16 Oct 2024 at 00:01, Tom Rini trini@konsulko.com wrote:
On Wed, Oct 16, 2024 at 12:00:01AM +0530, Anand Moon wrote:
Hi All,
I am trying to create a RISC-V Archlinux image for the StarFive VisionFive 2 v1.3B SBC. Everything worked well initially, and I successfully until I upgraded OpenSBI and U-Boot to the latest versions.
Sorry for the problems, this is known and will be fixed shortly.
Just wanted to submit a report.
-- Tom
I have tried to build a u-boot with tag v2024.10, it's a success.
Can you rebase and try with the latest -master. It should work now. Thanks.
-sughosh
Thanks -Anand

Hi Sughosh
On Wed, 16 Oct 2024 at 13:04, Sughosh Ganu sughosh.ganu@linaro.org wrote:
On Wed, 16 Oct 2024 at 10:35, Anand Moon linux.amoon@gmail.com wrote:
Hi Tom.
On Wed, 16 Oct 2024 at 00:01, Tom Rini trini@konsulko.com wrote:
On Wed, Oct 16, 2024 at 12:00:01AM +0530, Anand Moon wrote:
Hi All,
I am trying to create a RISC-V Archlinux image for the StarFive VisionFive 2 v1.3B SBC. Everything worked well initially, and I successfully until I upgraded OpenSBI and U-Boot to the latest versions.
Sorry for the problems, this is known and will be fixed shortly.
Just wanted to submit a report.
-- Tom
I have tried to build a u-boot with tag v2024.10, it's a success.
Can you rebase and try with the latest -master. It should work now. Thanks.
-sughosh
I do not observe this issue in the latest U-boot, Thanks for fixing the problem.
Thanks -Anand
------------------- Hit any key to stop autoboot: 0 StarFive # sf probe SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB StarFive # fatload mmc 1:3 $kernel_addr_r u-boot.itb 1022723 bytes read in 66 ms (14.8 MiB/s) StarFive # sf update $kernel_addr_r 0x100000 $filesize device 0 offset 0x100000, size 0xf9b03 969475 bytes written, 53248 bytes skipped in 7.529s, speed 139024 B/s StarFive # fatload mmc 1:3 $kernel_addr_r u-boot-spl.bin.normal.out 142770 bytes read in 13 ms (10.5 MiB/s) StarFive # sf update $kernel_addr_r 0x0 $filesize device 0 offset 0x0, size 0x22db2 142770 bytes written, 0 bytes skipped in 0.744s, speed 195449 B/s StarFive # reset resetting ... ▒ U-Boot SPL 2024.10-01138-gfa0ed06a749c (Oct 21 2024 - 15:41:04 +0530) DDR version: dc2e84f0. Trying to boot from SPI
U-Boot 2024.10-01138-gfa0ed06a749c (Oct 21 2024 - 15:41:04 +0530)
CPU: sifive,u74-mc Model: StarFive VisionFive 2 v1.3B DRAM: 8 GiB Core: 136 devices, 26 uclasses, devicetree: board WDT: Not starting watchdog@13070000 MMC: mmc@16010000: 0, mmc@16020000: 1 Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB *** Warning - bad CRC, using default environment
StarFive EEPROM format v2
--------EEPROM INFO-------- Vendor : StarFive Technology Co., Ltd. Product full SN: VF7110B1-2253-D008E000-00002905 data version: 0x2 PCB revision: 0xb2 BOM revision: A Ethernet MAC0 address: 6c:cf:39:00:38:7b Ethernet MAC1 address: 6c:cf:39:00:38:7c --------EEPROM INFO--------
starfive_7110_pcie pcie@2b000000: Starfive PCIe bus probed. starfive_7110_pcie pcie@2c000000: Starfive PCIe bus probed. In: serial@10000000 Out: serial@10000000 Err: serial@10000000 Net: eth0: ethernet@16030000, eth1: ethernet@16040000 starting USB... Bus xhci_pci: Register 5000420 NbrPorts 5 Starting the controller USB XHCI 1.00 scanning bus xhci_pci for devices... 2 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Working FDT set to ff72da20 Hit any key to stop autoboot: 0 Card did not respond to voltage select! : -110 ** Booting bootflow '<NULL>' with efi_mgr Loading Boot0000 'mmc 1' failed Loading Boot0001 'nvme 0' failed EFI boot manager: Cannot load any image Boot failed (err=-14) Card did not respond to voltage select! : -110 ** Booting bootflow 'mmc@16020000.bootdev.part_3' with extlinux 1: Arch Linux Risc-V Retrieving file: /Image Retrieving file: /initramfs-linux.img append: root=UUID=ec7facf2-7c69-4ff6-96ae-49f63c054fe0 rw console=tty1 console=ttyS0,115200 earlycon rootwait swiotlb=65536 nvme_core.default_ps_max_latency_us=2000 Retrieving file: /dtbs/starfive/jh7110-starfive-visionfive-2-v1.3b.dtb ## Flattened Device Tree blob at 46000000 Booting using the fdt blob at 0x46000000 Working FDT set to 46000000 Loading Ramdisk to fdd20000, end fe7295bf ... OK Loading Device Tree to 00000000fdd13000, end 00000000fdd1f480 ... OK Working FDT set to fdd13000
Starting kernel ...
[ 0.000000][ T0] Linux version 6.12.0-rc4-4-ARCH-RISC-V (amoon@anand-m920q) (riscv64-linux-gnu-gcc (GCC) 14.2.0, GNU ld (GNU Binutils) 2.43.1) #2 SMP PREEMPT_RT Mon Oct 21 16:19:57 IST 2024 [ 0.000000][ T0] Machine model: StarFive VisionFive 2 v1.3B [ 0.000000][ T0] SBI specification v2.0 detected [ 0.000000][ T0] SBI implementation ID=0x1 Version=0x10005 [ 0.000000][ T0] SBI TIME extension detected [ 0.000000][ T0] SBI IPI extension detected [ 0.000000][ T0] SBI RFENCE extension detected [ 0.000000][ T0] SBI SRST extension detected [ 0.000000][ T0] SBI DBCN extension detected [ 0.000000][ T0] efi: UEFI not found. [ 0.000000][ T0] OF: reserved mem: 0x0000000040000000..0x000000004003ffff (256 KiB) nomap non-reusable mmode_resv1@40000000 [ 0.000000][ T0] OF: reserved mem: 0x0000000040040000..0x000000004005ffff (128 KiB) nomap non-reusable mmode_resv0@40040000 [ 0.000000][ T0] cma: Reserved 16 MiB at 0x00000000ff000000 on node -1 [ 0.000000][ T0] earlycon: uart0 at MMIO32 0x0000000010000000 (options '115200n8') [ 0.000000][ T0] printk: legacy bootconsole [uart0] enabled [ 0.000000][ T0] NUMA: Faking a node at [mem 0x0000000040000000-0x000000023fffffff] [ 0.000000][ T0] NODE_DATA(0) allocated [mem 0x23fdbf500-0x23fdc1e7f] [ 0.000000][ T0] Zone ranges: [ 0.000000][ T0] DMA32 [mem 0x0000000040000000-0x00000000ffffffff] [ 0.000000][ T0] Normal [mem 0x0000000100000000-0x000000023fffffff] [ 0.000000][ T0] Device empty [ 0.000000][ T0] Movable zone start for each node [ 0.000000][ T0] Early memory node ranges
participants (3)
-
Anand Moon
-
Sughosh Ganu
-
Tom Rini