All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
@ 2022-06-15 12:34 Gaurav Jain
  2022-06-15 12:40 ` Fabio Estevam
  2022-06-15 12:42 ` Stefano Babic
  0 siblings, 2 replies; 12+ messages in thread
From: Gaurav Jain @ 2022-06-15 12:34 UTC (permalink / raw)
  To: u-boot, Stefano Babic
  Cc: Peng Fan, Fabio Estevam, NXP i . MX U-Boot Team, Horia Geanta,
	Varun Sethi, Ye Li, Gaurav Jain

From: Ye Li <ye.li@nxp.com>

issue:
CAAM fails with key error when perform Modular Exponentiation
using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature
and output decrypted data processed by CAAM.

Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/crypto/fsl/fsl_rsa.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/crypto/fsl/fsl_rsa.c b/drivers/crypto/fsl/fsl_rsa.c
index 897ee855ea..335b7fe25a 100644
--- a/drivers/crypto/fsl/fsl_rsa.c
+++ b/drivers/crypto/fsl/fsl_rsa.c
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <cpu_func.h>
 #include <dm.h>
 #include <log.h>
 #include <asm/types.h>
@@ -36,12 +37,21 @@ int fsl_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
 
 	inline_cnstr_jobdesc_pkha_rsaexp(desc, &pkin, out, sig_len);
 
+	flush_dcache_range((ulong)sig, (ulong)sig + sig_len);
+	flush_dcache_range((ulong)prop->modulus, (ulong)(prop->modulus) + keylen);
+	flush_dcache_range((ulong)prop->public_exponent,
+			   (ulong)(prop->public_exponent) + prop->exp_len);
+	flush_dcache_range((ulong)desc, (ulong)desc + (sizeof(uint32_t) * MAX_CAAM_DESCSIZE));
+	flush_dcache_range((ulong)out, (ulong)out + sig_len);
+
 	ret = run_descriptor_jr(desc);
 	if (ret) {
 		debug("%s: RSA failed to verify: %d\n", __func__, ret);
 		return -EFAULT;
 	}
 
