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

From: JiaJie Ho
Date: Sun Jan 08 2023 - 22:41:32 EST




> -----Original Message-----
> From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Sent: 9 January, 2023 11:04 AM
> 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 02:58:14AM +0000, JiaJie Ho wrote:
> >
> > My trng device requires sending a generate new number cmd before each
> read.
> > It then only populates the data registers with new random number and
> raise an interrupt when ready.
> > If user choose to not wait, they will always get stale bits.
> > Is it okay to always return error if wait=false ?
>
> What is the length of the wait time? Is there an upper bound?
> What is the average wait time?
>

The average wait time is around 20 microseconds.
I measured from writel cmd to wait_for_completion done.

Thanks
Jia Jie