linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Documentation: dt-bindings: Document 'rng-seed' for /chosen
@ 2020-04-02  3:36 Florian Fainelli
  2020-04-02  8:13 ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2020-04-02  3:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Florian Fainelli, hsinyi, geert+renesas, will, swboyd, robh, tytso

The /chosen node can have a 'rng-seed' property read as a u32 quantity
which would contain a random number provided by the boot agent. This is
useful in configurations where the kernel does not have access to a
random number generator.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 Documentation/devicetree/bindings/chosen.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Documentation/devicetree/bindings/chosen.txt b/Documentation/devicetree/bindings/chosen.txt
index 45e79172a646..126b31eecfeb 100644
--- a/Documentation/devicetree/bindings/chosen.txt
+++ b/Documentation/devicetree/bindings/chosen.txt
@@ -28,6 +28,19 @@ mode) when EFI_RNG_PROTOCOL is supported, it will be overwritten by
 the Linux EFI stub (which will populate the property itself, using
 EFI_RNG_PROTOCOL).
 
+rng-seed
+--------
+
+This property is used to initialize the kernel's entropy pool from a
+trusted boot agent capable of providing a random number. It is parsed
+as a u32 value, e.g.
+
+/ {
+	chosen {
+		rng-seed = <0xcafef00d>;
+	};
+};
+
 stdout-path
 -----------
 
-- 
2.17.1


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

* Re: [PATCH] Documentation: dt-bindings: Document 'rng-seed' for /chosen
  2020-04-02  3:36 [PATCH] Documentation: dt-bindings: Document 'rng-seed' for /chosen Florian Fainelli
@ 2020-04-02  8:13 ` Will Deacon
  2020-04-02 13:35   ` Rob Herring
  2020-04-02 18:07   ` Florian Fainelli
  0 siblings, 2 replies; 5+ messages in thread
From: Will Deacon @ 2020-04-02  8:13 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-kernel, hsinyi, geert+renesas, swboyd, robh, tytso

Hi Florian,

On Wed, Apr 01, 2020 at 08:36:40PM -0700, Florian Fainelli wrote:
> The /chosen node can have a 'rng-seed' property read as a u32 quantity
> which would contain a random number provided by the boot agent. This is
> useful in configurations where the kernel does not have access to a
> random number generator.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  Documentation/devicetree/bindings/chosen.txt | 13 +++++++++++++
>  1 file changed, 13 insertions(+)

Thanks for doing this; I realised it was undocumented the other day when I
tried to look it up myself.

> diff --git a/Documentation/devicetree/bindings/chosen.txt b/Documentation/devicetree/bindings/chosen.txt
> index 45e79172a646..126b31eecfeb 100644
> --- a/Documentation/devicetree/bindings/chosen.txt
> +++ b/Documentation/devicetree/bindings/chosen.txt
> @@ -28,6 +28,19 @@ mode) when EFI_RNG_PROTOCOL is supported, it will be overwritten by
>  the Linux EFI stub (which will populate the property itself, using
>  EFI_RNG_PROTOCOL).
>  
> +rng-seed
> +--------
> +
> +This property is used to initialize the kernel's entropy pool from a
> +trusted boot agent capable of providing a random number. It is parsed
> +as a u32 value, e.g.

Are you sure about this being limited to a u32 value? I thought you could
pass an arbitrary-length value here.

Will

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

* Re: [PATCH] Documentation: dt-bindings: Document 'rng-seed' for /chosen
  2020-04-02  8:13 ` Will Deacon
@ 2020-04-02 13:35   ` Rob Herring
  2020-04-02 18:07   ` Florian Fainelli
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2020-04-02 13:35 UTC (permalink / raw)
  To: Will Deacon, Florian Fainelli
  Cc: linux-kernel, Hsin-Yi Wang, Geert Uytterhoeven, Stephen Boyd,
	Theodore Ts'o

On Thu, Apr 2, 2020 at 2:13 AM Will Deacon <will@kernel.org> wrote:
>
> Hi Florian,
>
> On Wed, Apr 01, 2020 at 08:36:40PM -0700, Florian Fainelli wrote:
> > The /chosen node can have a 'rng-seed' property read as a u32 quantity
> > which would contain a random number provided by the boot agent. This is
> > useful in configurations where the kernel does not have access to a
> > random number generator.
> >
> > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> > ---
> >  Documentation/devicetree/bindings/chosen.txt | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
>
> Thanks for doing this; I realised it was undocumented the other day when I
> tried to look it up myself.

