Hi Fabio,
Just responded to the patch posted by you. For i.MX6D I will check with the hardware IP team. As mentioned in the earlier thread we will be passing the entropy delay value via device tree property.
Regards
Varun
> -----Original Message-----
> From: Fabio Estevam <[email protected]>
> Sent: Saturday, April 16, 2022 8:04 PM
> To: Herbert Xu <[email protected]>
> Cc: Horia Geanta <[email protected]>; Gaurav Jain
> <[email protected]>; Varun Sethi <[email protected]>; open list:HARDWARE
> RANDOM NUMBER GENERATOR CORE <[email protected]>; Fabio
> Estevam <[email protected]>
> Subject: [EXT] Re: [PATCH v2] crypto: caam - fix i.MX6SX entropy delay value
>
> Caution: EXT Email
>
> Hi Horia and Varun,
>
> On Sat, Apr 16, 2022 at 10:54 AM Fabio Estevam <[email protected]> wrote:
> >
> > From: Fabio Estevam <[email protected]>
> >
> > Since commit 358ba762d9f1 ("crypto: caam - enable prediction
> > resistance in HRWNG") the following CAAM errors can be seen on i.MX6SX:
> >
> > caam_jr 2101000.jr: 20003c5b: CCB: desc idx 60: RNG: Hardware error
> > hwrng: no data available
> > caam_jr 2101000.jr: 20003c5b: CCB: desc idx 60: RNG: Hardware error
> > ...
> >
> > This error is due to an incorrect entropy delay for i.MX6SX.
> >
> > Fix it by increasing the minimum entropy delay for i.MX6SX as done in
> > U-Boot:
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc
> >
> hwork.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20220415111049.2565744-
> 1-
> >
> gaurav.jain%40nxp.com%2F&data=04%7C01%7CV.Sethi%40nxp.com%7C9
> 6c829
> >
> a14c394eb5e20508da1fb62811%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0
> %7C1%
> >
> 7C637857164474600314%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwM
> DAiLCJQI
> >
> joiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=jKZQyH0q
> Z50
> > rZhRV6%2FtOgkacpQZ9pZnwo6dLEkMUARs%3D&reserved=0
> >
> > Signed-off-by: Fabio Estevam <[email protected]>
> > ---
> > Change since v1:
> > - Align the fix with U-Boot.
>
> Actually, after thinking more about it, I realize that this issue is not i.MX6SX
> specific as I have seen reports of the same failures on i.MX6D as well.
>
> Would it make sense to fix it like this instead?
>
> --- a/drivers/crypto/caam/regs.h
> +++ b/drivers/crypto/caam/regs.h
> @@ -516,7 +516,7 @@ struct rng4tst {
> };
> #define RTSDCTL_ENT_DLY_SHIFT 16
> #define RTSDCTL_ENT_DLY_MASK (0xffff << RTSDCTL_ENT_DLY_SHIFT) -
> #define RTSDCTL_ENT_DLY_MIN 3200
> +#define RTSDCTL_ENT_DLY_MIN 12000
> #define RTSDCTL_ENT_DLY_MAX 12800
> u32 rtsdctl; /* seed control register */
> union {
>
> Any drawbacks in using this generic approach?
>
> Please advise.