RE: [PATCH v2 2/3] hwrng: starfive - Add TRNG driver for StarFive SoC

From: JiaJie Ho
Date: Sun Jan 08 2023 - 23:39:18 EST




> -----Original Message-----
> From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Sent: 9 January, 2023 12:00 PM
> To: JiaJie Ho <jiajie.ho@xxxxxxxxxxxxxxxx>
> Cc: Olivia Mackall <olivia@xxxxxxxxxxx>; Rob Herring <robh+dt@xxxxxxxxxx>;
> Krzysztof Kozlowski <krzysztof.kozlowski+dt@xxxxxxxxxx>; Emil Renner
> Berthing <kernel@xxxxxxxx>; Conor Dooley <conor.dooley@xxxxxxxxxxxxx>;
> linux-crypto@xxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; linux-riscv@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2 2/3] hwrng: starfive - Add TRNG driver for StarFive
> SoC
>
> On Mon, Jan 09, 2023 at 03:41:14AM +0000, JiaJie Ho wrote:
> >
> > The average wait time is around 20 microseconds.
> > I measured from writel cmd to wait_for_completion done.
>
> Do you know of an upper bound? E.g., if we limit it to 40us how many
> requests would fail on average?
>

I don't have the upper bound.
I ran the rngtest with 1000 blocks, none of the wait time exceeded 30us.

> Having a maximum delay of 40us would be OK with wait == 0. So you could
> implement it in a way such that if the wait time exceeded 40us then you
> return if wait == 0, otherwise you can wait longer.
>

I'll do this then.

Thanks
Jia Jie