Re: [PATCH v2] crypto: caam - fix i.MX6SX entropy delay value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/16/2022 5:34 PM, Fabio Estevam wrote:
> Hi Horia and Varun,
> 
> On Sat, Apr 16, 2022 at 10:54 AM Fabio Estevam <festevam@xxxxxxxxx> wrote:
>>
>> From: Fabio Estevam <festevam@xxxxxxx>
>>
>> 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://patchwork.ozlabs.org/project/uboot/patch/20220415111049.2565744-1-gaurav.jain@xxxxxxx/
>>
>> Signed-off-by: Fabio Estevam <festevam@xxxxxxx>
>> ---
>> 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.
> 
Someone will need to check whether this solves the issue on i.MX6D,
the root cause might be different.

Besides this, as Varun said, we should check with the HW team,
such that the value used for entropy delay is optimal.
IOW we need TRNG characterization for i.MX6D.

> 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?
> 
One drawback is performance, not sure if there are others.

Horia



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux