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: 19777 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f200.google.com (mail-ye0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A4E3524869 for ; Thu, 5 Sep 2013 15:29:15 +0000 (UTC) Received: by mail-ye0-f200.google.com with SMTP id r3sf2005785yen.11 for ; Thu, 05 Sep 2013 08:29:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=gQT2xAHfaM1HdMH4H6ZBm/8+eRfKs30g501bIdfWte0=; b=VQFB3s+crnHoMVvBxJtDzA7oeAMrh9h5G3HKjkg4kvrEeZXlCIQeHAd7tP4yWcSfYD sfxdOUGtPE9QLiOxqa88CeBgfpALJ6vFHgqBc+SqhPUPr9dTqexlkbUnxRXa688M8shF ihBhisUrm7lsOxZeANr8fX+5XZ44G/v2P+h2ld6U/UxTY/exTwIY/Ar6lkiIyfG67/OK U5sba6tK8x92hayZMRhd3aM57+0nizK74hKACqC4ohTBTQODVikYxPbAu0c08H2HQfiG DWhK5teCLK/Ihh90QUQejRL0X3NTgwGhKhkT5am3ih0BgvgWRKnKqRtgOazgxy3lDc9n HPCA== X-Received: by 10.236.103.97 with SMTP id e61mr3312060yhg.31.1378394955093; Thu, 05 Sep 2013 08:29:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.116.135 with SMTP id jw7ls529925qeb.58.gmail; Thu, 05 Sep 2013 08:29:15 -0700 (PDT) X-Received: by 10.52.0.108 with SMTP id 12mr372337vdd.45.1378394955014; Thu, 05 Sep 2013 08:29:15 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id p7si5900261vdv.16.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Sep 2013 08:29:15 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id gd11so1237628vcb.5 for ; Thu, 05 Sep 2013 08:29:14 -0700 (PDT) X-Gm-Message-State: ALoCoQnftrUN0R9U6sKMYQc2qvVWTWfeVVv9U+70ZMIKSSUBAPtIEeV3IaPKcnkyzupoL+uguChb X-Received: by 10.58.97.238 with SMTP id ed14mr584522veb.34.1378394954938; Thu, 05 Sep 2013 08:29:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp286522vcz; Thu, 5 Sep 2013 08:29:14 -0700 (PDT) X-Received: by 10.14.194.131 with SMTP id m3mr14236207een.45.1378394953640; Thu, 05 Sep 2013 08:29:13 -0700 (PDT) Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) by mx.google.com with ESMTPS id k49si24284320een.112.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Sep 2013 08:29:13 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.53 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.83.53; Received: by mail-ee0-f53.google.com with SMTP id b15so1003578eek.12 for ; Thu, 05 Sep 2013 08:29:13 -0700 (PDT) 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 Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);