+	invalidate_dcache_range((ulong)out, (ulong)out + sig_len);
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-06-15 12:34 [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver Gaurav Jain
@ 2022-06-15 12:40 ` Fabio Estevam
  2022-06-15 12:45   ` [EXT] " Gaurav Jain
  2022-06-15 12:42 ` Stefano Babic
  1 sibling, 1 reply; 12+ messages in thread
From: Fabio Estevam @ 2022-06-15 12:40 UTC (permalink / raw)
  To: Gaurav Jain
  Cc: U-Boot-Denx, Stefano Babic, Peng Fan, NXP i . MX U-Boot Team,
	Horia Geanta, Varun Sethi, Ye Li

Hi Gaurav,

On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com> wrote:
>
> From: Ye Li <ye.li@nxp.com>
>
> issue:
> CAAM fails with key error when perform Modular Exponentiation
> using PKHA Block in CAAM
>
> Fix:
> add flush and invalidate dcache for keys, signature
> and output decrypted data processed by CAAM.
>
> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
> Signed-off-by: Ye Li <ye.li@nxp.com>
> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
> Acked-by: Peng Fan <peng.fan@nxp.com>
> ---

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-06-15 12:34 [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver Gaurav Jain
  2022-06-15 12:40 ` Fabio Estevam
@ 2022-06-15 12:42 ` Stefano Babic
  1 sibling, 0 replies; 12+ messages in thread
From: Stefano Babic @ 2022-06-15 12:42 UTC (permalink / raw)
  To: Gaurav Jain, u-boot, Stefano Babic
  Cc: Peng Fan, Fabio Estevam, NXP i . MX U-Boot Team, Horia Geanta,
	Varun Sethi, Ye Li

Hi Gaurav,

thanks for fix, I will put into u-boot-imx and trigger a new CI.

Stefano

On 15.06.22 14:34, Gaurav Jain wrote:
> From: Ye Li <ye.li@nxp.com>
> 
> issue:
> CAAM fails with key error when perform Modular Exponentiation
> using PKHA Block in CAAM
> 
> Fix:
> add flush and invalidate dcache for keys, signature
> and output decrypted data processed by CAAM.
> 
> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
> Signed-off-by: Ye Li <ye.li@nxp.com>
> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
> Acked-by: Peng Fan <peng.fan@nxp.com>
> ---
>   drivers/crypto/fsl/fsl_rsa.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/crypto/fsl/fsl_rsa.c b/drivers/crypto/fsl/fsl_rsa.c
> index 897ee855ea..335b7fe25a 100644
> --- a/drivers/crypto/fsl/fsl_rsa.c
> +++ b/drivers/crypto/fsl/fsl_rsa.c
> @@ -6,6 +6,7 @@
>   
>   #include <config.h>
>   #include <common.h>
> +#include <cpu_func.h>
>   #include <dm.h>
>   #include <log.h>
>   #include <asm/types.h>
> @@ -36,12 +37,21 @@ int fsl_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
>   
>   	inline_cnstr_jobdesc_pkha_rsaexp(desc, &pkin, out, sig_len);
>   
> +	flush_dcache_range((ulong)sig, (ulong)sig + sig_len);
> +	flush_dcache_range((ulong)prop->modulus, (ulong)(prop->modulus) + keylen);
> +	flush_dcache_range((ulong)prop->public_exponent,
> +			   (ulong)(prop->public_exponent) + prop->exp_len);
> +	flush_dcache_range((ulong)desc, (ulong)desc + (sizeof(uint32_t) * MAX_CAAM_DESCSIZE));
> +	flush_dcache_range((ulong)out, (ulong)out + sig_len);
> +
>   	ret = run_descriptor_jr(desc);
>   	if (ret) {
>   		debug("%s: RSA failed to verify: %d\n", __func__, ret);
>   		return -EFAULT;
>   	}
>   
> +	invalidate_dcache_range((ulong)out, (ulong)out + sig_len);
> +
>   	return 0;
>   }
>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-06-15 12:40 ` Fabio Estevam
@ 2022-06-15 12:45   ` Gaurav Jain
  2022-06-15 12:49     ` Stefano Babic
  0 siblings, 1 reply; 12+ messages in thread
From: Gaurav Jain @ 2022-06-15 12:45 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: U-Boot-Denx, Stefano Babic, Peng Fan, dl-uboot-imx, Horia Geanta,
	Varun Sethi, Ye Li

Hi Fabio

> -----Original Message-----
> From: Fabio Estevam <festevam@gmail.com>
> Sent: Wednesday, June 15, 2022 6:11 PM
> To: Gaurav Jain <gaurav.jain@nxp.com>
> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Stefano Babic <sbabic@denx.de>;
> Peng Fan <peng.fan@nxp.com>; dl-uboot-imx <uboot-imx@nxp.com>; Horia
> Geanta <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Ye Li
> <ye.li@nxp.com>
> Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
> 
> Caution: EXT Email
> 
> Hi Gaurav,
> 
> On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com> wrote:
> >
> > From: Ye Li <ye.li@nxp.com>
> >
> > issue:
> > CAAM fails with key error when perform Modular Exponentiation using
> > PKHA Block in CAAM
> >
> > Fix:
> > add flush and invalidate dcache for keys, signature and output
> > decrypted data processed by CAAM.
> >
> > Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
> > Signed-off-by: Ye Li <ye.li@nxp.com>
> > Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
> > Acked-by: Peng Fan <peng.fan@nxp.com>
> > ---
> 
> Please always explain what changed in the current version of the patch.
> 
> I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c
I will send a different patch for the error reported by you.

Regards
Gaurav Jain

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-06-15 12:45   ` [EXT] " Gaurav Jain
@ 2022-06-15 12:49     ` Stefano Babic
  2022-06-29  7:06       ` Gaurav Jain
  0 siblings, 1 reply; 12+ messages in thread
From: Stefano Babic @ 2022-06-15 12:49 UTC (permalink / raw)
  To: Gaurav Jain, Fabio Estevam
  Cc: U-Boot-Denx, Peng Fan, dl-uboot-imx, Horia Geanta, Varun Sethi, Ye Li



On 15.06.22 14:45, Gaurav Jain wrote:
> Hi Fabio
> 
>> -----Original Message-----
>> From: Fabio Estevam <festevam@gmail.com>
>> Sent: Wednesday, June 15, 2022 6:11 PM
>> To: Gaurav Jain <gaurav.jain@nxp.com>
>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Stefano Babic <sbabic@denx.de>;
>> Peng Fan <peng.fan@nxp.com>; dl-uboot-imx <uboot-imx@nxp.com>; Horia
>> Geanta <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Ye Li
>> <ye.li@nxp.com>
>> Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
>>
>> Caution: EXT Email
>>
>> Hi Gaurav,
>>
>> On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com> wrote:
>>>
>>> From: Ye Li <ye.li@nxp.com>
>>>
>>> issue:
>>> CAAM fails with key error when perform Modular Exponentiation using
>>> PKHA Block in CAAM
>>>
>>> Fix:
>>> add flush and invalidate dcache for keys, signature and output
>>> decrypted data processed by CAAM.
>>>
>>> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
>>> Signed-off-by: Ye Li <ye.li@nxp.com>
>>> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
>>> Acked-by: Peng Fan <peng.fan@nxp.com>
>>> ---
>>
>> Please always explain what changed in the current version of the patch.
>>
>> I assume you fixed the build error found in CI, correct?
> 
> This is a different patch in fsl_rsa.c
> I will send a different patch for the error reported by you.

Ouch...I have misunderstood. Well, then I willwait for your patch..

Regards,
Stefano

> 
> Regards
> Gaurav Jain

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-06-15 12:49     ` Stefano Babic
@ 2022-06-29  7:06       ` Gaurav Jain
  2022-06-29  7:21         ` Stefano Babic
  0 siblings, 1 reply; 12+ messages in thread
From: Gaurav Jain @ 2022-06-29  7:06 UTC (permalink / raw)
  To: Stefano Babic, Fabio Estevam
  Cc: U-Boot-Denx, Peng Fan, dl-uboot-imx, Horia Geanta, Varun Sethi, Ye Li

Hi Stefano

This patch is put into state "changes requested".
But it is a different patch in fsl_rsa.
There is no change requested with this patch.

Regards
Gaurav Jain

> -----Original Message-----
> From: Stefano Babic <sbabic@denx.de>
> Sent: Wednesday, June 15, 2022 6:20 PM
> To: Gaurav Jain <gaurav.jain@nxp.com>; Fabio Estevam <festevam@gmail.com>
> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>; dl-
> uboot-imx <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>;
> Varun Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the
> driver
> 
> Caution: EXT Email
> 
> On 15.06.22 14:45, Gaurav Jain wrote:
> > Hi Fabio
> >
> >> -----Original Message-----
> >> From: Fabio Estevam <festevam@gmail.com>
> >> Sent: Wednesday, June 15, 2022 6:11 PM
> >> To: Gaurav Jain <gaurav.jain@nxp.com>
> >> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Stefano Babic
> >> <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>; dl-uboot-imx
> >> <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>; Varun Sethi
> >> <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
> >> Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue
> >> in the driver
> >>
> >> Caution: EXT Email
> >>
> >> Hi Gaurav,
> >>
> >> On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com> wrote:
> >>>
> >>> From: Ye Li <ye.li@nxp.com>
> >>>
> >>> issue:
> >>> CAAM fails with key error when perform Modular Exponentiation using
> >>> PKHA Block in CAAM
> >>>
> >>> Fix:
> >>> add flush and invalidate dcache for keys, signature and output
> >>> decrypted data processed by CAAM.
> >>>
> >>> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
> >>> Signed-off-by: Ye Li <ye.li@nxp.com>
> >>> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
> >>> Acked-by: Peng Fan <peng.fan@nxp.com>
> >>> ---
> >>
> >> Please always explain what changed in the current version of the patch.
> >>
> >> I assume you fixed the build error found in CI, correct?
> >
> > This is a different patch in fsl_rsa.c I will send a different patch
> > for the error reported by you.
> 
> Ouch...I have misunderstood. Well, then I willwait for your patch..
> 
> Regards,
> Stefano
> 
> >
> > Regards
> > Gaurav Jain

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-06-29  7:06       ` Gaurav Jain
@ 2022-06-29  7:21         ` Stefano Babic
  2022-06-29  8:35           ` Gaurav Jain
  0 siblings, 1 reply; 12+ messages in thread
From: Stefano Babic @ 2022-06-29  7:21 UTC (permalink / raw)
  To: Gaurav Jain, Stefano Babic, Fabio Estevam
  Cc: U-Boot-Denx, Peng Fan, dl-uboot-imx, Horia Geanta, Varun Sethi, Ye Li

Hi Gaurav,

On 29.06.22 09:06, Gaurav Jain wrote:
> Hi Stefano
> 
> This patch is put into state "changes requested".
> But it is a different patch in fsl_rsa.
> There is no change requested with this patch.
> 

Something went wrong - I have applied this patch to push to 2022.07, but 
in CI I get the same errors I found before, that is PowerPC build was 
broken:


https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/457090

I hadn't time to check this, and I suppose that issue is not yet fixed 
and I drop the patch from MR (Layerscape is broken, too), that is V3 has 
not fixed CI as in V2. Or is there anothe rpatch I had to pick up ?

Best regards,
Stefano



> Regards
> Gaurav Jain
> 
>> -----Original Message-----
>> From: Stefano Babic <sbabic@denx.de>
>> Sent: Wednesday, June 15, 2022 6:20 PM
>> To: Gaurav Jain <gaurav.jain@nxp.com>; Fabio Estevam <festevam@gmail.com>
>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>; dl-
>> uboot-imx <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>;
>> Varun Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
>> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the
>> driver
>>
>> Caution: EXT Email
>>
>> On 15.06.22 14:45, Gaurav Jain wrote:
>>> Hi Fabio
>>>
>>>> -----Original Message-----
>>>> From: Fabio Estevam <festevam@gmail.com>
>>>> Sent: Wednesday, June 15, 2022 6:11 PM
>>>> To: Gaurav Jain <gaurav.jain@nxp.com>
>>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Stefano Babic
>>>> <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>; dl-uboot-imx
>>>> <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>; Varun Sethi
>>>> <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
>>>> Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue
>>>> in the driver
>>>>
>>>> Caution: EXT Email
>>>>
>>>> Hi Gaurav,
>>>>
>>>> On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com> wrote:
>>>>>
>>>>> From: Ye Li <ye.li@nxp.com>
>>>>>
>>>>> issue:
>>>>> CAAM fails with key error when perform Modular Exponentiation using
>>>>> PKHA Block in CAAM
>>>>>
>>>>> Fix:
>>>>> add flush and invalidate dcache for keys, signature and output
>>>>> decrypted data processed by CAAM.
>>>>>
>>>>> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
>>>>> Signed-off-by: Ye Li <ye.li@nxp.com>
>>>>> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
>>>>> Acked-by: Peng Fan <peng.fan@nxp.com>
>>>>> ---
>>>>
>>>> Please always explain what changed in the current version of the patch.
>>>>
>>>> I assume you fixed the build error found in CI, correct?
>>>
>>> This is a different patch in fsl_rsa.c I will send a different patch
>>> for the error reported by you.
>>
>> Ouch...I have misunderstood. Well, then I willwait for your patch..
>>
>> Regards,
>> Stefano
>>
>>>
>>> Regards
>>> Gaurav Jain


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-06-29  7:21         ` Stefano Babic
@ 2022-06-29  8:35           ` Gaurav Jain
  2022-06-29  9:02             ` Stefano Babic
  2022-07-26  9:25             ` Stefano Babic
  0 siblings, 2 replies; 12+ messages in thread
From: Gaurav Jain @ 2022-06-29  8:35 UTC (permalink / raw)
  To: Stefano Babic, Fabio Estevam
  Cc: U-Boot-Denx, Peng Fan, dl-uboot-imx, Horia Geanta, Varun Sethi, Ye Li

Hi Stefano

this patch is fixing dcache issue in fsl_rsa.c

Error reported is in drivers/crypto/fsl/fsl_hash.c
addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);

reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in flush dcache
http://patchwork.ozlabs.org/project/uboot/patch/20220616101009.809953-1-gaurav.jain@nxp.com/

Regards
Gaurav Jain

> -----Original Message-----
> From: Stefano Babic <sbabic@denx.de>
> Sent: Wednesday, June 29, 2022 12:51 PM
> To: Gaurav Jain <gaurav.jain@nxp.com>; Stefano Babic <sbabic@denx.de>;
> Fabio Estevam <festevam@gmail.com>
> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>; dl-
> uboot-imx <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>;
> Varun Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the
> driver
> 
> Caution: EXT Email
> 
> Hi Gaurav,
> 
> On 29.06.22 09:06, Gaurav Jain wrote:
> > Hi Stefano
> >
> > This patch is put into state "changes requested".
> > But it is a different patch in fsl_rsa.
> > There is no change requested with this patch.
> >
> 
> Something went wrong - I have applied this patch to push to 2022.07, but in CI I
> get the same errors I found before, that is PowerPC build was
> broken:
> 
> 
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.d
> enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F-
> %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98808
> 23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0
> %7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
> wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C
> %7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%3D
> &amp;reserved=0
> 
> I hadn't time to check this, and I suppose that issue is not yet fixed and I drop the
> patch from MR (Layerscape is broken, too), that is V3 has not fixed CI as in V2.
> Or is there anothe rpatch I had to pick up ?
> 
> Best regards,
> Stefano
> 
> 
> 
> > Regards
> > Gaurav Jain
> >
> >> -----Original Message-----
> >> From: Stefano Babic <sbabic@denx.de>
> >> Sent: Wednesday, June 15, 2022 6:20 PM
> >> To: Gaurav Jain <gaurav.jain@nxp.com>; Fabio Estevam
> >> <festevam@gmail.com>
> >> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>;
> >> dl- uboot-imx <uboot-imx@nxp.com>; Horia Geanta
> >> <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Ye Li
> >> <ye.li@nxp.com>
> >> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache
> >> issue in the driver
> >>
> >> Caution: EXT Email
> >>
> >> On 15.06.22 14:45, Gaurav Jain wrote:
> >>> Hi Fabio
> >>>
> >>>> -----Original Message-----
> >>>> From: Fabio Estevam <festevam@gmail.com>
> >>>> Sent: Wednesday, June 15, 2022 6:11 PM
> >>>> To: Gaurav Jain <gaurav.jain@nxp.com>
> >>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Stefano Babic
> >>>> <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>; dl-uboot-imx
> >>>> <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>; Varun
> >>>> Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
> >>>> Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue
> >>>> in the driver
> >>>>
> >>>> Caution: EXT Email
> >>>>
> >>>> Hi Gaurav,
> >>>>
> >>>> On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com>
> wrote:
> >>>>>
> >>>>> From: Ye Li <ye.li@nxp.com>
> >>>>>
> >>>>> issue:
> >>>>> CAAM fails with key error when perform Modular Exponentiation
> >>>>> using PKHA Block in CAAM
> >>>>>
> >>>>> Fix:
> >>>>> add flush and invalidate dcache for keys, signature and output
> >>>>> decrypted data processed by CAAM.
> >>>>>
> >>>>> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
> >>>>> Signed-off-by: Ye Li <ye.li@nxp.com>
> >>>>> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
> >>>>> Acked-by: Peng Fan <peng.fan@nxp.com>
> >>>>> ---
> >>>>
> >>>> Please always explain what changed in the current version of the patch.
> >>>>
> >>>> I assume you fixed the build error found in CI, correct?
> >>>
> >>> This is a different patch in fsl_rsa.c I will send a different patch
> >>> for the error reported by you.
> >>
> >> Ouch...I have misunderstood. Well, then I willwait for your patch..
> >>
> >> Regards,
> >> Stefano
> >>
> >>>
> >>> Regards
> >>> Gaurav Jain
> 
> 
> --
> =================================================================
> ====
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
> =================================================================
> ====

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-06-29  8:35           ` Gaurav Jain
@ 2022-06-29  9:02             ` Stefano Babic
  2022-07-26  9:25             ` Stefano Babic
  1 sibling, 0 replies; 12+ messages in thread
From: Stefano Babic @ 2022-06-29  9:02 UTC (permalink / raw)
  To: Gaurav Jain, Stefano Babic, Fabio Estevam
  Cc: U-Boot-Denx, Peng Fan, dl-uboot-imx, Horia Geanta, Varun Sethi, Ye Li

On 29.06.22 10:35, Gaurav Jain wrote:
> Hi Stefano
> 
> this patch is fixing dcache issue in fsl_rsa.c
> 
> Error reported is in drivers/crypto/fsl/fsl_hash.c
> addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);
> 
> reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in flush dcache
> http://patchwork.ozlabs.org/project/uboot/patch/20220616101009.809953-1-gaurav.jain@nxp.com/

