From: Mark Brown <broonie@kernel.org>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Theodore Ts'o <tytso@mit.edu>,
Catalin Marinas <catalin.marinas@arm.com>,
Linus Walleij <linus.walleij@linaro.org>,
Sudeep Holla <sudeep.holla@arm.com>,
linux-kernel@vger.kernel.org,
Russell King <linux@armlinux.org.uk>,
kvmarm@lists.cs.columbia.edu, Marc Zyngier <maz@kernel.org>,
Will Deacon <will@kernel.org>, Ard Biesheuvel <ardb@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 4/5] arm64: Add support for SMCCC TRNG entropy source
Date: Fri, 11 Dec 2020 16:26:12 +0000 [thread overview]
Message-ID: <20201211162612.GF4929@sirena.org.uk> (raw)
In-Reply-To: <20201211160005.187336-5-andre.przywara@arm.com>
[-- Attachment #1.1: Type: text/plain, Size: 1174 bytes --]
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.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-12-11 16:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 16:00 [PATCH v4 0/5] ARM: arm64: Add SMCCC TRNG entropy service Andre Przywara
2020-12-11 16:00 ` [PATCH v4 1/5] firmware: smccc: Add SMCCC TRNG function call IDs Andre Przywara
2020-12-11 17:29 ` Sudeep Holla
2020-12-11 16:00 ` [PATCH v4 2/5] firmware: smccc: Introduce SMCCC TRNG framework Andre Przywara
2020-12-11 17:31 ` Sudeep Holla
2020-12-11 16:00 ` [PATCH v4 3/5] ARM: implement support for SMCCC TRNG entropy source Andre Przywara
2020-12-11 16:00 ` [PATCH v4 4/5] arm64: Add " Andre Przywara
2020-12-11 16:26 ` Mark Brown [this message]
2021-01-04 11:49 ` Andre Przywara
2020-12-11 16:00 ` [PATCH v4 5/5] KVM: arm64: implement the TRNG hypervisor call Andre Przywara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201211162612.GF4929@sirena.org.uk \
--to=broonie@kernel.org \
--cc=andre.przywara@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lorenzo.pieralisi@arm.com \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=tytso@mit.edu \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).