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
This commit is contained in:
jhibbits 2018-05-19 03:45:38 +00:00
parent c804777c4e
commit 895c0483ab

View File

@ -342,6 +342,16 @@ ofw_mem_regions(struct mem_region *memp, int *memsz,
res = parse_ofw_memory(phandle, "reg", &memp[msz]); res = parse_ofw_memory(phandle, "reg", &memp[msz]);
msz += res/sizeof(struct mem_region); 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) if (OF_getproplen(phandle, "available") >= 0)
res = parse_ofw_memory(phandle, "available", res = parse_ofw_memory(phandle, "available",
&availp[asz]); &availp[asz]);