From patchwork Thu Sep 5 07:29:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2853950 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CECDE9F495 for ; Thu, 5 Sep 2013 07:29:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBDC420372 for ; Thu, 5 Sep 2013 07:29:57 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD15E20371 for ; Thu, 5 Sep 2013 07:29:56 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VHU0o-0002yB-K7; Thu, 05 Sep 2013 07:29:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VHU0m-0001lt-CJ; Thu, 05 Sep 2013 07:29:52 +0000 Received: from mail-la0-f47.google.com ([209.85.215.47]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VHU0j-0001kh-JU for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2013 07:29:50 +0000 Received: by mail-la0-f47.google.com with SMTP id eo20so1244856lab.34 for ; Thu, 05 Sep 2013 00:29:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=P5NGnweQY7jlEkcw/OFH1VD18zZxUTfXQR5ar/LfmXw=; b=iVcBKuylowdp8ZacFKpVglkPfAj71sy/mjC8W8qwWqsoPGtpJllhx0jlEDSCGW1SJI t4YPB9KwNs7ReEmrU1Mk7xTJJr0ii9w6C0Ti4JILMSfrmWtVeHVACcVdJBaHie8zwsTo tePIARlTk2BCZcPx2VdqIqI4RGkVR4sOxTldzcZQURbWcB1TD8HqTrmIjNYNmtufe8eb wzL1FZbL2WlYmyNhsIp+vZbdZIHI0AA/IelPM/roFlx4oZrVpeB0s2GEAv3pNetrUVoc nTgPXEKuZvaHFOVPDJbQ6ld5aHmuqAIQactqAglWg4gtaLjrrHphgZJ+qnLKvBYMs9qZ u+Kg== X-Gm-Message-State: ALoCoQl1P8EM9XRW5cmsE813IvuhbzkMoWPV8en+CAjJru6v+yTYhWMn0idHeZNZmIzmA7tSVxl0 X-Received: by 10.152.22.227 with SMTP id h3mr197679laf.39.1378366167034; Thu, 05 Sep 2013 00:29:27 -0700 (PDT) Received: from localhost.localdomain (c83-249-210-224.bredband.comhem.se. [83.249.210.224]) by mx.google.com with ESMTPSA id u20sm12250354lbh.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 05 Sep 2013 00:29:26 -0700 (PDT) From: Linus Walleij To: Tony Lindgren Subject: [PATCH v2] ARM: omap2: throw the die id into the entropy pool Date: Thu, 5 Sep 2013 09:29:18 +0200 Message-Id: <1378366158-31183-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130905_032949_765843_CF9711C3 X-CRM114-Status: GOOD ( 12.83 ) X-Spam-Score: -2.6 (--) Cc: Linus Walleij , linux-omap@vger.kernel.org, Theodore Ts'o , Paul Walmsley , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Atleast eight bytes of this number are totally unique for the device it seems, so this is a perfect candidate for feeding the entropy pool. One byte more or less of constants does not matter so feed in the entire OID struct. Cc: Theodore Ts'o Cc: Paul Walmsley Reviewed-by: Kevin Hilman Signed-off-by: Linus Walleij Reviewed-by: Paul Walmsley --- ChangeLog v1->v2: - Use omap_device_initcall() to avoid calling on non-OMAPs. --- arch/arm/mach-omap2/id.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 2dc62a2..9260d09 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #ifdef CONFIG_SOC_BUS @@ -130,6 +131,17 @@ void omap_get_die_id(struct omap_die_id *odi) odi->id_3 = read_tap_reg(OMAP_TAP_DIE_ID_3); } +static int __init omap_feed_randpool(void) +{ + struct omap_die_id odi; + + /* Throw the die ID into the entropy pool at boot */ + omap_get_die_id(&odi); + add_device_randomness(&odi, sizeof(odi)); + return 0; +} +omap_device_initcall(omap_feed_randpool); + void __init omap2xxx_check_revision(void) { int i, j;