Skip to content

Commit f56ab9a

Browse files
Ard BiesheuvelIngo Molnar
authored andcommitted
efi/arm: Don't mark ACPI reclaim memory as MEMBLOCK_NOMAP
On ARM, regions of memory that are described by UEFI as having special significance to the firmware itself are omitted from the linear mapping. This is necessary since we cannot guarantee that alternate mappings of the same physical region will use attributes that are compatible with the ones we use for the linear mapping, and aliases with mismatched attributes are prohibited by the architecture. The above does not apply to ACPI reclaim regions: such regions have no special significance to the firmware, and it is up to the OS to decide whether or not to preserve them after it has consumed their contents, and for how long, after which time the OS can use the memory in any way it likes. In the Linux case, such regions are preserved indefinitely, and are simply treated the same way as other 'reserved' memory types. Punching holes into the linear mapping causes page table fragmentation, which increases TLB pressure, and so we should avoid doing so if we can. So add a special case for regions of type EFI_ACPI_RECLAIM_MEMORY, and memblock_reserve() them instead of marking them MEMBLOCK_NOMAP. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20170818194947.19347-2-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 14ccee7 commit f56ab9a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/firmware/efi/arm-init.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ static __init int is_usable_memory(efi_memory_desc_t *md)
159159
switch (md->type) {
160160
case EFI_LOADER_CODE:
161161
case EFI_LOADER_DATA:
162+
case EFI_ACPI_RECLAIM_MEMORY:
162163
case EFI_BOOT_SERVICES_CODE:
163164
case EFI_BOOT_SERVICES_DATA:
164165
case EFI_CONVENTIONAL_MEMORY:
@@ -211,6 +212,10 @@ static __init void reserve_regions(void)
211212

212213
if (!is_usable_memory(md))
213214
memblock_mark_nomap(paddr, size);
215+
216+
/* keep ACPI reclaim memory intact for kexec etc. */
217+
if (md->type == EFI_ACPI_RECLAIM_MEMORY)
218+
memblock_reserve(paddr, size);
214219
}
215220
}
216221
}

0 commit comments

Comments
 (0)