arm: mach-k3: common: EFI loader map memory below ram top
Subsystems (2)
PATCH 1/1 arm: mach-k3: common: EFI loader map memory below ram top
From: Vitor Soares <[email protected]>
During the boot, the EFI loader maps the memory from ram_top to ram_end as EFI_BOOT_SERVICES_DATA. When LMB does boot_fdt_add_mem_rsv_regions() to OPTEE, TFA, R5, and M4F DMA/memory "no-map" for the kernel it produces the following error message:
ERROR: reserving fdt memory region failed (addr=9cb00000 size=100000 flags=4)
ERROR: reserving fdt memory region failed (addr=9cc00000 size=e00000 flags=4)
ERROR: reserving fdt memory region failed (addr=9da00000 size=100000 flags=4)
ERROR: reserving fdt memory region failed (addr=9db00000 size=c00000 flags=4)
ERROR: reserving fdt memory region failed (addr=9e780000 size=80000 flags=4)
ERROR: reserving fdt memory region failed (addr=9e800000 size=1800000 flags=4)
To avoid this, don't flag with EFI_BOOT_SERVICES_DATA the memory from ram_top to ram_end by the EFI loader.
---
Similar fix for the same issue can be found at
https://lore.kernel.org/all/[email protected]/
arch/arm/mach-k3/common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/mach-k3/common.c +12 -0
@@ -24,6 +24,7 @@#include <asm/io.h> #include <fs_loader.h> #include <fs.h> +#include <efi_loader.h> #include <env.h> #include <elf.h> #include <soc.h>
@@ -607,3 +608,14 @@ void setup_qos(void) writel(qos_data[i].val, (uintptr_t)qos_data[i].reg); }#endif + +void efi_add_known_memory (void ) +{ +if (IS_ENABLED (CONFIG_EFI_LOADER )) +/* +* Memory over ram_top can be used by various firmware +* Declare to EFI only memory area below ram_top +*/ +efi_add_memory_map (gd->ram_base, gd->ram_top - gd->ram_base, +EFI_CONVENTIONAL_MEMORY ); +}
Signature · 1 line
2.34.1
Quoted 5 lines · Vitor Soares
During the boot, the EFI loader maps the memory from
ram_toptoram_endasEFI_BOOT_SERVICES_DATA. When LMB doesboot_fdt_add_mem_rsv_regions()to OPTEE, TFA, R5, and M4F DMA/memory "no-map" for the kernel it produces the following error message:
Quoted 8 lines
ERROR: reserving fdt memory region failed (addr=9cb00000 size=100000 flags=4)
ERROR: reserving fdt memory region failed (addr=9cc00000 size=e00000 flags=4)
ERROR: reserving fdt memory region failed (addr=9da00000 size=100000 flags=4)
ERROR: reserving fdt memory region failed (addr=9db00000 size=c00000 flags=4)
ERROR: reserving fdt memory region failed (addr=9e780000 size=80000 flags=4)
ERROR: reserving fdt memory region failed (addr=9e800000 size=1800000 flags=4)[...]
Applied to u-boot/master, thanks!
Signature · 1 line
Tom