For AMP, different kernel instances load into separate memory regions.
Read the start of memory from the device tree and limit the memory to what's
specified in the device tree.

Signed-off-by: Dave Kleikamp <sha...@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org>
Cc: Josh Boyer <jwbo...@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/boot/treeboot-iss4xx.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/treeboot-iss4xx.c 
b/arch/powerpc/boot/treeboot-iss4xx.c
index fcc4495..868c8b4 100644
--- a/arch/powerpc/boot/treeboot-iss4xx.c
+++ b/arch/powerpc/boot/treeboot-iss4xx.c
@@ -34,9 +34,28 @@
 
 BSS_STACK(4096);
 
+static ibm4xx_memstart;
+
 static void iss_4xx_fixups(void)
 {
-       ibm4xx_sdram_fixup_memsize();
+       void *memory;
+       u32 reg[3];
+
+       memory = finddevice("/memory");
+       if (!memory)
+               fatal("Can't find memory node\n");
+       getprop(memory, "reg", reg, sizeof(reg));
+       if (reg[1] || reg[2])
+               /* If the device tree specifies the memory range, use it */
+               ibm4xx_memstart = reg[1];
+       else
+               /* othersize, read it from the SDRAM controller */
+               ibm4xx_sdram_fixup_memsize();
+}
+
+static void *iss_4xx_vmlinux_alloc(unsigned long size)
+{
+       return ibm4xx_memstart;
 }
 
 #define SPRN_PIR       0x11E   /* Processor Indentification Register */
@@ -48,6 +67,7 @@ void platform_init(void)
 
        simple_alloc_init(_end, avail_ram, 128, 64);
        platform_ops.fixups = iss_4xx_fixups;
+       platform_ops.vmlinux_alloc = iss_4xx_vmlinux_alloc;
        platform_ops.exit = ibm44x_dbcr_reset;
        pir_reg = mfspr(SPRN_PIR);
        fdt_set_boot_cpuid_phys(_dtb_start, pir_reg);
-- 
1.7.3.4

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to