While booting, cap system memory at SYSRAM_END and start recording the memory from DEVRAM_START as reserved memory.
Signed-off-by: Anshuman Khandual <khand...@linux.vnet.ibm.com> --- arch/powerpc/include/asm/prom.h | 15 +++++++++++++++ arch/powerpc/kernel/prom.c | 11 +++++++++++ 2 files changed, 26 insertions(+) diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h index 7f436ba..a4ec240e4 100644 --- a/arch/powerpc/include/asm/prom.h +++ b/arch/powerpc/include/asm/prom.h @@ -165,5 +165,20 @@ struct of_drconf_cell { */ extern unsigned char ibm_architecture_vec[]; +#define SYSRAM_END 0x400000000 +#define DEVRAM_START 0xb00000000 +#define NR_RESERVE 500 + +enum resmem_elements { + MEM_BASE = 0, + MEM_SIZE = 1, + MEM_NODE = 2, + MEM_MAX = 3 +}; + +struct resmem { + u64 mem[NR_RESERVE][MEM_MAX]; + u64 nr; +}; #endif /* __KERNEL__ */ #endif /* _POWERPC_PROM_H */ diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index a15fe1d..9b3bf2e 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -438,6 +438,8 @@ static int __init early_init_dt_scan_chosen_ppc(unsigned long node, } #ifdef CONFIG_PPC_PSERIES +struct resmem rmem; +EXPORT_SYMBOL(rmem); /* * Interpret the ibm,dynamic-memory property in the * /ibm,dynamic-reconfiguration-memory node. @@ -471,6 +473,7 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node) if (usm != NULL) is_kexec_kdump = 1; + memset(&rmem, 0, sizeof(struct resmem)); for (; n != 0; --n) { base = dt_mem_next_cell(dt_root_addr_cells, &dm); flags = of_read_number(&dm[3], 1); @@ -508,6 +511,14 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node) if ((base + size) > 0x80000000ul) size = 0x80000000ul - base; } + if (base > DEVRAM_START) { + rmem.mem[rmem.nr][MEM_BASE] = base; + rmem.mem[rmem.nr][MEM_SIZE] = size; + rmem.nr++; + continue; + } + if (base > SYSRAM_END) + continue; memblock_add(base, size); } while (--rngs); } -- 1.8.3.1 _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev