Author: jhibbits
Date: Sat May 19 03:45:38 2018
New Revision: 333825
URL: https://svnweb.freebsd.org/changeset/base/333825

Log:
  Add yet another option for gathering available memory
  
  On some POWER9 systems, 'reg' denotes the full memory in the system, while
  'linux,usable-memory' denotes the usable memory.  Some memory is reserved for
  NVLink usage, so is partitioned off.
  
  Submitted by: Breno Leitao

Modified:
  head/sys/powerpc/ofw/ofw_machdep.c

Modified: head/sys/powerpc/ofw/ofw_machdep.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_machdep.c  Sat May 19 03:23:46 2018        
(r333824)
+++ head/sys/powerpc/ofw/ofw_machdep.c  Sat May 19 03:45:38 2018        
(r333825)
@@ -342,6 +342,16 @@ ofw_mem_regions(struct mem_region *memp, int *memsz,
 
                res = parse_ofw_memory(phandle, "reg", &memp[msz]);
                msz += res/sizeof(struct mem_region);
+
+               /*
+                * On POWER9 Systems we might have both linux,usable-memory and
+                * reg properties.  'reg' denotes all available memory, but we
+                * must use 'linux,usable-memory', a subset, as some memory
+                * regions are reserved for NVLink.
+                */
+               if (OF_getproplen(phandle, "linux,usable-memory") >= 0)
+                       res = parse_ofw_memory(phandle, "linux,usable-memory",
+                           &availp[asz]);
                if (OF_getproplen(phandle, "available") >= 0)
                        res = parse_ofw_memory(phandle, "available",
                            &availp[asz]);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to