On Fri, 16 Feb 2024 at 00:21, Ard Biesheuvel ardb@kernel.org wrote:
(cc Oliver)
On Thu, 15 Feb 2024 at 23:51, Boqun Feng boqun.feng@gmail.com wrote:
Currently ACPI_MEMORY_NVS is omitted from the linear map, which causes a trouble with the following firmware memory region setup:
[..] efi: 0x0000dfd62000-0x0000dfd83fff [ACPI Reclaim|...] [..] efi: 0x0000dfd84000-0x0000dfd87fff [ACPI Mem NVS|...]
Which memory types were listed here?
, on ARM64 with 64k page size, the whole 0x0000dfd80000-0x0000dfd8ffff range will be omitted from the the linear map due to 64k round-up. And a page fault happens when trying to access the ACPI_RECLAIM_MEMORY:
[...] Unable to handle kernel paging request at virtual address ffff0000dfd80000
You trimmed all the useful information here. ACPI reclaim memory is reclaimable, but we don't actually do so in Linux. So this is not general purpose memory, it is used for a specific purpose, and the code that accesses it is assuming that it is accessible via the linear map. There are reason why this may not be the case, so the fix might be to use memremap() in the access instead.
Please try the below if the caller is already using memremap(). It might misidentify the region because the start is in the linear map but the end is not.
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c index 269f2f63ab7d..fef0281e223c 100644 --- a/arch/arm64/mm/ioremap.c +++ b/arch/arm64/mm/ioremap.c @@ -31,7 +31,6 @@ void __init early_ioremap_init(void) bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size, unsigned long flags) { - unsigned long pfn = PHYS_PFN(offset); - - return pfn_is_map_memory(pfn); + return pfn_is_map_memory(PHYS_PFN(offset)) && + pfn_is_map_memory(PHYS_PFN(offset + size - 1)); }