linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes
@ 2020-04-16 16:27 Laurent Dufour
  2020-04-21 13:34 ` Michael Ellerman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Laurent Dufour @ 2020-04-16 16:27 UTC (permalink / raw)
  To: kvm-ppc, linuxppc-dev
  Cc: paulus, mpe, linux-kernel, Alexey Kardashevskiy, benh

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 <ldufour@linux.ibm.com>
---
 arch/powerpc/kvm/book3s_hv_uvmem.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c
index 53b88cae3e73..ad950f8996e0 100644
--- a/arch/powerpc/kvm/book3s_hv_uvmem.c
+++ b/arch/powerpc/kvm/book3s_hv_uvmem.c
@@ -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;
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes
  2020-04-16 16:27 [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes Laurent Dufour
@ 2020-04-21 13:34 ` Michael Ellerman
  2020-04-21 13:43   ` Oliver O'Halloran
  2020-05-26 17:51 ` Laurent Dufour
  2020-05-27  4:16 ` Paul Mackerras
  2 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2020-04-21 13:34 UTC (permalink / raw)
  To: Laurent Dufour, kvm-ppc, linuxppc-dev
  Cc: paulus, linux-kernel, Alexey Kardashevskiy, benh

Hi Laurent,

Laurent Dufour <ldufour@linux.ibm.com> writes:
> 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

> 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 <ldufour@linux.ibm.com>
> ---
>  arch/powerpc/kvm/book3s_hv_uvmem.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c
> index 53b88cae3e73..ad950f8996e0 100644
> --- a/arch/powerpc/kvm/book3s_hv_uvmem.c
> +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c
> @@ -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;
> -- 
> 2.26.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes
  2020-04-21 13:34 ` Michael Ellerman
@ 2020-04-21 13:43   ` Oliver O'Halloran
  2020-04-21 17:39     ` Laurent Dufour
  0 siblings, 1 reply; 6+ messages in thread
From: Oliver O'Halloran @ 2020-04-21 13:43 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Laurent Dufour, kvm-ppc, linuxppc-dev, Alexey Kardashevskiy,
	Paul Mackerras, Linux Kernel Mailing List

On Tue, Apr 21, 2020 at 11:37 PM Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> Hi Laurent,
>
> Laurent Dufour <ldufour@linux.ibm.com> writes:
> > 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
>
> > 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/20200227204023.22125-2-grimm@linux.ibm.com/

...which is also marked RFC. Cool.

Oliver

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes
  2020-04-21 13:43   ` Oliver O'Halloran
@ 2020-04-21 17:39     ` Laurent Dufour
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Dufour @ 2020-04-21 17:39 UTC (permalink / raw)
  To: Oliver O'Halloran, Michael Ellerman
  Cc: kvm-ppc, linuxppc-dev, Alexey Kardashevskiy, Paul Mackerras,
	Linux Kernel Mailing List

Le 21/04/2020 à 15:43, Oliver O'Halloran a écrit :
> On Tue, Apr 21, 2020 at 11:37 PM Michael Ellerman <mpe@ellerman.id.au> wrote:
>>
>> Hi Laurent,
>>
>> Laurent Dufour <ldufour@linux.ibm.com> writes:
>>> 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
>>
>>> 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/20200227204023.22125-2-grimm@linux.ibm.com/
> 
> ...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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes
  2020-04-16 16:27 [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes Laurent Dufour
  2020-04-21 13:34 ` Michael Ellerman
@ 2020-05-26 17:51 ` Laurent Dufour
  2020-05-27  4:16 ` Paul Mackerras
  2 siblings, 0 replies; 6+ messages in thread
From: Laurent Dufour @ 2020-05-26 17:51 UTC (permalink / raw)
  To: kvm-ppc, linuxppc-dev, paulus; +Cc: Alexey Kardashevskiy, linux-kernel

Paul, could you please take that patch?

Le 16/04/2020 à 18:27, Laurent Dufour a écrit :
> 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 <ldufour@linux.ibm.com>
> ---
>   arch/powerpc/kvm/book3s_hv_uvmem.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c
> index 53b88cae3e73..ad950f8996e0 100644
> --- a/arch/powerpc/kvm/book3s_hv_uvmem.c
> +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c
> @@ -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;
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes
  2020-04-16 16:27 [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes Laurent Dufour
  2020-04-21 13:34 ` Michael Ellerman
  2020-05-26 17:51 ` Laurent Dufour
@ 2020-05-27  4:16 ` Paul Mackerras
  2 siblings, 0 replies; 6+ messages in thread
From: Paul Mackerras @ 2020-05-27  4:16 UTC (permalink / raw)
  To: Laurent Dufour
  Cc: kvm-ppc, linuxppc-dev, mpe, linux-kernel, Alexey Kardashevskiy, benh

On Thu, Apr 16, 2020 at 06:27:15PM +0200, Laurent Dufour wrote:
> 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 <ldufour@linux.ibm.com>

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

Paul.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-27  4:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 16:27 [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes Laurent Dufour
2020-04-21 13:34 ` Michael Ellerman
2020-04-21 13:43   ` Oliver O'Halloran
2020-04-21 17:39     ` Laurent Dufour
2020-05-26 17:51 ` Laurent Dufour
2020-05-27  4:16 ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).