[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210104114814.5e1fe218@slackpad.fritz.box>
Date: Mon, 4 Jan 2021 11:49:54 +0000
From: Andre Przywara <andre.przywara@....com>
To: Mark Brown <broonie@...nel.org>
Cc: Will Deacon <will@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Ard Biesheuvel <ardb@...nel.org>,
Russell King <linux@...linux.org.uk>,
Marc Zyngier <maz@...nel.org>, Theodore Ts'o <tytso@....edu>,
Sudeep Holla <sudeep.holla@....com>,
Mark Rutland <mark.rutland@....com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Linus Walleij <linus.walleij@...aro.org>,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 4/5] arm64: Add support for SMCCC TRNG entropy source
On Fri, 11 Dec 2020 16:26:12 +0000
Mark Brown <broonie@...nel.org> 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
Powered by blists - more mailing lists