powerpc: Make early memory scan more resilient to out of order nodes

We keep track of the size of the lowest block of memory and call
setup_initial_memory_limit() only after we've parsed them all
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: default avatarMilton Miller <miltonm@bga.com>
parent b73a635f
...@@ -68,6 +68,7 @@ int __initdata iommu_force_on; ...@@ -68,6 +68,7 @@ int __initdata iommu_force_on;
unsigned long tce_alloc_start, tce_alloc_end; unsigned long tce_alloc_start, tce_alloc_end;
u64 ppc64_rma_size; u64 ppc64_rma_size;
#endif #endif
static phys_addr_t first_memblock_size;
static int __init early_parse_mem(char *p) static int __init early_parse_mem(char *p)
{ {
...@@ -505,11 +506,14 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) ...@@ -505,11 +506,14 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
size = 0x80000000ul - base; size = 0x80000000ul - base;
} }
#endif #endif
/* Keep track of the beginning of memory -and- the size of
/* First MEMBLOCK added, do some special initializations */ * the very first block in the device-tree as it represents
if (memstart_addr == ~(phys_addr_t)0) * the RMA on ppc64 server
setup_initial_memory_limit(base, size); */
memstart_addr = min((u64)memstart_addr, base); if (base < memstart_addr) {
memstart_addr = base;
first_memblock_size = size;
}
/* Add the chunk to the MEMBLOCK list */ /* Add the chunk to the MEMBLOCK list */
memblock_add(base, size); memblock_add(base, size);
...@@ -694,6 +698,7 @@ void __init early_init_devtree(void *params) ...@@ -694,6 +698,7 @@ void __init early_init_devtree(void *params)
of_scan_flat_dt(early_init_dt_scan_root, NULL); of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL); of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
setup_initial_memory_limit(memstart_addr, first_memblock_size);
/* Save command line for /proc/cmdline and then parse parameters */ /* Save command line for /proc/cmdline and then parse parameters */
strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment