Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of/fdt: make memblock maximum physical address arch configurable

When parsing the memory nodes to populate the memblock memory
table, we check against high and low limits and clip any memory
that exceeds either one of them.

However, for arm64, the high limit of (phys_addr_t)~0 is not very
meaningful, since phys_addr_t is 64 bits (i.e., no limit) but there
may be other constraints that limit the memory ranges that we can
support.

So rename MAX_PHYS_ADDR to MAX_MEMBLOCK_ADDR (for clarity) and only
define it if the arch does not supply a definition of its own.

Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>

authored by

Ard Biesheuvel and committed by
Will Deacon
8eafeb48 5d3c2c35

+7 -5
+7 -5
drivers/of/fdt.c
··· 967 967 } 968 968 969 969 #ifdef CONFIG_HAVE_MEMBLOCK 970 - #define MAX_PHYS_ADDR ((phys_addr_t)~0) 970 + #ifndef MAX_MEMBLOCK_ADDR 971 + #define MAX_MEMBLOCK_ADDR ((phys_addr_t)~0) 972 + #endif 971 973 972 974 void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) 973 975 { ··· 986 984 } 987 985 size &= PAGE_MASK; 988 986 989 - if (base > MAX_PHYS_ADDR) { 987 + if (base > MAX_MEMBLOCK_ADDR) { 990 988 pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", 991 989 base, base + size); 992 990 return; 993 991 } 994 992 995 - if (base + size - 1 > MAX_PHYS_ADDR) { 993 + if (base + size - 1 > MAX_MEMBLOCK_ADDR) { 996 994 pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", 997 - ((u64)MAX_PHYS_ADDR) + 1, base + size); 998 - size = MAX_PHYS_ADDR - base + 1; 995 + ((u64)MAX_MEMBLOCK_ADDR) + 1, base + size); 996 + size = MAX_MEMBLOCK_ADDR - base + 1; 999 997 } 1000 998 1001 999 if (base + size < phys_offset) {