From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D2D8C433DB for ; Mon, 4 Jan 2021 11:52:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3CC7B221F9 for ; Mon, 4 Jan 2021 11:52:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CC7B221F9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TIflgnTLqqEiXOxLkRbPAueWNJhNauUmgYTmqgh2EvE=; b=qUXiLW0knD9Ye5AeTwAWfttt3 Pn+/eoZJGABhF4UOQkkOSEg1yzZZbDH6P/joMe4vANzT1mVpxFZPPIGqmAaLw28sZ4wAUNTNj6DCc N2Qh0m5B1cRoPH7aXIu34XBJTpJALePnK8hCMdF0EKdl+ZfPHNRfEOd46PbQun0Wc+X9XjNlNhimy fWqrjD+YTsYaWdQH37uG1a/IcruIymsBj8MNeXVaV/SrQgJdjZbs5tfJ5BkKcbfdzZAmAECEsDiQC 6SHMRuWegnxww3nGdyHHGowrvCfVN31vX3HIdyq3puowSGsJjWFtNQ/LfpiH+R/ZE2nAuISpCtd/B BVUo7CbEw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwONt-0008Ju-CR; Mon, 04 Jan 2021 11:50:49 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwONq-0008Ii-4T for linux-arm-kernel@lists.infradead.org; Mon, 04 Jan 2021 11:50:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F08B11FB; Mon, 4 Jan 2021 03:50:44 -0800 (PST) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 17E3F3F70D; Mon, 4 Jan 2021 03:50:42 -0800 (PST) Date: Mon, 4 Jan 2021 11:49:54 +0000 From: Andre Przywara To: Mark Brown Subject: Re: [PATCH v4 4/5] arm64: Add support for SMCCC TRNG entropy source Message-ID: <20210104114814.5e1fe218@slackpad.fritz.box> In-Reply-To: <20201211162612.GF4929@sirena.org.uk> References: <20201211160005.187336-1-andre.przywara@arm.com> <20201211160005.187336-5-andre.przywara@arm.com> <20201211162612.GF4929@sirena.org.uk> Organization: Arm Ltd. X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210104_065046_260404_1305A8DD X-CRM114-Status: GOOD ( 19.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Lorenzo Pieralisi , Theodore Ts'o , Catalin Marinas , Linus Walleij , Sudeep Holla , linux-kernel@vger.kernel.org, Russell King , kvmarm@lists.cs.columbia.edu, Marc Zyngier , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 11 Dec 2020 16:26:12 +0000 Mark Brown wrote: > On Fri, Dec 11, 2020 at 04:00:04PM +0000, Andre Przywara wrote: > > > static inline bool __must_check arch_get_random_seed_long(unsigned > > long *v) { > > + struct arm_smccc_res res; > > + > > + /* > > + * We prefer the SMCCC call, since its semantics (return > > actual > > + * hardware backed entropy) is closer to the idea behind > > this > > + * function here than what even the RNDRSS register > > provides > > + * (the output of a pseudo RNG freshly seeded by a TRNG). > > + */ > > This logic... > > > @@ -77,10 +117,20 @@ arch_get_random_seed_long_early(unsigned long > > *v) { > > WARN_ON(system_state != SYSTEM_BOOTING); > > > > - if (!__early_cpu_has_rndr()) > > - return false; > > + if (__early_cpu_has_rndr()) > > + return __arm64_rndr(v); > > + > > + if (smccc_trng_available) { > > + struct arm_smccc_res res; > > > > - return __arm64_rndr(v); > > + arm_smccc_1_1_invoke(ARM_SMCCC_TRNG_RND64, 64, > > &res); > > + if ((int)res.a0 >= 0) { > > + *v = res.a3; > > + return true; > > + } > > + } > > + > > + return false; > > ...seems to also apply here but we prefer the RNDR instead of the > SMCC. We probably want to either do the same thing or add a comment > saying what's going on. Argh, you are right, I missed to change this part as well. Will send a fixed and rebased v5 ASAP. Cheers, Andre _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel