From patchwork Thu Sep 5 15:28:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2854155 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 2C1959F557 for ; Thu, 5 Sep 2013 15:29:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EDEFB2046F for ; Thu, 5 Sep 2013 15:29:49 +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 A76AF2046B for ; Thu, 5 Sep 2013 15:29:48 +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 1VHbVC-0006pY-7S; Thu, 05 Sep 2013 15:29:46 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VHbV9-0004mc-VL; Thu, 05 Sep 2013 15:29:43 +0000 Received: from mail-ea0-f171.google.com ([209.85.215.171]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VHbV7-0004lI-Id for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2013 15:29:42 +0000 Received: by mail-ea0-f171.google.com with SMTP id n15so989670ead.16 for ; Thu, 05 Sep 2013 08:29:13 -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=gQT2xAHfaM1HdMH4H6ZBm/8+eRfKs30g501bIdfWte0=; b=nH9/ILOHFYEKcQpPi0C8ERuB6qpahQmUBVmO0kLIBzKv+aErzo4rFtE+w78loBRN9x uX8x3QAbOwnC4ClfpCEoS9J0vWtP9fvaipAntNp9bfOyMDnfWqz/l2aqrULvTc3jik43 wvYKwcKfmrTwmSA/2Z777NsLDvOqpjM9qhdfVScW3VACevPFRr4BbQSvEkDHaO0+M5FO 1mKVoWEh/OoXfRhMURolWfkGobVT2NK1Zfnhs4AQd1tTS7d/99bifB8D64u/4lqH84EO zKxCEpOMwPInm8fNsDPDomO6QbQPph4APhd3dEr0hbZuCVtTJ+nbrqFkZbMg8lZLNshI Uzkw== X-Gm-Message-State: ALoCoQkHl/3QyZBqvbBMXrW+lJUTicjQ8BU1R0tRWt/6rGMxUiShwvAAg6yxS+aAi5kJJLG3vZg+ X-Received: by 10.15.35.196 with SMTP id g44mr14302200eev.18.1378394953026; Thu, 05 Sep 2013 08:29:13 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id d8sm49547847eeh.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 05 Sep 2013 08:29:12 -0700 (PDT) From: Linus Walleij To: Stephen Warren , linux-tegra@vger.kernel.org Subject: [PATCH] ARM: tegra: throw the unique chip ID into the entropy pool Date: Thu, 5 Sep 2013 17:28:58 +0200 Message-Id: <1378394938-1551-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130905_112941_725468_58405AF2 X-CRM114-Status: GOOD ( 12.27 ) X-Spam-Score: -2.6 (--) Cc: Linus Walleij , 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 This adds a hook at common late init to extract the 64 bits of chip-unique data and throw it into the entropy pool to make it more device-unique. Signed-off-by: Linus Walleij --- Stephen: since I don't have the Tegra reference manual I don't know what "UID" means, but if it means "unique ID" then this patch should be relevant for initializing the entropy pool. --- arch/arm/mach-tegra/common.c | 1 + arch/arm/mach-tegra/fuse.c | 9 +++++++++ arch/arm/mach-tegra/fuse.h | 1 + 3 files changed, 11 insertions(+) diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 94a119a..c1ab5f5 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c @@ -109,6 +109,7 @@ void __init tegra_init_early(void) void __init tegra_init_late(void) { + tegra_random_init(); tegra_init_suspend(); tegra_cpuidle_init(); tegra_powergate_debugfs_init(); diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c index e035cd2..16673de 100644 --- a/arch/arm/mach-tegra/fuse.c +++ b/arch/arm/mach-tegra/fuse.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "fuse.h" #include "iomap.h" @@ -165,3 +166,11 @@ unsigned long long tegra_chip_uid(void) return (hi << 32ull) | lo; } EXPORT_SYMBOL(tegra_chip_uid); + +void __init tegra_random_init(void) +{ + unsigned long long uid; + + uid = tegra_chip_uid(); + add_device_randomness(&uid, sizeof(uid)); +} diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h index def7968..559d101 100644 --- a/arch/arm/mach-tegra/fuse.h +++ b/arch/arm/mach-tegra/fuse.h @@ -55,6 +55,7 @@ unsigned long long tegra_chip_uid(void); void tegra_init_fuse(void); bool tegra_spare_fuse(int bit); u32 tegra_fuse_readl(unsigned long offset); +void tegra_random_init(void); #ifdef CONFIG_ARCH_TEGRA_2x_SOC void tegra20_init_speedo_data(void);