[PATCH 07/11] powerpc: Add support for microwatt's hardware random number generator
Michael Ellerman
mpe at ellerman.id.au
Wed Jun 16 23:16:02 AEST 2021
Nicholas Piggin <npiggin at gmail.com> writes:
> Excerpts from Paul Mackerras's message of June 15, 2021 9:02 am:
>> This is accessed using the DARN instruction and should probably be
>> done more generically.
>>
>> Signed-off-by: Paul Mackerras <paulus at ozlabs.org>
>> ---
>> arch/powerpc/include/asm/archrandom.h | 12 +++++-
>> arch/powerpc/platforms/microwatt/Kconfig | 1 +
>> arch/powerpc/platforms/microwatt/Makefile | 2 +-
>> arch/powerpc/platforms/microwatt/rng.c | 48 +++++++++++++++++++++++
>> 4 files changed, 61 insertions(+), 2 deletions(-)
>> create mode 100644 arch/powerpc/platforms/microwatt/rng.c
>>
>> diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h
>> index 9a53e29680f4..e8ae0f7740f9 100644
>> --- a/arch/powerpc/include/asm/archrandom.h
>> +++ b/arch/powerpc/include/asm/archrandom.h
>> @@ -8,12 +8,22 @@
>>
>> static inline bool __must_check arch_get_random_long(unsigned long *v)
>> {
>> + if (ppc_md.get_random_seed)
>> + return ppc_md.get_random_seed(v);
>> +
>> return false;
>> }
>>
>> static inline bool __must_check arch_get_random_int(unsigned int *v)
>> {
>> - return false;
>> + unsigned long val;
>> + bool rc;
>> +
>> + rc = arch_get_random_long(&val);
>> + if (rc)
>> + *v = val;
>> +
>> + return rc;
>> }
>>
>
> I would be happier if you didn't change this (or at least put it in its
> own patch explaining why it's not going to slow down other platforms).
It would essentially be a revert of 01c9348c7620 ("powerpc: Use hardware
RNG for arch_get_random_seed_* not arch_get_random_*")
Which would be ironic :)
cheers
More information about the Linuxppc-dev
mailing list