Skip to content

Commit 512721d

Browse files
ldu4paulusmack
authored andcommitted
KVM: PPC: Book3S HV: Read ibm,secure-memory nodes
The newly introduced ibm,secure-memory nodes supersede the ibm,uv-firmware's property secure-memory-ranges. Firmware will no more expose the secure-memory-ranges property so first read the new one and if not found rollback to the older one. Signed-off-by: Laurent Dufour <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 32e594f commit 512721d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arch/powerpc/kvm/book3s_hv_uvmem.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,20 @@ static u64 kvmppc_get_secmem_size(void)
749749
const __be32 *prop;
750750
u64 size = 0;
751751

752+
/*
753+
* First try the new ibm,secure-memory nodes which supersede the
754+
* secure-memory-ranges property.
755+
* If we found some, no need to read the deprecated ones.
756+
*/
757+
for_each_compatible_node(np, NULL, "ibm,secure-memory") {
758+
prop = of_get_property(np, "reg", &len);
759+
if (!prop)
760+
continue;
761+
size += of_read_number(prop + 2, 2);
762+
}
763+
if (size)
764+
return size;
765+
752766
np = of_find_compatible_node(NULL, NULL, "ibm,uv-firmware");
753767
if (!np)
754768
goto out;

0 commit comments

Comments
 (0)