Hi Sughosh, On Sun, 13 Oct 2024 at 13:55, Sughosh Ganu <[email protected]> wrote: > > > This is part two of the series to have the EFI and LMB modules have a > coherent view of memory. Part one of this goal was to change the LMB > module to have a global and persistent memory map. Those patches have > now been applied to the next branch. > > These patches are changing the EFI memory allocation API's such that > they rely on the LMB module to allocate RAM memory. This fixes the > current scenario where the EFI memory module has no visibility of the > allocations/reservations made by the LMB module. One thing to note > here is that this is limited to the RAM memory region, i.e. the > EFI_CONVENTIONAL_MEMORY type. Any other memory type that is to be > added to the EFI memory map, still gets handled by the EFI memory > module. > > > Some test logs to highlight the issue that is being fixed by the series. > > Without patch series > -------------------- > > lmb_dump_all: > memory.count = 0x1 > memory[0] [0x40000000-0x820fffff], 0x42100000 bytes flags: none > reserved.count = 0x3 > reserved[0] [0xe100000-0xeffffff], 0x00f00000 bytes flags: no-map > reserved[1] [0x42000000-0x421fffff], 0x00200000 bytes flags: no-map > reserved[2] [0x7f77da00-0x820fffff], 0x02982600 bytes flags: no-overwrite > > > => efidebug memmap -- does not show regions allocated by lmb > > Missing TPMv2 device for EFI_TCG_PROTOCOL > Type Start End Attributes > ================ ================ ================ ========== > CONVENTIONAL 0000000040000000-000000007f751000 WB > BOOT DATA 000000007f751000-000000007f756000 WB > RUNTIME DATA 000000007f756000-000000007f757000 WB|RT > BOOT DATA 000000007f757000-000000007f758000 WB > RUNTIME DATA 000000007f758000-000000007f77a000 WB|RT > BOOT DATA 000000007f77a000-000000007f781000 WB > BOOT CODE 000000007f781000-00000000807b5000 WB > RUNTIME DATA 00000000807b5000-00000000807b6000 WB|RT > BOOT CODE 00000000807b6000-00000000817c0000 WB > RUNTIME CODE 00000000817c0000-00000000817d0000 WB|RT > BOOT CODE 00000000817d0000-0000000082100000 WB > => > > > Trying to allocate EFI memory with already allocated region succeeds(should > fail) > --------------------------------------------------------------------------------- > > => efi_mem alloc 2000 42000000 > Address returned 0x42000000 > > => efidebug memmap > Type Start End Attributes > ================ ================ ================ ========== > CONVENTIONAL 0000000040000000-0000000042000000 WB > BOOT DATA 0000000042000000-0000000042002000 WB > CONVENTIONAL 0000000042002000-000000007f751000 WB
Any idea what caused BOOT DATA to start from 000000007f74d000 with the patches applied? > BOOT DATA 000000007f751000-000000007f756000 WB > RUNTIME DATA 000000007f756000-000000007f757000 WB|RT > BOOT DATA 000000007f757000-000000007f758000 WB > RUNTIME DATA 000000007f758000-000000007f77a000 WB|RT > BOOT DATA 000000007f77a000-000000007f781000 WB > BOOT CODE 000000007f781000-00000000807b5000 WB > RUNTIME DATA 00000000807b5000-00000000807b6000 WB|RT > BOOT CODE 00000000807b6000-00000000817c0000 WB > RUNTIME CODE 00000000817c0000-00000000817d0000 WB|RT > BOOT CODE 00000000817d0000-0000000082100000 WB > => > > > With patch series > ----------------- > > lmb_dump_all: > memory.count = 0x1 > memory[0] [0x40000000-0x820fffff], 0x42100000 bytes flags: none > reserved.count = 0x4 > reserved[0] [0xe100000-0xeffffff], 0x00f00000 bytes flags: no-map > reserved[1] [0x42000000-0x421fffff], 0x00200000 bytes flags: no-map > reserved[2] [0x7f77a000-0x7f77cfff], 0x00003000 bytes flags: no-notify, > no-overwrite > reserved[3] [0x7f77da00-0x820fffff], 0x02982600 bytes flags: no-overwrite > > > => efidebug memmap -- now shows the lmb allocated memory regions also > Missing TPMv2 device for EFI_TCG_PROTOCOL > Type Start End Attributes > ================ ================ ================ ========== > CONVENTIONAL 0000000040000000-0000000042000000 WB > BOOT DATA 0000000042000000-0000000042200000 WB > CONVENTIONAL 0000000042200000-000000007f74d000 WB > BOOT DATA 000000007f74d000-000000007f752000 WB > RUNTIME DATA 000000007f752000-000000007f753000 WB|RT > BOOT DATA 000000007f753000-000000007f754000 WB > RUNTIME DATA 000000007f754000-000000007f776000 WB|RT > BOOT DATA 000000007f776000-00000000807b5000 WB > RUNTIME DATA 00000000807b5000-00000000807b6000 WB|RT > BOOT DATA 00000000807b6000-00000000817c0000 WB > RUNTIME CODE 00000000817c0000-00000000817d0000 WB|RT > BOOT DATA 00000000817d0000-0000000082100000 WB > => > > > Trying to allocate EFI memory with already allocated region fails as expected > ----------------------------------------------------------------------------- > > => efi_mem alloc 2000 42000000 > efi_allocate_pages failed 800000000000000e > => > > Trying to allocate EFI memory with non-allocated region succeeds > ---------------------------------------------------------------- > > => efi_mem alloc 2000 42200000 > Address returned 0x42200000 > > Thanks /Ilias

