QEMU NUMA and U-Boot

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Jul 6 20:10:08 CEST 2021


On 7/6/21 6:13 PM, François Ozog wrote:
> Hi Heinrich, U-Boot 2021-07rc5 does not take into account memory
> description when using Qemu 5.2 NUMA configuration to adapt memory map
> (kernel_addr_r...):
>
>         -smp 4 \
>           -m 8G,slots=2,maxmem=16G \
>          -object memory-backend-ram,size=4G,id=m0 \
>          -object memory-backend-ram,size=4G,id=m1 \
>          -numa node,cpus=0-1,nodeid=0,memdev=m0 \
>          -numa node,cpus=2-3,nodeid=1,memdev=m1
>
> kernel_addr_r is still 0x4040000 and thus you can't use it to bootefi.
>
> fdt addr 0x13ede6de0; fdt print
>
> Displays fdt while I think it should not.
>
> If I load the kernel at dram.start, the load works but not boot
>
> U-Boot 2021.07 (Jul 06 2021 - 13:26:43 +0000)
>
>
> DRAM:4 GiB
>
> Flash: 64 MiB
>
> Loading Environment from Flash... OK
>
> In:pl011 at 9000000
>
> Out: pl011 at 9000000
>
> Err: pl011 at 9000000
>
> Net: eth0: virtio-net#32
>
> Hit any key to stop autoboot:0
>
> =>
>
> => bdinfo
>
> boot_params = 0x0000000000000000
>
> DRAM bank = 0x0000000000000000
>
> -> start= 0x0000000140000000
>
> -> size = 0x0000000100000000
>
> flashstart= 0x0000000000000000
>
> flashsize = 0x0000000004000000
>
> flashoffset = 0x00000000000bc990
>
> baudrate= 115200 bps
>
> relocaddr = 0x000000013ff27000
>
> reloc off = 0x000000013ff27000
>
> Build = 64-bit
>
> current eth = virtio-net#32
>
> ethaddr = 52:52:52:52:52:52
>
> IP addr = <NULL>
>
> fdt_blob= 0x000000013ede6de0
>
> new_fdt = 0x000000013ede6de0
>
> fdt_size= 0x0000000000100000
>
> lmb_dump_all:
>
> memory.cnt= 0x1
>
> memory.reg[0x0].base = 0x140000000
>
> .size = 0x100000000
>
>
> reserved.cnt= 0x0
>
> arch_number = 0x0000000000000000
>
> TLB addr= 0x000000013fff0000
>
> irq_sp= 0x000000013ede6dd0
>
> sp start= 0x000000013ede6dd0
>
> Early malloc usage: 3a8 / 2000
>
> => load virtio 0:1 0x140000000 /oskit.efi
>
> 853424 bytes read in 1 ms (813.9 MiB/s)
>
> => bootefi0x140000000 0x13ede6dd0
>
> ERROR: Failed to register WaitForKey event
>
> Setting OsIndications failed
>
> Error: Cannot initialize UEFI sub-system, r = 9
>
>
> I think there is a need to calculate memory map based on previous
> firmware (TFA, QEMU can be considered as previous frimware) information
> (DT or blob_list).
>
> What do you think ?
>
> Cheers
>
> FF
>
> --
>
> François-Frédéric Ozog | /Director Business Development/
> T: +33.67221.6485
> francois.ozog at linaro.org <mailto:francois.ozog at linaro.org> | Skype: ffozog
>
>

The kernel load address is hard coded here:
include/configs/qemu-arm.h:41:  "kernel_addr_r=0x40400000\0" \

bdinfo shows:
DRAM start = 0x140000000
DRAM size  = 0x100000000

fdt addr $fdt_addr
fdt printf

shows two memory areas. One at 40000000, one at 140000000.

Your use case is well beyond the typical U-Boot usage. So I guess it
will be up to Linaro to provide the necessary patches:

* determine the active CPU
* determine the RAM assigned to the active CPU according
   to the numa-node-id in the device-tree
* make sure that U-Boot only uses the memory of the active CPU
   internally
* make sure that the UEFI memory map contains a compliant description
* possibly, dynamically set up the environment variables

+CC Tuomas Tynkkynen (maintainer for qemu_arm64_defconfig)

Best regards

Heinrich


More information about the U-Boot mailing list