Yes, and I have supposed to have merged this, too.

I will pick up again both and let CI runs.

Stefano

> 
> Regards
> Gaurav Jain
> 
>> -----Original Message-----
>> From: Stefano Babic <sbabic@denx.de>
>> Sent: Wednesday, June 29, 2022 12:51 PM
>> To: Gaurav Jain <gaurav.jain@nxp.com>; Stefano Babic <sbabic@denx.de>;
>> Fabio Estevam <festevam@gmail.com>
>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>; dl-
>> uboot-imx <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>;
>> Varun Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
>> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the
>> driver
>>
>> Caution: EXT Email
>>
>> Hi Gaurav,
>>
>> On 29.06.22 09:06, Gaurav Jain wrote:
>>> Hi Stefano
>>>
>>> This patch is put into state "changes requested".
>>> But it is a different patch in fsl_rsa.
>>> There is no change requested with this patch.
>>>
>>
>> Something went wrong - I have applied this patch to push to 2022.07, but in CI I
>> get the same errors I found before, that is PowerPC build was
>> broken:
>>
>>
>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.d
>> enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F-
>> %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98808
>> 23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0
>> %7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
>> wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C
>> %7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%3D
>> &amp;reserved=0
>>
>> I hadn't time to check this, and I suppose that issue is not yet fixed and I drop the
>> patch from MR (Layerscape is broken, too), that is V3 has not fixed CI as in V2.
>> Or is there anothe rpatch I had to pick up ?
>>
>> Best regards,
>> Stefano
>>
>>
>>
>>> Regards
>>> Gaurav Jain
>>>
>>>> -----Original Message-----
>>>> From: Stefano Babic <sbabic@denx.de>
>>>> Sent: Wednesday, June 15, 2022 6:20 PM
>>>> To: Gaurav Jain <gaurav.jain@nxp.com>; Fabio Estevam
>>>> <festevam@gmail.com>
>>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>;
>>>> dl- uboot-imx <uboot-imx@nxp.com>; Horia Geanta
>>>> <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Ye Li
>>>> <ye.li@nxp.com>
>>>> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache
>>>> issue in the driver
>>>>
>>>> Caution: EXT Email
>>>>
>>>> On 15.06.22 14:45, Gaurav Jain wrote:
>>>>> Hi Fabio
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Fabio Estevam <festevam@gmail.com>
>>>>>> Sent: Wednesday, June 15, 2022 6:11 PM
>>>>>> To: Gaurav Jain <gaurav.jain@nxp.com>
>>>>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Stefano Babic
>>>>>> <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>; dl-uboot-imx
>>>>>> <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>; Varun
>>>>>> Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
>>>>>> Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue
>>>>>> in the driver
>>>>>>
>>>>>> Caution: EXT Email
>>>>>>
>>>>>> Hi Gaurav,
>>>>>>
>>>>>> On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com>
>> wrote:
>>>>>>>
>>>>>>> From: Ye Li <ye.li@nxp.com>
>>>>>>>
>>>>>>> issue:
>>>>>>> CAAM fails with key error when perform Modular Exponentiation
>>>>>>> using PKHA Block in CAAM
>>>>>>>
>>>>>>> Fix:
>>>>>>> add flush and invalidate dcache for keys, signature and output
>>>>>>> decrypted data processed by CAAM.
>>>>>>>
>>>>>>> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
>>>>>>> Signed-off-by: Ye Li <ye.li@nxp.com>
>>>>>>> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
>>>>>>> Acked-by: Peng Fan <peng.fan@nxp.com>
>>>>>>> ---
>>>>>>
>>>>>> Please always explain what changed in the current version of the patch.
>>>>>>
>>>>>> I assume you fixed the build error found in CI, correct?
>>>>>
>>>>> This is a different patch in fsl_rsa.c I will send a different patch
>>>>> for the error reported by you.
>>>>
>>>> Ouch...I have misunderstood. Well, then I willwait for your patch..
>>>>
>>>> Regards,
>>>> Stefano
>>>>
>>>>>
>>>>> Regards
>>>>> Gaurav Jain
>>
>>
>> --
>> =================================================================
>> ====
>> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>> HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
>> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
>> =================================================================
>> ====


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-06-29  8:35           ` Gaurav Jain
  2022-06-29  9:02             ` Stefano Babic
