memory hole close to 4GB on qemu risc-v

Wu, Fei fei2.wu at intel.com
Mon Aug 7 09:50:48 CEST 2023


Hi All,

I am working on enabling PCIe passthrough on qemu risc-v, in order for
the guest to access the host x86 pci resource directly, ram on guest
won't cover this range, so if guest has 4GB ram, two ranges are created:
  1. 2G-3G
  2. 4G-7G

u-boot is not able to handle this but reports:

Reserving 869k for U-Boot at: ff725000
initcall: 0000000080216f94
Reserving 8320k for malloc() at: fef05000
initcall: 0000000080216ee8
Unhandled exception: Store/AMO access fault

EP: 0000000080201a38 RA: 0000000080216f10 TVAL: 00000000fef04f90

It looks like fdtdec_setup_mem_size_base() in u-boot sets ram_base/size
without considering all memory nodes, and board_get_usable_ram_top()
returns 4G-1 that causes gd->relocaddr set to the wrong address which
has no ram backed. More details can be found here:
  https://patchew.org/QEMU/20230731015317.1026996-1-fei2.wu@intel.com/


Can we add support for this multi-range ram setting? Any comments?

Thanks,
Fei.


More information about the U-Boot mailing list