On Tue, May 09, 2023 at 12:11:41AM +0200, Ard Biesheuvel wrote: > > @@ -1324,13 +1325,15 @@ void __init e820__memblock_setup(void) > > * e820_table is not finalized and e820__end_of_ram_pfn() cannot be > > * used to get correct RAM size. > > */ > > - if (boot_params.unaccepted_memory) { > > + if (efi.unaccepted != EFI_INVALID_TABLE_ADDR) { > > + struct efi_unaccepted_memory *unaccepted; > > unsigned long size; > > > > - /* One bit per 2MB */ > > - size = DIV_ROUND_UP(e820__end_of_ram_pfn() * PAGE_SIZE, > > - PMD_SIZE * BITS_PER_BYTE); > > - memblock_reserve(boot_params.unaccepted_memory, size); > > + unaccepted = __va(efi.unaccepted); > > + > > + size = sizeof(struct efi_unaccepted_memory); > > + size += unaccepted->size; > > + memblock_reserve(efi.unaccepted, size); > > } > > > > This could be moved to generic code (but we'll need to use early_memremap()) I don't understand why early_memremap() is needed. EFI_LOADER_DATA already mapped into direct mapping. We only need to reserve the memory so it could not be reallocated for other things. Hm? -- Kiryl Shutsemau / Kirill A. Shutemov