@ 2022-07-26  9:25             ` Stefano Babic
  2022-07-29 10:11               ` Gaurav Jain
  1 sibling, 1 reply; 12+ messages in thread
From: Stefano Babic @ 2022-07-26  9:25 UTC (permalink / raw)
  To: Gaurav Jain, Stefano Babic, Fabio Estevam
  Cc: U-Boot-Denx, Peng Fan, dl-uboot-imx, Horia Geanta, Varun Sethi, Ye Li

Hi Gaurav,

On 29.06.22 10:35, Gaurav Jain wrote:
> Hi Stefano
> 
> this patch is fixing dcache issue in fsl_rsa.c
> 

The thread changed name, I mean "crypto/fsl: fsl_hash: Fix crash in 
flush dcache"

> Error reported is in drivers/crypto/fsl/fsl_hash.c
> addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);
> 
> reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in flush dcache
> http://patchwork.ozlabs.org/project/uboot/patch/20220616101009.809953-1-gaurav.jain@nxp.com/
> 

Give an another attempt, it fails and it is quite clear why:

+#ifdef CONFIG_CAAM_64BIT
+               addr = sec_in32(&ctx->sg_tbl[i].addr_hi);
+               addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);
+#else

Fine with ARM and ARM64. In Kconfig:

  config CAAM_64BIT
          bool
          default y if PHYS_64BIT && !ARCH_IMX8M && !ARCH_IMX8
          help
            Select Crypto driver for 64 bits CAAM version

That is ok until powerpc are built that sets PHYS_64BIT. Then build 
fails with:

   powerpc:  +   T4240RDB_SDCARD
+drivers/crypto/fsl/fsl_hash.c: In function 'caam_hash_finish':
+drivers/crypto/fsl/fsl_hash.c:151:30: error: left shift count >= width 
of type [-Werror=shift-count-overflow]
+  151 |                 addr = (addr << 32) | 
sec_in32(&ctx->sg_tbl[i].addr_lo);
+      |                              ^~
+cc1: all warnings being treated as errors

And well, compiler is right...

Best regards,
Stefano Babic


> Regards
> Gaurav Jain
> 
>> -----Original Message-----
>> From: Stefano Babic <sbabic@denx.de>
>> Sent: Wednesday, June 29, 2022 12:51 PM
>> To: Gaurav Jain <gaurav.jain@nxp.com>; Stefano Babic <sbabic@denx.de>;
>> Fabio Estevam <festevam@gmail.com>
>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>; dl-
>> uboot-imx <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>;
>> Varun Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
>> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the
>> driver
>>
>> Caution: EXT Email
>>
>> Hi Gaurav,
>>
>> On 29.06.22 09:06, Gaurav Jain wrote:
>>> Hi Stefano
>>>
>>> This patch is put into state "changes requested".
>>> But it is a different patch in fsl_rsa.
>>> There is no change requested with this patch.
>>>
>>
>> Something went wrong - I have applied this patch to push to 2022.07, but in CI I
>> get the same errors I found before, that is PowerPC build was
>> broken:
>>
>>
>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.d
>> enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F-
>> %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98808
>> 23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0
>> %7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
>> wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C
>> %7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%3D
>> &amp;reserved=0
>>
>> I hadn't time to check this, and I suppose that issue is not yet fixed and I drop the
>> patch from MR (Layerscape is broken, too), that is V3 has not fixed CI as in V2.
>> Or is there anothe rpatch I had to pick up ?
>>
>> Best regards,
>> Stefano
>>
>>
>>
>>> Regards
>>> Gaurav Jain
>>>
>>>> -----Original Message-----
>>>> From: Stefano Babic <sbabic@denx.de>
>>>> Sent: Wednesday, June 15, 2022 6:20 PM
>>>> To: Gaurav Jain <gaurav.jain@nxp.com>; Fabio Estevam
>>>> <festevam@gmail.com>
>>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>;
>>>> dl- uboot-imx <uboot-imx@nxp.com>; Horia Geanta
>>>> <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Ye Li
>>>> <ye.li@nxp.com>
>>>> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache
>>>> issue in the driver
>>>>
>>>> Caution: EXT Email
>>>>
>>>> On 15.06.22 14:45, Gaurav Jain wrote:
>>>>> Hi Fabio
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Fabio Estevam <festevam@gmail.com>
>>>>>> Sent: Wednesday, June 15, 2022 6:11 PM
>>>>>> To: Gaurav Jain <gaurav.jain@nxp.com>
>>>>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Stefano Babic
>>>>>> <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>; dl-uboot-imx
>>>>>> <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>; Varun
>>>>>> Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
>>>>>> Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue
>>>>>> in the driver
>>>>>>
>>>>>> Caution: EXT Email
>>>>>>
>>>>>> Hi Gaurav,
>>>>>>
>>>>>> On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com>
>> wrote:
>>>>>>>
>>>>>>> From: Ye Li <ye.li@nxp.com>
>>>>>>>
>>>>>>> issue:
>>>>>>> CAAM fails with key error when perform Modular Exponentiation
>>>>>>> using PKHA Block in CAAM
>>>>>>>
>>>>>>> Fix:
>>>>>>> add flush and invalidate dcache for keys, signature and output
>>>>>>> decrypted data processed by CAAM.
>>>>>>>
>>>>>>> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
>>>>>>> Signed-off-by: Ye Li <ye.li@nxp.com>
>>>>>>> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
>>>>>>> Acked-by: Peng Fan <peng.fan@nxp.com>
>>>>>>> ---
>>>>>>
>>>>>> Please always explain what changed in the current version of the patch.
>>>>>>
>>>>>> I assume you fixed the build error found in CI, correct?
>>>>>
>>>>> This is a different patch in fsl_rsa.c I will send a different patch
>>>>> for the error reported by you.
>>>>
>>>> Ouch...I have misunderstood. Well, then I willwait for your patch..
>>>>
>>>> Regards,
>>>> Stefano
>>>>
>>>>>
>>>>> Regards
>>>>> Gaurav Jain
>>
>>
>> --
>> =================================================================
>> ====
>> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>> HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
>> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
>> =================================================================
>> ====


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-07-26  9:25             ` Stefano Babic
@ 2022-07-29 10:11               ` Gaurav Jain
  2022-07-29 10:45                 ` Stefano Babic
  0 siblings, 1 reply; 12+ messages in thread
From: Gaurav Jain @ 2022-07-29 10:11 UTC (permalink / raw)
  To: Stefano Babic, Fabio Estevam
  Cc: U-Boot-Denx, Peng Fan, dl-uboot-imx, Horia Geanta, Varun Sethi, Ye Li

Hello Stefano

> -----Original Message-----
> From: Stefano Babic <sbabic@denx.de>
> Sent: Tuesday, July 26, 2022 2:55 PM
> To: Gaurav Jain <gaurav.jain@nxp.com>; Stefano Babic <sbabic@denx.de>;
> Fabio Estevam <festevam@gmail.com>
> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>; dl-
> uboot-imx <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>;
> Varun Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the
> driver
> 
> Caution: EXT Email
> 
> Hi Gaurav,
> 
> On 29.06.22 10:35, Gaurav Jain wrote:
> > Hi Stefano
> >
> > this patch is fixing dcache issue in fsl_rsa.c
> >
> 
> The thread changed name, I mean "crypto/fsl: fsl_hash: Fix crash in flush
> dcache"
> 
> > Error reported is in drivers/crypto/fsl/fsl_hash.c addr = (addr << 32)
> > | sec_in32(&ctx->sg_tbl[i].addr_lo);
> >
> > reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in
> > flush dcache
> > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
> > work.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20220616101009.809953-
> 1-ga
> >
> urav.jain%40nxp.com%2F&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C
> b605
> >
> e737d37a4237e8ba08da6ee8bf00%7C686ea1d3bc2b4c6fa92cd99c5c301635%7
> C0%7C
> >
> 0%7C637944243170612332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
> wMDAiLCJ
> >
> QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;s
> data=
> >
> KUAaTlucw6GRG7W2QvlE0JMO%2FAJt0tmi7%2FM3ZcpZ6C0%3D&amp;reserved
> =0
> >
> 
> Give an another attempt, it fails and it is quite clear why:
> 
> +#ifdef CONFIG_CAAM_64BIT
> +               addr = sec_in32(&ctx->sg_tbl[i].addr_hi);
> +               addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);
> +#else
> 
> Fine with ARM and ARM64. In Kconfig:
> 
>   config CAAM_64BIT
>           bool
>           default y if PHYS_64BIT && !ARCH_IMX8M && !ARCH_IMX8
>           help
>             Select Crypto driver for 64 bits CAAM version
> 
> That is ok until powerpc are built that sets PHYS_64BIT. Then build fails with:
> 
>    powerpc:  +   T4240RDB_SDCARD
> +drivers/crypto/fsl/fsl_hash.c: In function 'caam_hash_finish':
> +drivers/crypto/fsl/fsl_hash.c:151:30: error: left shift count >= width
> of type [-Werror=shift-count-overflow]
> +  151 |                 addr = (addr << 32) |
> sec_in32(&ctx->sg_tbl[i].addr_lo);
> +      |                              ^~
> +cc1: all warnings being treated as errors
> 
> And well, compiler is right...
I have sent a V4 which fixes the error for powerpc platforms.

Thanks
Gaurav Jain
> 
> Best regards,
> Stefano Babic
> 
> 
> > Regards
> > Gaurav Jain
> >
> >> -----Original Message-----
> >> From: Stefano Babic <sbabic@denx.de>
> >> Sent: Wednesday, June 29, 2022 12:51 PM
> >> To: Gaurav Jain <gaurav.jain@nxp.com>; Stefano Babic
> >> <sbabic@denx.de>; Fabio Estevam <festevam@gmail.com>
> >> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>;
> >> dl- uboot-imx <uboot-imx@nxp.com>; Horia Geanta
> >> <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Ye Li
> >> <ye.li@nxp.com>
> >> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache
> >> issue in the driver
> >>
> >> Caution: EXT Email
> >>
> >> Hi Gaurav,
> >>
> >> On 29.06.22 09:06, Gaurav Jain wrote:
> >>> Hi Stefano
> >>>
> >>> This patch is put into state "changes requested".
> >>> But it is a different patch in fsl_rsa.
> >>> There is no change requested with this patch.
> >>>
> >>
> >> Something went wrong - I have applied this patch to push to 2022.07,
> >> but in CI I get the same errors I found before, that is PowerPC build
> >> was
> >> broken:
> >>
> >>
> >> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsou
> >>
> rce.d%2F&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7Cb605e737d37a4
> 237e
> >>
> 8ba08da6ee8bf00%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637
> 94424
> >>
> 3170612332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi
> V2luMz
> >>
> IiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=uDXXo
> PFq2y
> >> L0RyoaEyrMCUFYCQ5M5CfwN6XQG6eM4DE%3D&amp;reserved=0
> >> enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F-
> >> %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98
> 808
> >>
> 23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0
> >> %7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM
> C4
> >>
> wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C
> >> %7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%
> 3D
> >> &amp;reserved=0
> >>
> >> I hadn't time to check this, and I suppose that issue is not yet
> >> fixed and I drop the patch from MR (Layerscape is broken, too), that is V3 has
> not fixed CI as in V2.
> >> Or is there anothe rpatch I had to pick up ?
> >>
> >> Best regards,
> >> Stefano
> >>
> >>
> >>
> >>> Regards
> >>> Gaurav Jain
> >>>
> >>>> -----Original Message-----
> >>>> From: Stefano Babic <sbabic@denx.de>
> >>>> Sent: Wednesday, June 15, 2022 6:20 PM
> >>>> To: Gaurav Jain <gaurav.jain@nxp.com>; Fabio Estevam
> >>>> <festevam@gmail.com>
> >>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan
> >>>> <peng.fan@nxp.com>;
> >>>> dl- uboot-imx <uboot-imx@nxp.com>; Horia Geanta
> >>>> <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Ye Li
> >>>> <ye.li@nxp.com>
> >>>> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache
> >>>> issue in the driver
> >>>>
> >>>> Caution: EXT Email
> >>>>
> >>>> On 15.06.22 14:45, Gaurav Jain wrote:
> >>>>> Hi Fabio
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Fabio Estevam <festevam@gmail.com>
> >>>>>> Sent: Wednesday, June 15, 2022 6:11 PM
> >>>>>> To: Gaurav Jain <gaurav.jain@nxp.com>
> >>>>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Stefano Babic
> >>>>>> <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>; dl-uboot-imx
> >>>>>> <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>; Varun
> >>>>>> Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
> >>>>>> Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache
> >>>>>> issue in the driver
> >>>>>>
> >>>>>> Caution: EXT Email
> >>>>>>
> >>>>>> Hi Gaurav,
> >>>>>>
> >>>>>> On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com>
> >> wrote:
> >>>>>>>
> >>>>>>> From: Ye Li <ye.li@nxp.com>
> >>>>>>>
> >>>>>>> issue:
> >>>>>>> CAAM fails with key error when perform Modular Exponentiation
> >>>>>>> using PKHA Block in CAAM
> >>>>>>>
> >>>>>>> Fix:
> >>>>>>> add flush and invalidate dcache for keys, signature and output
> >>>>>>> decrypted data processed by CAAM.
> >>>>>>>
> >>>>>>> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
> >>>>>>> Signed-off-by: Ye Li <ye.li@nxp.com>
> >>>>>>> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
> >>>>>>> Acked-by: Peng Fan <peng.fan@nxp.com>
> >>>>>>> ---
> >>>>>>
> >>>>>> Please always explain what changed in the current version of the patch.
> >>>>>>
> >>>>>> I assume you fixed the build error found in CI, correct?
> >>>>>
> >>>>> This is a different patch in fsl_rsa.c I will send a different
> >>>>> patch for the error reported by you.
> >>>>
> >>>> Ouch...I have misunderstood. Well, then I willwait for your patch..
> >>>>
> >>>> Regards,
> >>>> Stefano
> >>>>
> >>>>>
> >>>>> Regards
> >>>>> Gaurav Jain
> >>
> >>
> >> --
> >>
> =================================================================
> >> ====
> >> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> >> HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
> >> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
> >>
> =================================================================
> >> ====
> 
> 
> --
> =================================================================
> ====
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
> =================================================================
> ====

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver
  2022-07-29 10:11               ` Gaurav Jain
