From patchwork Wed Sep 4 20:25:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2853844 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 60CB99F494 for ; Wed, 4 Sep 2013 20:25:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 858832051C for ; Wed, 4 Sep 2013 20:25:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E36CA20504 for ; Wed, 4 Sep 2013 20:25:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760382Ab3IDUZo (ORCPT ); Wed, 4 Sep 2013 16:25:44 -0400 Received: from mail-lb0-f171.google.com ([209.85.217.171]:52716 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760259Ab3IDUZn (ORCPT ); Wed, 4 Sep 2013 16:25:43 -0400 Received: by mail-lb0-f171.google.com with SMTP id u14so891892lbd.16 for ; Wed, 04 Sep 2013 13:25:42 -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=6o9+e5E69yC2WU9MFieGTXA19UOXi21x+AdroYuRq6g=; b=UeI8takVjg9GnJpzNt1+zz/pF5oe02jwZiafjejYY/T4upJyDn7uY/8jv/lf80BCxw 0S9gzgMwWKIl2z1lbnPblyxHiOHdhvIesH+8mlLZvmJP+o88XHL62z+3nyN7aanpNlR/ 6azteC1uRKWaiQLfhC3aiMRGA8m2d0EPQTEzmeCptnMznjXYmmM2XkU3wrqKd0wI2oRR W5VqHC8esh8d/kNHOhhVk5V0BTt0dybyPlut4GFT/pyWMCGFUvrixFqen0dsTuaJBtwM KCdLk6Z1MobpZnM4oB/UlJ1ZuJKOVcyLozAQkwGm5riZwaUheJjxKSfPmrbq/2ypvZk5 6dsA== X-Gm-Message-State: ALoCoQmmnEz2FXSzCTmzVTkwTplPITdHyE3gV0tAjVjtUv07RmWY1qrVZ0zxJIrrBTZrK20ibjkY X-Received: by 10.112.156.166 with SMTP id wf6mr3886271lbb.13.1378326342223; Wed, 04 Sep 2013 13:25:42 -0700 (PDT) Received: from localhost.localdomain (c83-249-208-223.bredband.comhem.se. [83.249.208.223]) by mx.google.com with ESMTPSA id ua4sm11383709lbb.17.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 04 Sep 2013 13:25:41 -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] ARM: omap2: throw the die id into the entropy pool Date: Wed, 4 Sep 2013 22:25:24 +0200 Message-Id: <1378326324-7170-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 Signed-off-by: Linus Walleij Reviewed-by: Kevin Hilman --- 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..fc03cc6 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; +} +device_initcall(omap_feed_randpool); + void __init omap2xxx_check_revision(void) { int i, j;