[RFC PATCH 1/2] efi: arm: do not overlap non ram memory on efi allocation
Maxim Uvarov
maxim.uvarov at linaro.org
Fri Aug 28 21:47:40 CEST 2020
This commit fixes qemu boot of armv7 where reserving memory
for fdt is failed due to reserving region outside of the
system RAM.
=> bdinfo
boot_params = 0x00000000
DRAM bank = 0x00000000
-> start = 0x40000000
-> size = 0x40000000
memstart = 0x40000000
memsize = 0x40000000
flashstart = 0x04000000
flashsize = 0x04000000
flashoffset = 0x00000000
baudrate = 115200 bps
relocaddr = 0x7ff57000
reloc off = 0x1ff57000
Build = 32-bit
current eth = virtio-net#32
ethaddr = 52:52:52:52:52:52
IP addr = <NULL>
fdt_blob = 0x7ef35f20
new_fdt = 0x7ef35f20
fdt_size = 0x00001fa0
ERROR: reserving fdt memory region failed (addr=7fe00000 size=200000)
lmb_dump_all:
memory.cnt = 0x1
memory.size = 0x0
memory.reg[0x0].base = 0x40000000
.size = 0x40000000
reserved.cnt = 0x2
reserved.size = 0x0
reserved.reg[0x0].base = 0xe100000
.size = 0xf00000
reserved.reg[0x1].base = 0x7ef34d04
.size = 0x10cb2fc
arch_number = 0x00000000
TLB addr = 0x7fff0000
irq_sp = 0x7ef35f10
sp start = 0x7ef35f00
Early malloc usage: 1fc / 400
=> efidebug memmap
Type Start End Attributes
================ ================ ================ ==========
RESERVED 000000000e100000-000000000f000000 WB <---- outside of RAM
CONVENTIONAL 0000000040000000-0000000047f00000 WB
ACPI RECLAIM MEM 0000000047f00000-0000000047f05000 WB
CONVENTIONAL 0000000047f05000-000000007d475000 WB
RESERVED 000000007d475000-000000007d477000 WB
CONVENTIONAL 000000007d477000-000000007df17000 WB
LOADER DATA 000000007df17000-000000007df18000 WB
Signed-off-by: Maxim Uvarov <maxim.uvarov at linaro.org>
---
I'm really not sure that this is correct way to fix. Current code state is that
uboot fails to boot kernel on armv7 if memory was reserved at 0xe100000. I.e. in
current code it does not work. Qemu target has memory started at 0x40000000 and
this chunk is outside that memory. Flag overlap_only_ram had very confusing naming,
I corrected it in separate path. This patch fixes booting with removing region
from efi memmap. I send this as RFC for now.
BR,
Maxim.
lib/efi_loader/efi_memory.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 7be756e370..637c6c67ed 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -360,11 +360,15 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages,
efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type)
{
u64 pages;
+ bool overlap_only_ram = false;
pages = efi_size_in_pages(size + (start & EFI_PAGE_MASK));
start &= ~EFI_PAGE_MASK;
-
- return efi_add_memory_map_pg(start, pages, memory_type, false);
+#if defined(CONFIG_ARM)
+ overlap_only_ram = true;
+#endif
+ return efi_add_memory_map_pg(start, pages, memory_type,
+ overlap_only_ram);
}
/**
--
2.17.1
More information about the U-Boot
mailing list