Skip to contentSkip to conversation

KVM: PPC: Book3S HV: read ibm,secure-memory nodes

PATCH Applied Laurent Dufour 4 participants 6 messages Apr 16, 2020 – May 27, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 arch/powerpc/kvm/book3s_hv_uvmem.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/powerpc/kvm/book3s_hv_uvmem.c +14 -0
index 53b88cae3e73..ad950f8996e0 100644
@@ -735,6 +735,20 @@ static u64 kvmppc_get_secmem_size(void)
 	const __be32 *prop;
 	u64 size = 0;
 
+	/*
+	 * First try the new ibm,secure-memory nodes which supersede the
+	 * secure-memory-ranges property.
+	 * If we found somes, no need to read the deprecated one.
+	 */
+	for_each_compatible_node(np, NULL, "ibm,secure-memory") {
+		prop = of_get_property(np, "reg", &len);
+		if (!prop)
+			continue;
+		size += of_read_number(prop + 2, 2);
+	}
+	if (size)
+		return size;
+
 	np = of_find_compatible_node(NULL, NULL, "ibm,uv-firmware");
 	if (!np)
 		goto out;
Signature · 1 line
2.26.1
#1 lore raw

Hi Laurent,

Quoted 2 lines · Laurent Dufour

The newly introduced ibm,secure-memory nodes supersede the ibm,uv-firmware's property secure-memory-ranges.

Is either documented in a device tree binding document anywhere?

cheers

Quoted 35 lines

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.

---
 arch/powerpc/kvm/book3s_hv_uvmem.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/powerpc/kvm/book3s_hv_uvmem.c +14 -0
index 53b88cae3e73..ad950f8996e0 100644
@@ -735,6 +735,20 @@ static u64 kvmppc_get_secmem_size(void)
 	const __be32 *prop;
 	u64 size = 0;
 
+	/*
+	 * First try the new ibm,secure-memory nodes which supersede the
+	 * secure-memory-ranges property.
+	 * If we found somes, no need to read the deprecated one.
+	 */
+	for_each_compatible_node(np, NULL, "ibm,secure-memory") {
+		prop = of_get_property(np, "reg", &len);
+		if (!prop)
+			continue;
+		size += of_read_number(prop + 2, 2);
+	}
+	if (size)
+		return size;
+
 	np = of_find_compatible_node(NULL, NULL, "ibm,uv-firmware");
 	if (!np)
 		goto out;
Signature · 1 line
2.26.1
#2 lore raw
Quoted 13 lines · Michael Ellerman

Hi Laurent,

Quoted 2 lines · Laurent Dufour

The newly introduced ibm,secure-memory nodes supersede the ibm,uv-firmware's property secure-memory-ranges.

Is either documented in a device tree binding document anywhere?

cheers

Quoted 2 lines

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.

There's some in Ryan's UV support series for skiboot:

https://patchwork.ozlabs.org/project/skiboot/patch/[email protected]/

...which is also marked RFC. Cool.

Oliver

#3 lore raw

Le 21/04/2020 à 15:43, Oliver O'Halloran a écrit :

Quoted 12 lines · Michael Ellerman
Quoted 11 lines

Hi Laurent,

Quoted 2 lines · Laurent Dufour

The newly introduced ibm,secure-memory nodes supersede the ibm,uv-firmware's property secure-memory-ranges.

Is either documented in a device tree binding document anywhere?

cheers

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

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.

There's some in Ryan's UV support series for skiboot:

https://patchwork.ozlabs.org/project/skiboot/patch/[email protected]/

...which is also marked RFC. Cool.

Thanks Oliver for this pointer.

Yes this is an RFC but this documentation details the secure memory nodes created by skiboot and parsed by this patch.

Michael, is that enough for you?

Laurent.

#4 lore raw
In reply to Laurent Dufour

Paul, could you please take that patch?

Le 16/04/2020 à 18:27, Laurent Dufour a écrit :

Quoted 37 lines

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.

---
  arch/powerpc/kvm/book3s_hv_uvmem.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
arch/powerpc/kvm/book3s_hv_uvmem.c +14 -0
index 53b88cae3e73..ad950f8996e0 100644
@@ -735,6 +735,20 @@ static u64 kvmppc_get_secmem_size(void)
  	const __be32 *prop;
  	u64 size = 0;
 
+	/*
+	 * First try the new ibm,secure-memory nodes which supersede the
+	 * secure-memory-ranges property.
+	 * If we found somes, no need to read the deprecated one.
+	 */
+	for_each_compatible_node(np, NULL, "ibm,secure-memory") {
+		prop = of_get_property(np, "reg", &len);
+		if (!prop)
+			continue;
+		size += of_read_number(prop + 2, 2);
+	}
+	if (size)
+		return size;
+
  	np = of_find_compatible_node(NULL, NULL, "ibm,uv-firmware");
  	if (!np)
  		goto out;
#5 lore raw
In reply to Laurent Dufour
Quoted 7 lines · Laurent Dufour

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.

Thanks, applied to my kvm-ppc-next branch.

Paul.