* [PATCH] powerpc: Feed entire flattened device tree into the random pool
@ 2013-07-25 2:51 ` Anton Blanchard
0 siblings, 0 replies; 13+ messages in thread
From: Anton Blanchard @ 2013-07-25 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Grant Likely, Rob Herring
Cc: linuxppc-dev, devicetree
We feed the entire DMI table into the random pool to provide
better random data during early boot, so do the same with the
flattened device tree.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
It might be worth doing this somewhere common, but the only place
I could find (unflatten_device_tree) is almost certainly too
early in the boot process.
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 63d051f..6914851 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -35,6 +35,7 @@
#include <linux/percpu.h>
#include <linux/memblock.h>
#include <linux/of_platform.h>
+#include <linux/random.h>
#include <asm/io.h>
#include <asm/paca.h>
#include <asm/prom.h>
@@ -752,3 +753,13 @@ void arch_setup_pdev_archdata(struct platform_device *pdev)
pdev->dev.dma_mask = &pdev->archdata.dma_mask;
set_dma_ops(&pdev->dev, &dma_direct_ops);
}
+
+/* Feed entire flattened device tree into the random pool */
+static int __init add_fdt_randomness(void)
+{
+ add_device_randomness(initial_boot_params,
+ initial_boot_params->totalsize);
+
+ return 0;
+}
+core_initcall(add_fdt_randomness);
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH] powerpc: Feed entire flattened device tree into the random pool
@ 2013-07-25 2:51 ` Anton Blanchard
0 siblings, 0 replies; 13+ messages in thread
From: Anton Blanchard @ 2013-07-25 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Grant Likely, Rob Herring
Cc: devicetree, linuxppc-dev
We feed the entire DMI table into the random pool to provide
better random data during early boot, so do the same with the
flattened device tree.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
It might be worth doing this somewhere common, but the only place
I could find (unflatten_device_tree) is almost certainly too
early in the boot process.
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 63d051f..6914851 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -35,6 +35,7 @@
#include <linux/percpu.h>
#include <linux/memblock.h>
#include <linux/of_platform.h>
+#include <linux/random.h>
#include <asm/io.h>
#include <asm/paca.h>
#include <asm/prom.h>
@@ -752,3 +753,13 @@ void arch_setup_pdev_archdata(struct platform_device *pdev)
pdev->dev.dma_mask = &pdev->archdata.dma_mask;
set_dma_ops(&pdev->dev, &dma_direct_ops);
}
+
+/* Feed entire flattened device tree into the random pool */
+static int __init add_fdt_randomness(void)
+{
+ add_device_randomness(initial_boot_params,
+ initial_boot_params->totalsize);
+
+ return 0;
+}
+core_initcall(add_fdt_randomness);
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: Feed entire flattened device tree into the random pool
2013-07-25 2:51 ` Anton Blanchard
@ 2013-07-25 3:17 ` Michael Ellerman
-1 siblings, 0 replies; 13+ messages in thread
From: Michael Ellerman @ 2013-07-25 3:17 UTC (permalink / raw)
To: Anton Blanchard
Cc: Benjamin Herrenschmidt, Paul Mackerras, Grant Likely,
Rob Herring, devicetree, linuxppc-dev
On Thu, Jul 25, 2013 at 12:51:22PM +1000, Anton Blanchard wrote:
>
> We feed the entire DMI table into the random pool to provide
> better random data during early boot, so do the same with the
> flattened device tree.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> It might be worth doing this somewhere common, but the only place
> I could find (unflatten_device_tree) is almost certainly too
> early in the boot process.
Nice.
But why not put the initcall in drivers/of/fdt.c, that way it's not
early but it's still common ?
cheers
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: Feed entire flattened device tree into the random pool
@ 2013-07-25 3:17 ` Michael Ellerman
0 siblings, 0 replies; 13+ messages in thread
From: Michael Ellerman @ 2013-07-25 3:17 UTC (permalink / raw)
To: Anton Blanchard
Cc: devicetree, Rob Herring, Paul Mackerras, Grant Likely, linuxppc-dev
On Thu, Jul 25, 2013 at 12:51:22PM +1000, Anton Blanchard wrote:
>
> We feed the entire DMI table into the random pool to provide
> better random data during early boot, so do the same with the
> flattened device tree.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> It might be worth doing this somewhere common, but the only place
> I could find (unflatten_device_tree) is almost certainly too
> early in the boot process.
Nice.
But why not put the initcall in drivers/of/fdt.c, that way it's not
early but it's still common ?
cheers
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] of: Feed entire flattened device tree into the random pool
2013-07-25 3:17 ` Michael Ellerman
@ 2013-07-25 4:30 ` Anton Blanchard
-1 siblings, 0 replies; 13+ messages in thread
From: Anton Blanchard @ 2013-07-25 4:30 UTC (permalink / raw)
To: Michael Ellerman
Cc: Benjamin Herrenschmidt, Paul Mackerras, Grant Likely,
Rob Herring, devicetree, linuxppc-dev
Hi Michael,
> But why not put the initcall in drivers/of/fdt.c, that way it's not
> early but it's still common ?
Good idea! How does this look? So long as it happens before
module_init(rand_initialize) we should be good.
Anton
--
We feed the entire DMI table into the random pool to provide
better random data during early boot, so do the same with the
flattened device tree.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
v2: move to drivers/of/fdt.c as suggested by Michael Ellerman
Index: b/drivers/of/fdt.c
===================================================================
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -17,6 +17,7 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/slab.h>
+#include <linux/random.h>
#include <asm/setup.h> /* for COMMAND_LINE_SIZE */
#ifdef CONFIG_PPC
@@ -714,3 +715,14 @@ void __init unflatten_device_tree(void)
}
#endif /* CONFIG_OF_EARLY_FLATTREE */
+
+/* Feed entire flattened device tree into the random pool */
+static int __init add_fdt_randomness(void)
+{
+ if (initial_boot_params)
+ add_device_randomness(initial_boot_params,
+ initial_boot_params->totalsize);
+
+ return 0;
+}
+core_initcall(add_fdt_randomness);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] of: Feed entire flattened device tree into the random pool
@ 2013-07-25 4:30 ` Anton Blanchard
0 siblings, 0 replies; 13+ messages in thread
From: Anton Blanchard @ 2013-07-25 4:30 UTC (permalink / raw)
To: Michael Ellerman
Cc: devicetree, Rob Herring, Paul Mackerras, Grant Likely, linuxppc-dev
Hi Michael,
> But why not put the initcall in drivers/of/fdt.c, that way it's not
> early but it's still common ?
Good idea! How does this look? So long as it happens before
module_init(rand_initialize) we should be good.
Anton
--
We feed the entire DMI table into the random pool to provide
better random data during early boot, so do the same with the
flattened device tree.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
v2: move to drivers/of/fdt.c as suggested by Michael Ellerman
Index: b/drivers/of/fdt.c
===================================================================
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -17,6 +17,7 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/slab.h>
+#include <linux/random.h>
#include <asm/setup.h> /* for COMMAND_LINE_SIZE */
#ifdef CONFIG_PPC
@@ -714,3 +715,14 @@ void __init unflatten_device_tree(void)
}
#endif /* CONFIG_OF_EARLY_FLATTREE */
+
+/* Feed entire flattened device tree into the random pool */
+static int __init add_fdt_randomness(void)
+{
+ if (initial_boot_params)
+ add_device_randomness(initial_boot_params,
+ initial_boot_params->totalsize);
+
+ return 0;
+}
+core_initcall(add_fdt_randomness);
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] of: Feed entire flattened device tree into the random pool
2013-07-25 4:30 ` Anton Blanchard
@ 2013-07-25 4:42 ` David Gibson
-1 siblings, 0 replies; 13+ messages in thread
From: David Gibson @ 2013-07-25 4:42 UTC (permalink / raw)
To: Anton Blanchard
Cc: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Grant Likely, Rob Herring, devicetree, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 662 bytes --]
On Thu, Jul 25, 2013 at 02:30:31PM +1000, Anton Blanchard wrote:
>
> Hi Michael,
>
> > But why not put the initcall in drivers/of/fdt.c, that way it's not
> > early but it's still common ?
>
> Good idea! How does this look? So long as it happens before
> module_init(rand_initialize) we should be good.
This must be some strange new meaning of the word "random" of which I
was not previously aware. But I guess it's marginally better than
nothing.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] of: Feed entire flattened device tree into the random pool
@ 2013-07-25 4:42 ` David Gibson
0 siblings, 0 replies; 13+ messages in thread
From: David Gibson @ 2013-07-25 4:42 UTC (permalink / raw)
To: Anton Blanchard
Cc: devicetree, Rob Herring, Paul Mackerras, Grant Likely, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 662 bytes --]
On Thu, Jul 25, 2013 at 02:30:31PM +1000, Anton Blanchard wrote:
>
> Hi Michael,
>
> > But why not put the initcall in drivers/of/fdt.c, that way it's not
> > early but it's still common ?
>
> Good idea! How does this look? So long as it happens before
> module_init(rand_initialize) we should be good.
This must be some strange new meaning of the word "random" of which I
was not previously aware. But I guess it's marginally better than
nothing.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] of: Feed entire flattened device tree into the random pool
2013-07-25 4:30 ` Anton Blanchard
@ 2013-07-28 4:49 ` Grant Likely
-1 siblings, 0 replies; 13+ messages in thread
From: Grant Likely @ 2013-07-28 4:49 UTC (permalink / raw)
To: Anton Blanchard, Michael Ellerman
Cc: Benjamin Herrenschmidt, Paul Mackerras, Rob Herring, devicetree,
linuxppc-dev
On Thu, 25 Jul 2013 14:30:31 +1000, Anton Blanchard <anton@samba.org> wrote:
>
> Hi Michael,
>
> > But why not put the initcall in drivers/of/fdt.c, that way it's not
> > early but it's still common ?
>
> Good idea! How does this look? So long as it happens before
> module_init(rand_initialize) we should be good.
>
> Anton
> --
>
> We feed the entire DMI table into the random pool to provide
> better random data during early boot, so do the same with the
> flattened device tree.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> v2: move to drivers/of/fdt.c as suggested by Michael Ellerman
>
> Index: b/drivers/of/fdt.c
> ===================================================================
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -17,6 +17,7 @@
> #include <linux/string.h>
> #include <linux/errno.h>
> #include <linux/slab.h>
> +#include <linux/random.h>
>
> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */
> #ifdef CONFIG_PPC
> @@ -714,3 +715,14 @@ void __init unflatten_device_tree(void)
> }
>
> #endif /* CONFIG_OF_EARLY_FLATTREE */
> +
> +/* Feed entire flattened device tree into the random pool */
> +static int __init add_fdt_randomness(void)
> +{
> + if (initial_boot_params)
> + add_device_randomness(initial_boot_params,
> + initial_boot_params->totalsize);
be32_to_cpu(initial_boot_params->totalsize);
g.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] of: Feed entire flattened device tree into the random pool
@ 2013-07-28 4:49 ` Grant Likely
0 siblings, 0 replies; 13+ messages in thread
From: Grant Likely @ 2013-07-28 4:49 UTC (permalink / raw)
To: Anton Blanchard, Michael Ellerman
Cc: Paul Mackerras, linuxppc-dev, Rob Herring, devicetree
On Thu, 25 Jul 2013 14:30:31 +1000, Anton Blanchard <anton@samba.org> wrote:
>
> Hi Michael,
>
> > But why not put the initcall in drivers/of/fdt.c, that way it's not
> > early but it's still common ?
>
> Good idea! How does this look? So long as it happens before
> module_init(rand_initialize) we should be good.
>
> Anton
> --
>
> We feed the entire DMI table into the random pool to provide
> better random data during early boot, so do the same with the
> flattened device tree.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> v2: move to drivers/of/fdt.c as suggested by Michael Ellerman
>
> Index: b/drivers/of/fdt.c
> ===================================================================
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -17,6 +17,7 @@
> #include <linux/string.h>
> #include <linux/errno.h>
> #include <linux/slab.h>
> +#include <linux/random.h>
>
> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */
> #ifdef CONFIG_PPC
> @@ -714,3 +715,14 @@ void __init unflatten_device_tree(void)
> }
>
> #endif /* CONFIG_OF_EARLY_FLATTREE */
> +
> +/* Feed entire flattened device tree into the random pool */
> +static int __init add_fdt_randomness(void)
> +{
> + if (initial_boot_params)
> + add_device_randomness(initial_boot_params,
> + initial_boot_params->totalsize);
be32_to_cpu(initial_boot_params->totalsize);
g.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] of: Feed entire flattened device tree into the random pool
2013-07-28 4:49 ` Grant Likely
@ 2013-07-29 3:11 ` Anton Blanchard
-1 siblings, 0 replies; 13+ messages in thread
From: Anton Blanchard @ 2013-07-29 3:11 UTC (permalink / raw)
To: Grant Likely
Cc: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Rob Herring, devicetree, linuxppc-dev
Hi,
> be32_to_cpu(initial_boot_params->totalsize);
Ouch, thanks Grant.
Anton
--
We feed the entire DMI table into the random pool to provide
better random data during early boot, so do the same with the
flattened device tree.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
v3: Fix endian issues as noted by Grant
Index: b/drivers/of/fdt.c
===================================================================
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -17,6 +17,7 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/slab.h>
+#include <linux/random.h>
#include <asm/setup.h> /* for COMMAND_LINE_SIZE */
#ifdef CONFIG_PPC
@@ -714,3 +715,14 @@ void __init unflatten_device_tree(void)
}
#endif /* CONFIG_OF_EARLY_FLATTREE */
+
+/* Feed entire flattened device tree into the random pool */
+static int __init add_fdt_randomness(void)
+{
+ if (initial_boot_params)
+ add_device_randomness(initial_boot_params,
+ be32_to_cpu(initial_boot_params->totalsize));
+
+ return 0;
+}
+core_initcall(add_fdt_randomness);
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] of: Feed entire flattened device tree into the random pool
@ 2013-07-29 3:11 ` Anton Blanchard
0 siblings, 0 replies; 13+ messages in thread
From: Anton Blanchard @ 2013-07-29 3:11 UTC (permalink / raw)
To: Grant Likely; +Cc: devicetree, Rob Herring, Paul Mackerras, linuxppc-dev
Hi,
> be32_to_cpu(initial_boot_params->totalsize);
Ouch, thanks Grant.
Anton
--
We feed the entire DMI table into the random pool to provide
better random data during early boot, so do the same with the
flattened device tree.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
v3: Fix endian issues as noted by Grant
Index: b/drivers/of/fdt.c
===================================================================
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -17,6 +17,7 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/slab.h>
+#include <linux/random.h>
#include <asm/setup.h> /* for COMMAND_LINE_SIZE */
#ifdef CONFIG_PPC
@@ -714,3 +715,14 @@ void __init unflatten_device_tree(void)
}
#endif /* CONFIG_OF_EARLY_FLATTREE */
+
+/* Feed entire flattened device tree into the random pool */
+static int __init add_fdt_randomness(void)
+{
+ if (initial_boot_params)
+ add_device_randomness(initial_boot_params,
+ be32_to_cpu(initial_boot_params->totalsize));
+
+ return 0;
+}
+core_initcall(add_fdt_randomness);
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] of: Feed entire flattened device tree into the random pool
2013-07-29 3:11 ` Anton Blanchard
(?)
@ 2013-08-29 20:47 ` Grant Likely
-1 siblings, 0 replies; 13+ messages in thread
From: Grant Likely @ 2013-08-29 20:47 UTC (permalink / raw)
To: Anton Blanchard; +Cc: devicetree, Rob Herring, Paul Mackerras, linuxppc-dev
On Mon, 29 Jul 2013 13:11:50 +1000, Anton Blanchard <anton@samba.org> wrote:
>
> Hi,
>
> > be32_to_cpu(initial_boot_params->totalsize);
>
> Ouch, thanks Grant.
>
> Anton
> --
>
> We feed the entire DMI table into the random pool to provide
> better random data during early boot, so do the same with the
> flattened device tree.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
Applied, thanks
g.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-08-29 20:47 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-25 2:51 [PATCH] powerpc: Feed entire flattened device tree into the random pool Anton Blanchard
2013-07-25 2:51 ` Anton Blanchard
2013-07-25 3:17 ` Michael Ellerman
2013-07-25 3:17 ` Michael Ellerman
2013-07-25 4:30 ` [PATCH] of: " Anton Blanchard
2013-07-25 4:30 ` Anton Blanchard
2013-07-25 4:42 ` David Gibson
2013-07-25 4:42 ` David Gibson
2013-07-28 4:49 ` Grant Likely
2013-07-28 4:49 ` Grant Likely
2013-07-29 3:11 ` Anton Blanchard
2013-07-29 3:11 ` Anton Blanchard
2013-08-29 20:47 ` Grant Likely
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.