From: Anton Blanchard <hidden> Date: 2013-07-25 02:51:35
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 <redacted>
---
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.
@@ -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 */+staticint__initadd_fdt_randomness(void)+{+add_device_randomness(initial_boot_params,+initial_boot_params->totalsize);++return0;+}+core_initcall(add_fdt_randomness);
From: Michael Ellerman <hidden> Date: 2013-07-25 03:17:21
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 <redacted>
---
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
From: Anton Blanchard <hidden> Date: 2013-07-25 04:30:45
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 <redacted>
---
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 */+staticint__initadd_fdt_randomness(void)+{+if(initial_boot_params)+add_device_randomness(initial_boot_params,+initial_boot_params->totalsize);++return0;+}+core_initcall(add_fdt_randomness);
From: David Gibson <hidden> Date: 2013-07-25 04:52:02
On Thu, Jul 25, 2013 at 02:30:31PM +1000, Anton Blanchard wrote:
Hi Michael,
quoted
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
From: Grant Likely <hidden> Date: 2013-07-28 04:49:45
On Thu, 25 Jul 2013 14:30:31 +1000, Anton Blanchard [off-list ref] wrote:
quoted hunk
Hi Michael,
quoted
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 <redacted>
---
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 */+staticint__initadd_fdt_randomness(void)+{+if(initial_boot_params)+add_device_randomness(initial_boot_params,+initial_boot_params->totalsize);
From: Anton Blanchard <hidden> Date: 2013-07-29 03:12:06
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 <redacted>
---
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 */+staticint__initadd_fdt_randomness(void)+{+if(initial_boot_params)+add_device_randomness(initial_boot_params,+be32_to_cpu(initial_boot_params->totalsize));++return0;+}+core_initcall(add_fdt_randomness);
From: Grant Likely <hidden> Date: 2013-08-29 20:47:48
On Mon, 29 Jul 2013 13:11:50 +1000, Anton Blanchard [off-list ref] wrote:
Hi,
quoted
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 <redacted>