Skip to content

usable memory range fixes (arm64/fdt/efi)

Frank van der Linden kexec linux-arm-kernel linux-devicetree linux-efi linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3memblock: define functions to set the usable memory rangeinclude/linux/memblock.h mm/memblock.c+39 -09 replies
2/3of: fdt: use memblock usable range interfacedrivers/of/fdt.c+2 -10 replies
3/3efi: enforce usable memory range after reserving regionsdrivers/firmware/efi/efi-init.c+7 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] usable memory range fixes (arm64/fdt/efi)

b261dba2fdb2 ("arm64: kdump: Remove custom linux,usable-memory-range handling") moved capping memory ranges using the FDT-specified linux,usable-memory-range to the FDT code. This property is used to specify the memory range that a crash kernel runs in.

While this correctly filters any memory ranges that come from the DT, this breaks crash kernels on arm64 EFI systems. In these cases, DT is used for the usable-memory-range property, but the actual memory ranges come from EFI. Since the call to filter them was moved to the FDT code, which runs before the EFI init code, the EFI ranges are not filtered anymore, leading to the crash kernel using memory that it shouldn't.

This set fixes the the issue by having the EFI code cap its memory ranges too, and defining a common interface for both the DT and EFI code to use.

These changes stick to the "firmware code should cap its own memory ranges" idea, using a common memblock interface. An alternative would be to use an FDT-specific interface as before, called from arm64_memblock_init, but having things a little more generalized seemed like a good idea.

This is only a functional change on architectures that have both DT and EFI, and a usable-memory-range property (which is just arm64). On any other architecture, usable_size will not be set, leading to a memblock_cap_memory_range call with 0 size, which is a no-op.

Frank van der Linden (3):
memblock: define functions to set the usable memory range
of: fdt: use memblock usable range interface
efi: enforce usable memory range after reserving regions

 drivers/firmware/efi/efi-init.c |  7 +++++++
 drivers/of/fdt.c                |  3 ++-
 include/linux/memblock.h        |  2 ++
 mm/memblock.c                   | 37 +++++++++++++++++++++++++++++++++
 4 files changed, 48 insertions(+), 1 deletion(-)
Signature · 1 line
2.32.0