From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org ([203.10.76.45]:50261 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753054Ab3GYCvf (ORCPT ); Wed, 24 Jul 2013 22:51:35 -0400 Date: Thu, 25 Jul 2013 12:51:22 +1000 From: Anton Blanchard Subject: [PATCH] powerpc: Feed entire flattened device tree into the random pool Message-ID: <20130725125122.78accf44@kryten> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: devicetree-owner@vger.kernel.org To: Benjamin Herrenschmidt , Paul Mackerras , Grant Likely , Rob Herring Cc: linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org List-ID: 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 --- 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 #include #include +#include #include #include #include @@ -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);