Already documented here[1]. I've been meaning to delete chosen.txt so
that's a bit more obvious.

I realize it's a bit harder to find what's documented where. Long term
we'd like to generate documentation from the schema and integrate as
part of the spec. Short term, it would be quite trivial to make a 'am
I documented' utility.

Rob

[1] https://github.com/devicetree-org/dt-schema/blob/master/schemas/chosen.yaml

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

* Re: [PATCH] Documentation: dt-bindings: Document 'rng-seed' for /chosen
  2020-04-02  8:13 ` Will Deacon
  2020-04-02 13:35   ` Rob Herring
@ 2020-04-02 18:07   ` Florian Fainelli
  2020-04-03 16:21     ` Hsin-Yi Wang
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2020-04-02 18:07 UTC (permalink / raw)
  To: Will Deacon; +Cc: linux-kernel, hsinyi, geert+renesas, swboyd, robh, tytso



On 4/2/2020 1:13 AM, Will Deacon wrote:
> Hi Florian,
> 
> On Wed, Apr 01, 2020 at 08:36:40PM -0700, Florian Fainelli wrote:
>> The /chosen node can have a 'rng-seed' property read as a u32 quantity
>> which would contain a random number provided by the boot agent. This is
>> useful in configurations where the kernel does not have access to a
>> random number generator.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>  Documentation/devicetree/bindings/chosen.txt | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
> 
> Thanks for doing this; I realised it was undocumented the other day when I
> tried to look it up myself.
> 
>> diff --git a/Documentation/devicetree/bindings/chosen.txt b/Documentation/devicetree/bindings/chosen.txt
>> index 45e79172a646..126b31eecfeb 100644
>> --- a/Documentation/devicetree/bindings/chosen.txt
>> +++ b/Documentation/devicetree/bindings/chosen.txt
>> @@ -28,6 +28,19 @@ mode) when EFI_RNG_PROTOCOL is supported, it will be overwritten by
>>  the Linux EFI stub (which will populate the property itself, using
>>  EFI_RNG_PROTOCOL).
>>  
>> +rng-seed
>> +--------
>> +
>> +This property is used to initialize the kernel's entropy pool from a
>> +trusted boot agent capable of providing a random number. It is parsed
>> +as a u32 value, e.g.
> 
> Are you sure about this being limited to a u32 value? I thought you could
> pass an arbitrary-length value here.

Humm indeed, we can pass an arbitrary value, I completely conflated the
type of "l" here:

	int l;
	...
        rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);

with how much we would be reading from the property, which is complete
nonsense. Out of curiosity, what property length do platforms typically
populate?
-- 
Florian

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

* Re: [PATCH] Documentation: dt-bindings: Document 'rng-seed' for /chosen
  2020-04-02 18:07   ` Florian Fainelli
@ 2020-04-03 16:21     ` Hsin-Yi Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Hsin-Yi Wang @ 2020-04-03 16:21 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Will Deacon, lkml, geert+renesas, Stephen Boyd, Rob Herring,
	Theodore Y. Ts'o

On Fri, Apr 3, 2020 at 2:07 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
> >
> > Are you sure about this being limited to a u32 value? I thought you could
> > pass an arbitrary-length value here.
>
> Humm indeed, we can pass an arbitrary value, I completely conflated the
> type of "l" here:
>
>         int l;
>         ...
>         rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
>
> with how much we would be reading from the property, which is complete
> nonsense. Out of curiosity, what property length do platforms typically
> populate?
> --
> Florian

64 bytes should be able to init crng. (pass CRNG_INIT_CNT_THRESH)

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

end of thread, other threads:[~2020-04-03 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02  3:36 [PATCH] Documentation: dt-bindings: Document 'rng-seed' for /chosen Florian Fainelli
2020-04-02  8:13 ` Will Deacon
2020-04-02 13:35   ` Rob Herring
2020-04-02 18:07   ` Florian Fainelli
2020-04-03 16:21     ` Hsin-Yi Wang

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).