@ 2022-07-29 10:45                 ` Stefano Babic
  0 siblings, 0 replies; 12+ messages in thread
From: Stefano Babic @ 2022-07-29 10:45 UTC (permalink / raw)
  To: Gaurav Jain, Stefano Babic, Fabio Estevam
  Cc: U-Boot-Denx, Peng Fan, dl-uboot-imx, Horia Geanta, Varun Sethi, Ye Li

On 29.07.22 12:11, Gaurav Jain wrote:
> Hello Stefano
> 
>> -----Original Message-----
>> From: Stefano Babic <sbabic@denx.de>
>> Sent: Tuesday, July 26, 2022 2:55 PM
>> To: Gaurav Jain <gaurav.jain@nxp.com>; Stefano Babic <sbabic@denx.de>;
>> Fabio Estevam <festevam@gmail.com>
>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>; dl-
>> uboot-imx <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>;
>> Varun Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
>> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the
>> driver
>>
>> Caution: EXT Email
>>
>> Hi Gaurav,
>>
>> On 29.06.22 10:35, Gaurav Jain wrote:
>>> Hi Stefano
>>>
>>> this patch is fixing dcache issue in fsl_rsa.c
>>>
>>
>> The thread changed name, I mean "crypto/fsl: fsl_hash: Fix crash in flush
>> dcache"
>>
>>> Error reported is in drivers/crypto/fsl/fsl_hash.c addr = (addr << 32)
>>> | sec_in32(&ctx->sg_tbl[i].addr_lo);
>>>
>>> reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in
>>> flush dcache
>>> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
>>> work.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20220616101009.809953-
>> 1-ga
>>>
>> urav.jain%40nxp.com%2F&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C
>> b605
>>>
>> e737d37a4237e8ba08da6ee8bf00%7C686ea1d3bc2b4c6fa92cd99c5c301635%7
>> C0%7C
>>>
>> 0%7C637944243170612332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
>> wMDAiLCJ
>>>
>> QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;s
>> data=
>>>
>> KUAaTlucw6GRG7W2QvlE0JMO%2FAJt0tmi7%2FM3ZcpZ6C0%3D&amp;reserved
>> =0
>>>
>>
>> Give an another attempt, it fails and it is quite clear why:
>>
>> +#ifdef CONFIG_CAAM_64BIT
>> +               addr = sec_in32(&ctx->sg_tbl[i].addr_hi);
>> +               addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);
>> +#else
>>
>> Fine with ARM and ARM64. In Kconfig:
>>
>>    config CAAM_64BIT
>>            bool
>>            default y if PHYS_64BIT && !ARCH_IMX8M && !ARCH_IMX8
>>            help
>>              Select Crypto driver for 64 bits CAAM version
>>
>> That is ok until powerpc are built that sets PHYS_64BIT. Then build fails with:
>>
>>     powerpc:  +   T4240RDB_SDCARD
>> +drivers/crypto/fsl/fsl_hash.c: In function 'caam_hash_finish':
>> +drivers/crypto/fsl/fsl_hash.c:151:30: error: left shift count >= width
>> of type [-Werror=shift-count-overflow]
>> +  151 |                 addr = (addr << 32) |
>> sec_in32(&ctx->sg_tbl[i].addr_lo);
>> +      |                              ^~
>> +cc1: all warnings being treated as errors
>>
>> And well, compiler is right...
> I have sent a V4 which fixes the error for powerpc platforms.
> 

Thanks - I merge and I start a new CI.

Stefano

> Thanks
> Gaurav Jain
>>
>> Best regards,
>> Stefano Babic
>>
>>
>>> Regards
>>> Gaurav Jain
>>>
>>>> -----Original Message-----
>>>> From: Stefano Babic <sbabic@denx.de>
>>>> Sent: Wednesday, June 29, 2022 12:51 PM
>>>> To: Gaurav Jain <gaurav.jain@nxp.com>; Stefano Babic
>>>> <sbabic@denx.de>; Fabio Estevam <festevam@gmail.com>
>>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan <peng.fan@nxp.com>;
>>>> dl- uboot-imx <uboot-imx@nxp.com>; Horia Geanta
>>>> <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Ye Li
>>>> <ye.li@nxp.com>
>>>> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache
>>>> issue in the driver
>>>>
>>>> Caution: EXT Email
>>>>
>>>> Hi Gaurav,
>>>>
>>>> On 29.06.22 09:06, Gaurav Jain wrote:
>>>>> Hi Stefano
>>>>>
>>>>> This patch is put into state "changes requested".
>>>>> But it is a different patch in fsl_rsa.
>>>>> There is no change requested with this patch.
>>>>>
>>>>
>>>> Something went wrong - I have applied this patch to push to 2022.07,
>>>> but in CI I get the same errors I found before, that is PowerPC build
>>>> was
>>>> broken:
>>>>
>>>>
>>>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsou
>>>>
>> rce.d%2F&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7Cb605e737d37a4
>> 237e
>>>>
>> 8ba08da6ee8bf00%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637
>> 94424
>>>>
>> 3170612332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi
>> V2luMz
>>>>
>> IiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=uDXXo
>> PFq2y
>>>> L0RyoaEyrMCUFYCQ5M5CfwN6XQG6eM4DE%3D&amp;reserved=0
>>>> enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F-
>>>> %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98
>> 808
>>>>
>> 23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0
>>>> %7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM
>> C4
>>>>
>> wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C
>>>> %7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%
>> 3D
>>>> &amp;reserved=0
>>>>
>>>> I hadn't time to check this, and I suppose that issue is not yet
>>>> fixed and I drop the patch from MR (Layerscape is broken, too), that is V3 has
>> not fixed CI as in V2.
>>>> Or is there anothe rpatch I had to pick up ?
>>>>
>>>> Best regards,
>>>> Stefano
>>>>
>>>>
>>>>
>>>>> Regards
>>>>> Gaurav Jain
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Stefano Babic <sbabic@denx.de>
>>>>>> Sent: Wednesday, June 15, 2022 6:20 PM
>>>>>> To: Gaurav Jain <gaurav.jain@nxp.com>; Fabio Estevam
>>>>>> <festevam@gmail.com>
>>>>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Peng Fan
>>>>>> <peng.fan@nxp.com>;
>>>>>> dl- uboot-imx <uboot-imx@nxp.com>; Horia Geanta
>>>>>> <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>; Ye Li
>>>>>> <ye.li@nxp.com>
>>>>>> Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache
>>>>>> issue in the driver
>>>>>>
>>>>>> Caution: EXT Email
>>>>>>
>>>>>> On 15.06.22 14:45, Gaurav Jain wrote:
>>>>>>> Hi Fabio
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Fabio Estevam <festevam@gmail.com>
>>>>>>>> Sent: Wednesday, June 15, 2022 6:11 PM
>>>>>>>> To: Gaurav Jain <gaurav.jain@nxp.com>
>>>>>>>> Cc: U-Boot-Denx <u-boot@lists.denx.de>; Stefano Babic
>>>>>>>> <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>; dl-uboot-imx
>>>>>>>> <uboot-imx@nxp.com>; Horia Geanta <horia.geanta@nxp.com>; Varun
>>>>>>>> Sethi <V.Sethi@nxp.com>; Ye Li <ye.li@nxp.com>
>>>>>>>> Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache
>>>>>>>> issue in the driver
>>>>>>>>
>>>>>>>> Caution: EXT Email
>>>>>>>>
>>>>>>>> Hi Gaurav,
>>>>>>>>
>>>>>>>> On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <gaurav.jain@nxp.com>
>>>> wrote:
>>>>>>>>>
>>>>>>>>> From: Ye Li <ye.li@nxp.com>
>>>>>>>>>
>>>>>>>>> issue:
>>>>>>>>> CAAM fails with key error when perform Modular Exponentiation
>>>>>>>>> using PKHA Block in CAAM
>>>>>>>>>
>>>>>>>>> Fix:
>>>>>>>>> add flush and invalidate dcache for keys, signature and output
>>>>>>>>> decrypted data processed by CAAM.
>>>>>>>>>
>>>>>>>>> Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
>>>>>>>>> Signed-off-by: Ye Li <ye.li@nxp.com>
>>>>>>>>> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
>>>>>>>>> Acked-by: Peng Fan <peng.fan@nxp.com>
>>>>>>>>> ---
>>>>>>>>
>>>>>>>> Please always explain what changed in the current version of the patch.
>>>>>>>>
>>>>>>>> I assume you fixed the build error found in CI, correct?
>>>>>>>
>>>>>>> This is a different patch in fsl_rsa.c I will send a different
>>>>>>> patch for the error reported by you.
>>>>>>
>>>>>> Ouch...I have misunderstood. Well, then I willwait for your patch..
>>>>>>
>>>>>> Regards,
>>>>>> Stefano
>>>>>>
>>>>>>>
>>>>>>> Regards
>>>>>>> Gaurav Jain
>>>>
>>>>
>>>> --
>>>>
>> =================================================================
>>>> ====
>>>> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>>>> HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
>>>> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
>>>>
>> =================================================================
>>>> ====
>>
>>
>> --
>> =================================================================
>> ====
>> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>> HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
>> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
>> =================================================================
>> ====


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-07-29 10:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 12:34 [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver Gaurav Jain
2022-06-15 12:40 ` Fabio Estevam
2022-06-15 12:45   ` [EXT] " Gaurav Jain
2022-06-15 12:49     ` Stefano Babic
2022-06-29  7:06       ` Gaurav Jain
2022-06-29  7:21         ` Stefano Babic
2022-06-29  8:35           ` Gaurav Jain
2022-06-29  9:02             ` Stefano Babic
2022-07-26  9:25             ` Stefano Babic
2022-07-29 10:11               ` Gaurav Jain
2022-07-29 10:45                 ` Stefano Babic
2022-06-15 12:42 ` Stefano Babic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.