efi/unaccepted: Make sure unaccepted table is mapped
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Mon, 14 Aug 2023 16:12:47 +0000 (19:12 +0300)
committerArd Biesheuvel <ardb@kernel.org>
Tue, 19 Sep 2023 16:11:36 +0000 (16:11 +0000)
commit8dbe33956d96c9d066ef15ca933ede30748198b2
tree4326eefb240bc1483b1fb700e3257106d5916f89
parent79b83606abc778aa3cbee535b362ce905d0b9448
efi/unaccepted: Make sure unaccepted table is mapped

Unaccepted table is now allocated from EFI_ACPI_RECLAIM_MEMORY. It
translates into E820_TYPE_ACPI, which is not added to memblock and
therefore not mapped in the direct mapping.

This causes a crash on the first touch of the table.

Use memblock_add() to make sure that the table is mapped in direct
mapping.

Align the range to the nearest page borders. Ranges smaller than page
size are not mapped.

Fixes: e7761d827e99 ("efi/unaccepted: Use ACPI reclaim memory for unaccepted memory table")
Reported-by: Hongyu Ning <hongyu.ning@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/efi.c