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: 2853949 Return-Path: X-Original-To: patchwork-linux-omap@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 7AF839F495 for ; Thu, 5 Sep 2013 07:29:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6492A20372 for ; Thu, 5 Sep 2013 07:29:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 097D720371 for ; Thu, 5 Sep 2013 07:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761643Ab3IEH3a (ORCPT ); Thu, 5 Sep 2013 03:29:30 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:62120 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756968Ab3IEH33 (ORCPT ); Thu, 5 Sep 2013 03:29:29 -0400 Received: by mail-la0-f54.google.com with SMTP id ea20so1244784lab.13 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=kIFo2mvsIeHytSfp3iUOzG6ZXzeJy/y4QofbpGeLaoxXvUAYmsx3N0SRGZz7MPoJFM jEX09F4tmpQ2uYi1MDbbKv4bS/IYtZaruGBnYEKZEs79gdTwttVt2vjeUc2dqYgjoOmL EMVF9Qec7NXadyG6PuJrdcYXay90nj9zmcYA8NdRftlSNlMN5ThBEGBe3BzukLlGFgYD OQxoNLQ4ymLjwTrgotPp8H7sQpQ0TWl2o92t77OtF5AzI5T9ur7N2YhWolS2kx/wcciT Ikf3o5kGYDl9k5nze6ij8Cp+g3l7fw1Bxld2XR0jItaYzJiwKpfNRpHCNMNqxz3jAHlA f8OQ== X-Gm-Message-State: ALoCoQkZamftE+oMYg+ZXQ/4XcadJoUiMkcUd9EC6THqhMxE7d1c0hzZy9bgD/1MWv//cOxUl7vl 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 Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, Linus Walleij , Theodore Ts'o , Paul Walmsley 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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;