For some reason u-boot on the exynos platform decides to split up the
memory in banks with a maximum size of 256MB.  Since my Odroid XU4 has
2GB of memory, I end up with more memory segments than the two
supported by our kernel.  The diff below increases the number of
segments to 32, which is what we use on sparc64 and macppc.

However, increasing the number of segments didn't actually make more
memory available.  Turns out the code that is supposed to add
additonal memory segments isn't working.  The reason is that we
reinitialize the fdt to use the virtual mapping.  This makes the old
pointer to the /memory node invalid.  Doing another lookup fixes
things.  And the lookup really shouldn't fail at this point since we
already established that the /memory node exists.

ok?

P.S. arm64 currently lacks code to load additional memory segments.
     That needs to be fixed.

Index: arch/armv7/include/vmparam.h
===================================================================
RCS file: /cvs/src/sys/arch/armv7/include/vmparam.h,v
retrieving revision 1.5
diff -u -p -r1.5 vmparam.h
--- arch/armv7/include/vmparam.h        24 Jan 2017 13:33:06 -0000      1.5
+++ arch/armv7/include/vmparam.h        9 Mar 2017 21:27:45 -0000
@@ -83,8 +83,8 @@
  * max number of non-contig chunks of physical RAM you can have
  */
 
-#define        VM_PHYSSEG_MAX          2
-#define        VM_PHYSSEG_STRAT        VM_PSTRAT_RANDOM
+#define        VM_PHYSSEG_MAX          32
+#define        VM_PHYSSEG_STRAT        VM_PSTRAT_BSEARCH
 
 /*
  * this indicates that we can't add RAM to the VM system after the
Index: arch/armv7/armv7/armv7_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/armv7/armv7_machdep.c,v
retrieving revision 1.45
diff -u -p -r1.45 armv7_machdep.c
--- arch/armv7/armv7/armv7_machdep.c    25 Oct 2016 00:04:59 -0000      1.45
+++ arch/armv7/armv7/armv7_machdep.c    9 Mar 2017 21:27:45 -0000
@@ -754,6 +754,7 @@ initarm(void *arg0, void *arg1, void *ar
                physsegs--;
        }
 
+       node = fdt_find_node("/memory");
        for (i = 1; i < physsegs; i++) {
                if (fdt_get_reg(node, i, &reg))
                        break;

Reply via email to