Boot from 64-bit memory address?

Bernard, Philip philip.bernard at intel.com
Fri Feb 24 22:08:40 CET 2023


Hi Rick,

Thanks for the feedback! I did make those changes to binman.dtsi. Ultimately, I think the issue is with the "ERROR: Out of memory" error which comes from the EFI loader (lib/efi_loader) because there's no conventional memory (i.e. something with a memory address below 4GB). The allocation error afterward (from boot/image_board.c::boot_ramdisk_high) is a knock-on effect since there's no location available to move initramfs to. 

As I've dug into this more today though, it seems like so many backend things for RISC-V in U-Boot are set up to only support 32-bit DRAM. I think there will be quite a lot of adjustments to be made to support the memory map I have.

Thanks,
Phil

-----Original Message-----
From: Rick Chen <rickchen36 at gmail.com> 
Sent: Thursday, February 23, 2023 10:33 PM
To: Bernard, Philip <philip.bernard at intel.com>
Cc: U-Boot Mailing List <u-boot at lists.denx.de>; Leo Liang <ycliang at andestech.com>; peterlin at andestech.com; rick <rick at andestech.com>
Subject: Re: Boot from 64-bit memory address?

Hi Philip,

> From: U-Boot <u-boot-bounces at lists.denx.de> On Behalf Of Bernard, 
> Philip
> Sent: Thursday, February 23, 2023 9:21 AM
> To: u-boot at lists.denx.de
> Subject: Boot from 64-bit memory address?
>
> Hi,
>
> Is it possible to boot from a DRAM memory address beyond the 32-bit 
> boundary? I'm trying to configure a new RISC-V board which has 2GB of 
> DRAM starting at offset 0x40_0000_0000. I started from the settings 
> for an existing RISC-V board and made

I think it is possible to boot from a DRAM memory beyond the 32-bit boundary. But maybe you need to modify some code to achieve that.
I have tried to boot an internal AE350-like platform whose DRAM base is at 0x400000000.

adjustments for my HW, but when I try to boot, I run into an "out of memory" error.
>
> From https://u-boot.readthedocs.io/en/latest/develop/uefi/u-boot_on_efi.html#tables I noticed that U-Boot will only use "conventional" memory which is 4GB and below, so it seems like this may not be possible? Looking through the repo, I also noticed that nearly every device is configuring settings like CONFIG_SYS_LOAD_ADDR with a 32-bit value, so I haven't found any examples to emulate for my use case.

CONFIG_SYS_LOAD_ADDR is not important. Maybe you shall notice CONFIG_SYS_TEXT_BASE and CONFIG_SPL_OPENSBI_LOAD_ADDR which will be parsed from binman.dtsi You can change them like this:
load = /bits/64 <CONFIG_SYS_TEXT_BASE>;
load = /bits/64 <CONFIG_SPL_OPENSBI_LOAD_ADDR>;

>
> I'm hoping someone knows the mistake I'm making or can confirm that this isn't possible. Appreciate the help.
>
> Best,
> Phil
>
>
> Below is the output from U-Boot:
>
> U-Boot SPL 2022.07 (Feb 23 2023 - 00:50:44 +0000) Trying to boot from 
> RAM
>
> OpenSBI v1.1
>    ____                    _____ ____ _____
>   / __ \                  / ____|  _ \_   _|
> | |  | |_ __   ___ _ __ | (___ | |_) || |
> | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | | __| | |_) |  __/ | | |____) 
> | | |
> | ||_) || |_
>   \____/| .__/ \___|_| |_|_____/|____/_____|
>         | |
>         |_|
>
> Platform Name             : test,test
> Platform Features         : medeleg
> Platform HART Count       : 1
> Platform IPI Device       : aclint-mswi
> Platform Timer Device     : aclint-mtimer @ 1000000Hz
> Platform Console Device   : uart8250
> Platform HSM Device       : ---
> Platform Reboot Device    : ---
> Platform Shutdown Device  : ---
> Firmware Base             : 0x80000000
> Firmware Size             : 276 KB
> Runtime SBI Version       : 1.0
>
> Domain0 Name              : root
> Domain0 Boot HART         : 0
> Domain0 HARTs             : 0*
> Domain0 Region00          : 0x0000000002000000-0x000000000200ffff (I)
> Domain0 Region01          : 0x0000000080000000-0x000000008007ffff ()
> Domain0 Region02          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
> Domain0 Next Address      : 0x0000004001200000
> Domain0 Next Arg1         : 0x0000004001267830
> Domain0 Next Mode         : S-mode
> Domain0 SysReset          : yes
>
> Boot HART ID              : 0
> Boot HART Domain          : root
> Boot HART Priv Version    : v1.10
> Boot HART Base ISA        : rv64imafdcb
> Boot HART ISA Extensions  : time
> Boot HART PMP Count       : 8
> Boot HART PMP Granularity : 4
> Boot HART PMP Address Bits: 54
> Boot HART MHPM Count      : 0
> Boot HART MIDELEG         : 0x0000000000000222
> Boot HART MEDELEG         : 0x000000000000b109
>
>
> U-Boot 2022.07 (Feb 23 2023 - 00:50:44 +0000)
>
> CPU:   rv64imafdc
> Model: test,test
> DRAM:  2 GiB
> Core:  11 devices, 8 uclasses, devicetree: separate
> ERROR: Out of memory
> Loading Environment from nowhere... OK
> In:    serial at 131400000
> Out:   serial at 131400000
> Err:   serial at 131400000
> Model: test,test
> Net:   No ethernet found.
> Hit any key to stop autoboot:  0
> Moving Image from 0x4006000000 to 0x4000200000, end=4000b01c8c ## Flattened Device Tree blob at ff76a1d0
>    Booting using the fdt blob at 0xff76a1d0
> ERROR: Failed to allocate 0x1000000 bytes below 0x100000000.

Can you dig in where to print this ERROR ?

Thanks,
Rick

> ramdisk - allocation error


More information about the U-Boot mailing list