* [PATCH] crypto: caam - use JobR's space to access page 0 regs
@ 2024-11-11 12:10 Gaurav Jain
2024-11-11 12:22 ` Ahmad Fatoum
0 siblings, 1 reply; 7+ messages in thread
From: Gaurav Jain @ 2024-11-11 12:10 UTC (permalink / raw)
To: Horia Geantă, Pankaj Gupta, Herbert Xu, David S . Miller,
Silvano Di Ninno, Varun Sethi, Meenakshi Aggarwal, Sahil Malhotra,
Nikolaus Voss, Ahmad Fatoum
Cc: =linux-crypto, linux-kernel, Gaurav Jain
Access to controller region is not permitted.
use JobR's register space to access page 0 registers.
Fixes: 6a83830f649a ("crypto: caam - warn if blob_gen key is insecure")
Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
---
drivers/crypto/caam/blob_gen.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/caam/blob_gen.c b/drivers/crypto/caam/blob_gen.c
index 87781c1534ee..079a22cc9f02 100644
--- a/drivers/crypto/caam/blob_gen.c
+++ b/drivers/crypto/caam/blob_gen.c
@@ -2,6 +2,7 @@
/*
* Copyright (C) 2015 Pengutronix, Steffen Trumtrar <kernel@pengutronix.de>
* Copyright (C) 2021 Pengutronix, Ahmad Fatoum <kernel@pengutronix.de>
+ * Copyright 2024 NXP
*/
#define pr_fmt(fmt) "caam blob_gen: " fmt
@@ -104,7 +105,7 @@ int caam_process_blob(struct caam_blob_priv *priv,
}
ctrlpriv = dev_get_drvdata(jrdev->parent);
- moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl->perfmon.status));
+ moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->jr[0]->perfmon.status));
if (moo != CSTA_MOO_SECURE && moo != CSTA_MOO_TRUSTED)
dev_warn(jrdev,
"using insecure test key, enable HAB to use unique device key!\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] crypto: caam - use JobR's space to access page 0 regs
@ 2024-11-11 12:12 Gaurav Jain
0 siblings, 0 replies; 7+ messages in thread
From: Gaurav Jain @ 2024-11-11 12:12 UTC (permalink / raw)
To: Horia Geantă, Pankaj Gupta, Herbert Xu, David S . Miller,
Silvano Di Ninno, Varun Sethi, Meenakshi Aggarwal, Sahil Malhotra,
Nikolaus Voss, Ahmad Fatoum
Cc: linux-crypto, linux-kernel, Gaurav Jain
Access to controller region is not permitted.
use JobR's register space to access page 0 registers.
Fixes: 6a83830f649a ("crypto: caam - warn if blob_gen key is insecure")
Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
---
drivers/crypto/caam/blob_gen.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/caam/blob_gen.c b/drivers/crypto/caam/blob_gen.c
index 87781c1534ee..079a22cc9f02 100644
--- a/drivers/crypto/caam/blob_gen.c
+++ b/drivers/crypto/caam/blob_gen.c
@@ -2,6 +2,7 @@
/*
* Copyright (C) 2015 Pengutronix, Steffen Trumtrar <kernel@pengutronix.de>
* Copyright (C) 2021 Pengutronix, Ahmad Fatoum <kernel@pengutronix.de>
+ * Copyright 2024 NXP
*/
#define pr_fmt(fmt) "caam blob_gen: " fmt
@@ -104,7 +105,7 @@ int caam_process_blob(struct caam_blob_priv *priv,
}
ctrlpriv = dev_get_drvdata(jrdev->parent);
- moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl->perfmon.status));
+ moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->jr[0]->perfmon.status));
if (moo != CSTA_MOO_SECURE && moo != CSTA_MOO_TRUSTED)
dev_warn(jrdev,
"using insecure test key, enable HAB to use unique device key!\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: caam - use JobR's space to access page 0 regs
2024-11-11 12:10 [PATCH] crypto: caam - use JobR's space to access page 0 regs Gaurav Jain
@ 2024-11-11 12:22 ` Ahmad Fatoum
2024-11-13 16:22 ` Horia Geanta
2024-11-18 9:31 ` [EXT] " Gaurav Jain
0 siblings, 2 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2024-11-11 12:22 UTC (permalink / raw)
To: Gaurav Jain, Horia Geantă, Pankaj Gupta, Herbert Xu,
David S . Miller, Silvano Di Ninno, Varun Sethi,
Meenakshi Aggarwal, Sahil Malhotra, Nikolaus Voss
Cc: linux-crypto, linux-kernel, Pengutronix Kernel Team
Hello Guarav,
Thanks for your patch.
On 11.11.24 13:10, Gaurav Jain wrote:
> Access to controller region is not permitted.
It's permitted on most of the older SoCs. Please mention on which SoCs
this is no longer true and which SoCs you tested your change on.
> use JobR's register space to access page 0 registers.
>
> Fixes: 6a83830f649a ("crypto: caam - warn if blob_gen key is insecure")
Did the CAAM even support any of the SoCs, where this doesn't work anymore
back when the code was mainlined?
> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> ---
> drivers/crypto/caam/blob_gen.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/caam/blob_gen.c b/drivers/crypto/caam/blob_gen.c
> index 87781c1534ee..079a22cc9f02 100644
> --- a/drivers/crypto/caam/blob_gen.c
> +++ b/drivers/crypto/caam/blob_gen.c
> @@ -2,6 +2,7 @@
> /*
> * Copyright (C) 2015 Pengutronix, Steffen Trumtrar <kernel@pengutronix.de>
> * Copyright (C) 2021 Pengutronix, Ahmad Fatoum <kernel@pengutronix.de>
> + * Copyright 2024 NXP
> */
>
> #define pr_fmt(fmt) "caam blob_gen: " fmt
> @@ -104,7 +105,7 @@ int caam_process_blob(struct caam_blob_priv *priv,
> }
>
> ctrlpriv = dev_get_drvdata(jrdev->parent);
> - moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl->perfmon.status));
> + moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->jr[0]->perfmon.status));
I believe your change is correct, but I would prefer that ctrlpriv gets a perfmon
member that is initialized in caam_probe to either &ctrlpriv->ctrl->perfmon.status
or &ctrlpriv->jr[0]->perfmon.status and then the code here would just use
&ctrlpriv->perfmon->status.
This would simplify code not only here, but also in caam_ctrl_rng_init.
Thanks,
Ahmad
> if (moo != CSTA_MOO_SECURE && moo != CSTA_MOO_TRUSTED)
> dev_warn(jrdev,
> "using insecure test key, enable HAB to use unique device key!\n");
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: caam - use JobR's space to access page 0 regs
2024-11-11 12:22 ` Ahmad Fatoum
@ 2024-11-13 16:22 ` Horia Geanta
2024-11-18 9:31 ` [EXT] " Gaurav Jain
1 sibling, 0 replies; 7+ messages in thread
From: Horia Geanta @ 2024-11-13 16:22 UTC (permalink / raw)
To: Ahmad Fatoum, Gaurav Jain, Pankaj Gupta, Herbert Xu,
David S . Miller, Silvano Di Ninno, Varun Sethi,
Meenakshi Aggarwal, Sahil Malhotra, Nikolaus Voss
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Pengutronix Kernel Team
On 11/11/2024 2:22 PM, Ahmad Fatoum wrote:
> Hello Guarav,
>
> Thanks for your patch.
>
> On 11.11.24 13:10, Gaurav Jain wrote:
[...]
>> #define pr_fmt(fmt) "caam blob_gen: " fmt
>> @@ -104,7 +105,7 @@ int caam_process_blob(struct caam_blob_priv *priv,
>> }
>>
>> ctrlpriv = dev_get_drvdata(jrdev->parent);
>> - moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl->perfmon.status));
>> + moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->jr[0]->perfmon.status));
>
> I believe your change is correct, but I would prefer that ctrlpriv gets a perfmon
> member that is initialized in caam_probe to either &ctrlpriv->ctrl->perfmon.status
> or &ctrlpriv->jr[0]->perfmon.status and then the code here would just use
> &ctrlpriv->perfmon->status.
>
> This would simplify code not only here, but also in caam_ctrl_rng_init.
>
Agree.
But maybe this refactoring deserves a separate patch, given that is should also
cover the case when the Job Ring device corresponding to "ctrlpriv->jr[0]"
is unbounded from the driver.
Thanks,
Horia
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [EXT] Re: [PATCH] crypto: caam - use JobR's space to access page 0 regs
2024-11-11 12:22 ` Ahmad Fatoum
2024-11-13 16:22 ` Horia Geanta
@ 2024-11-18 9:31 ` Gaurav Jain
2024-11-21 10:44 ` Ahmad Fatoum
1 sibling, 1 reply; 7+ messages in thread
From: Gaurav Jain @ 2024-11-18 9:31 UTC (permalink / raw)
To: Ahmad Fatoum, Horia Geanta, Pankaj Gupta, Herbert Xu,
David S . Miller, Silvano Di Ninno, Varun Sethi,
Meenakshi Aggarwal, Sahil Malhotra, Nikolaus Voss
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Pengutronix Kernel Team
Hello Ahmad
> -----Original Message-----
> From: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Sent: Monday, November 11, 2024 5:52 PM
> To: Gaurav Jain <gaurav.jain@nxp.com>; Horia Geanta
> <horia.geanta@nxp.com>; Pankaj Gupta <pankaj.gupta@nxp.com>; Herbert
> Xu <herbert@gondor.apana.org.au>; David S . Miller
> <davem@davemloft.net>; Silvano Di Ninno <silvano.dininno@nxp.com>;
> Varun Sethi <V.Sethi@nxp.com>; Meenakshi Aggarwal
> <meenakshi.aggarwal@nxp.com>; Sahil Malhotra
> <sahil.malhotra@nxp.com>; Nikolaus Voss <nikolaus.voss@haag-streit.com>
> Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org; Pengutronix
> Kernel Team <kernel@pengutronix.de>
> Subject: [EXT] Re: [PATCH] crypto: caam - use JobR's space to access page 0
> regs
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
>
> Hello Guarav,
>
> Thanks for your patch.
>
> On 11.11.24 13:10, Gaurav Jain wrote:
> > Access to controller region is not permitted.
>
> It's permitted on most of the older SoCs. Please mention on which SoCs this
> is no longer true and which SoCs you tested your change on.
Yes, it is permitted on iMX6/7/8M SoCs but not on iMX8DXL/QM/QXP/8ULP.
>
> > use JobR's register space to access page 0 registers.
> >
> > Fixes: 6a83830f649a ("crypto: caam - warn if blob_gen key is
> > insecure")
>
> Did the CAAM even support any of the SoCs, where this doesn't work
> anymore back when the code was mainlined?
Yes, for all SECO/ELE based SoCs, CAAM page 0 is not accessible from Non secure world.
>
> > Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> > ---
> > drivers/crypto/caam/blob_gen.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/crypto/caam/blob_gen.c
> > b/drivers/crypto/caam/blob_gen.c index 87781c1534ee..079a22cc9f02
> > 100644
> > --- a/drivers/crypto/caam/blob_gen.c
> > +++ b/drivers/crypto/caam/blob_gen.c
> > @@ -2,6 +2,7 @@
> > /*
> > * Copyright (C) 2015 Pengutronix, Steffen Trumtrar
> <kernel@pengutronix.de>
> > * Copyright (C) 2021 Pengutronix, Ahmad Fatoum
> > <kernel@pengutronix.de>
> > + * Copyright 2024 NXP
> > */
> >
> > #define pr_fmt(fmt) "caam blob_gen: " fmt @@ -104,7 +105,7 @@ int
> > caam_process_blob(struct caam_blob_priv *priv,
> > }
> >
> > ctrlpriv = dev_get_drvdata(jrdev->parent);
> > - moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl-
> >perfmon.status));
> > + moo = FIELD_GET(CSTA_MOO,
> > + rd_reg32(&ctrlpriv->jr[0]->perfmon.status));
>
> I believe your change is correct, but I would prefer that ctrlpriv gets a
> perfmon member that is initialized in caam_probe to either &ctrlpriv->ctrl-
> >perfmon.status or &ctrlpriv->jr[0]->perfmon.status and then the code here
> would just use &ctrlpriv->perfmon->status.
>
> This would simplify code not only here, but also in caam_ctrl_rng_init.
As already communicated by Horia, a separate patch is good to cover this.
Thanks
Gaurav
>
> Thanks,
> Ahmad
>
>
> > if (moo != CSTA_MOO_SECURE && moo != CSTA_MOO_TRUSTED)
> > dev_warn(jrdev,
> > "using insecure test key, enable HAB to use
> > unique device key!\n");
>
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 |
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
> pengutronix.de%2F&data=05%7C02%7Cgaurav.jain%40nxp.com%7C758768
> 98a8044b366f4808dd024b7740%7C686ea1d3bc2b4c6fa92cd99c5c30163
> 5%7C0%7C0%7C638669245367988594%7CUnknown%7CTWFpbGZsb3d8e
> yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIj
> oiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aaQ65iMsvuHn3q
> 0bo5UU%2FYU7Fpyw3El7wNVHd%2BMNee0%3D&reserved=0 |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [EXT] Re: [PATCH] crypto: caam - use JobR's space to access page 0 regs
2024-11-18 9:31 ` [EXT] " Gaurav Jain
@ 2024-11-21 10:44 ` Ahmad Fatoum
2024-11-21 11:25 ` Gaurav Jain
0 siblings, 1 reply; 7+ messages in thread
From: Ahmad Fatoum @ 2024-11-21 10:44 UTC (permalink / raw)
To: Gaurav Jain, Horia Geanta, Pankaj Gupta, Herbert Xu,
David S . Miller, Silvano Di Ninno, Varun Sethi,
Meenakshi Aggarwal, Sahil Malhotra, Nikolaus Voss
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Pengutronix Kernel Team
Hello Gaurav,
On 18.11.24 10:31, Gaurav Jain wrote:
>> -----Original Message-----
>> From: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> Sent: Monday, November 11, 2024 5:52 PM
>> To: Gaurav Jain <gaurav.jain@nxp.com>; Horia Geanta
>> <horia.geanta@nxp.com>; Pankaj Gupta <pankaj.gupta@nxp.com>; Herbert
>> Xu <herbert@gondor.apana.org.au>; David S . Miller
>> <davem@davemloft.net>; Silvano Di Ninno <silvano.dininno@nxp.com>;
>> Varun Sethi <V.Sethi@nxp.com>; Meenakshi Aggarwal
>> <meenakshi.aggarwal@nxp.com>; Sahil Malhotra
>> <sahil.malhotra@nxp.com>; Nikolaus Voss <nikolaus.voss@haag-streit.com>
>> Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org; Pengutronix
>> Kernel Team <kernel@pengutronix.de>
>> Subject: [EXT] Re: [PATCH] crypto: caam - use JobR's space to access page 0
>> regs
>>
>> Caution: This is an external email. Please take care when clicking links or
>> opening attachments. When in doubt, report the message using the 'Report
>> this email' button
>>
>>
>> Hello Guarav,
>>
>> Thanks for your patch.
>>
>> On 11.11.24 13:10, Gaurav Jain wrote:
>>> Access to controller region is not permitted.
>>
>> It's permitted on most of the older SoCs. Please mention on which SoCs this
>> is no longer true and which SoCs you tested your change on.
> Yes, it is permitted on iMX6/7/8M SoCs but not on iMX8DXL/QM/QXP/8ULP.
Ok, please add this to the commit message.
>>
>>> use JobR's register space to access page 0 registers.
>>>
>>> Fixes: 6a83830f649a ("crypto: caam - warn if blob_gen key is
>>> insecure")
>>
>> Did the CAAM even support any of the SoCs, where this doesn't work
>> anymore back when the code was mainlined?
> Yes, for all SECO/ELE based SoCs, CAAM page 0 is not accessible from Non secure world.
Same, this information needs to be in the commit message.
>>
>>> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
>>> ---
>>> drivers/crypto/caam/blob_gen.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/crypto/caam/blob_gen.c
>>> b/drivers/crypto/caam/blob_gen.c index 87781c1534ee..079a22cc9f02
>>> 100644
>>> --- a/drivers/crypto/caam/blob_gen.c
>>> +++ b/drivers/crypto/caam/blob_gen.c
>>> @@ -2,6 +2,7 @@
>>> /*
>>> * Copyright (C) 2015 Pengutronix, Steffen Trumtrar
>> <kernel@pengutronix.de>
>>> * Copyright (C) 2021 Pengutronix, Ahmad Fatoum
>>> <kernel@pengutronix.de>
>>> + * Copyright 2024 NXP
>>> */
>>>
>>> #define pr_fmt(fmt) "caam blob_gen: " fmt @@ -104,7 +105,7 @@ int
>>> caam_process_blob(struct caam_blob_priv *priv,
>>> }
>>>
>>> ctrlpriv = dev_get_drvdata(jrdev->parent);
>>> - moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl-
>>> perfmon.status));
>>> + moo = FIELD_GET(CSTA_MOO,
>>> + rd_reg32(&ctrlpriv->jr[0]->perfmon.status));
>>
>> I believe your change is correct, but I would prefer that ctrlpriv gets a
>> perfmon member that is initialized in caam_probe to either &ctrlpriv->ctrl-
>>> perfmon.status or &ctrlpriv->jr[0]->perfmon.status and then the code here
>> would just use &ctrlpriv->perfmon->status.
>>
>> This would simplify code not only here, but also in caam_ctrl_rng_init.
> As already communicated by Horia, a separate patch is good to cover this.
Are you interested in writing that separate patch?
Cheers,
Ahmad
>
> Thanks
> Gaurav
>>
>> Thanks,
>> Ahmad
>>
>>
>>> if (moo != CSTA_MOO_SECURE && moo != CSTA_MOO_TRUSTED)
>>> dev_warn(jrdev,
>>> "using insecure test key, enable HAB to use
>>> unique device key!\n");
>>
>>
>> --
>> Pengutronix e.K. | |
>> Steuerwalder Str. 21 |
>> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
>> pengutronix.de%2F&data=05%7C02%7Cgaurav.jain%40nxp.com%7C758768
>> 98a8044b366f4808dd024b7740%7C686ea1d3bc2b4c6fa92cd99c5c30163
>> 5%7C0%7C0%7C638669245367988594%7CUnknown%7CTWFpbGZsb3d8e
>> yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIj
>> oiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aaQ65iMsvuHn3q
>> 0bo5UU%2FYU7Fpyw3El7wNVHd%2BMNee0%3D&reserved=0 |
>> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
>> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [EXT] Re: [PATCH] crypto: caam - use JobR's space to access page 0 regs
2024-11-21 10:44 ` Ahmad Fatoum
@ 2024-11-21 11:25 ` Gaurav Jain
0 siblings, 0 replies; 7+ messages in thread
From: Gaurav Jain @ 2024-11-21 11:25 UTC (permalink / raw)
To: Ahmad Fatoum, Horia Geanta, Pankaj Gupta, Herbert Xu,
David S . Miller, Silvano Di Ninno, Varun Sethi,
Meenakshi Aggarwal, Sahil Malhotra, Nikolaus Voss
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Pengutronix Kernel Team
Hi Ahmad
> -----Original Message-----
> From: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Sent: Thursday, November 21, 2024 4:14 PM
> To: Gaurav Jain <gaurav.jain@nxp.com>; Horia Geanta
> <horia.geanta@nxp.com>; Pankaj Gupta <pankaj.gupta@nxp.com>; Herbert
> Xu <herbert@gondor.apana.org.au>; David S . Miller
> <davem@davemloft.net>; Silvano Di Ninno <silvano.dininno@nxp.com>;
> Varun Sethi <V.Sethi@nxp.com>; Meenakshi Aggarwal
> <meenakshi.aggarwal@nxp.com>; Sahil Malhotra
> <sahil.malhotra@nxp.com>; Nikolaus Voss <nikolaus.voss@haag-streit.com>
> Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org; Pengutronix
> Kernel Team <kernel@pengutronix.de>
> Subject: Re: [EXT] Re: [PATCH] crypto: caam - use JobR's space to access
> page 0 regs
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
>
> Hello Gaurav,
>
> On 18.11.24 10:31, Gaurav Jain wrote:
> >> -----Original Message-----
> >> From: Ahmad Fatoum <a.fatoum@pengutronix.de>
> >> Sent: Monday, November 11, 2024 5:52 PM
> >> To: Gaurav Jain <gaurav.jain@nxp.com>; Horia Geanta
> >> <horia.geanta@nxp.com>; Pankaj Gupta <pankaj.gupta@nxp.com>;
> Herbert
> >> Xu <herbert@gondor.apana.org.au>; David S . Miller
> >> <davem@davemloft.net>; Silvano Di Ninno <silvano.dininno@nxp.com>;
> >> Varun Sethi <V.Sethi@nxp.com>; Meenakshi Aggarwal
> >> <meenakshi.aggarwal@nxp.com>; Sahil Malhotra
> >> <sahil.malhotra@nxp.com>; Nikolaus Voss
> >> <nikolaus.voss@haag-streit.com>
> >> Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org;
> >> Pengutronix Kernel Team <kernel@pengutronix.de>
> >> Subject: [EXT] Re: [PATCH] crypto: caam - use JobR's space to access
> >> page 0 regs
> >>
> >> Caution: This is an external email. Please take care when clicking
> >> links or opening attachments. When in doubt, report the message using
> >> the 'Report this email' button
> >>
> >>
> >> Hello Guarav,
> >>
> >> Thanks for your patch.
> >>
> >> On 11.11.24 13:10, Gaurav Jain wrote:
> >>> Access to controller region is not permitted.
> >>
> >> It's permitted on most of the older SoCs. Please mention on which
> >> SoCs this is no longer true and which SoCs you tested your change on.
> > Yes, it is permitted on iMX6/7/8M SoCs but not on
> iMX8DXL/QM/QXP/8ULP.
>
> Ok, please add this to the commit message.
Ok, will send v2.
>
> >>
> >>> use JobR's register space to access page 0 registers.
> >>>
> >>> Fixes: 6a83830f649a ("crypto: caam - warn if blob_gen key is
> >>> insecure")
> >>
> >> Did the CAAM even support any of the SoCs, where this doesn't work
> >> anymore back when the code was mainlined?
> > Yes, for all SECO/ELE based SoCs, CAAM page 0 is not accessible from Non
> secure world.
>
> Same, this information needs to be in the commit message.
Ok.
>
> >>
> >>> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> >>> ---
> >>> drivers/crypto/caam/blob_gen.c | 3 ++-
> >>> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/crypto/caam/blob_gen.c
> >>> b/drivers/crypto/caam/blob_gen.c index 87781c1534ee..079a22cc9f02
> >>> 100644
> >>> --- a/drivers/crypto/caam/blob_gen.c
> >>> +++ b/drivers/crypto/caam/blob_gen.c
> >>> @@ -2,6 +2,7 @@
> >>> /*
> >>> * Copyright (C) 2015 Pengutronix, Steffen Trumtrar
> >> <kernel@pengutronix.de>
> >>> * Copyright (C) 2021 Pengutronix, Ahmad Fatoum
> >>> <kernel@pengutronix.de>
> >>> + * Copyright 2024 NXP
> >>> */
> >>>
> >>> #define pr_fmt(fmt) "caam blob_gen: " fmt @@ -104,7 +105,7 @@ int
> >>> caam_process_blob(struct caam_blob_priv *priv,
> >>> }
> >>>
> >>> ctrlpriv = dev_get_drvdata(jrdev->parent);
> >>> - moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl-
> >>> perfmon.status));
> >>> + moo = FIELD_GET(CSTA_MOO,
> >>> + rd_reg32(&ctrlpriv->jr[0]->perfmon.status));
> >>
> >> I believe your change is correct, but I would prefer that ctrlpriv
> >> gets a perfmon member that is initialized in caam_probe to either
> >> &ctrlpriv->ctrl-
> >>> perfmon.status or &ctrlpriv->jr[0]->perfmon.status and then the code
> >>> here
> >> would just use &ctrlpriv->perfmon->status.
> >>
> >> This would simplify code not only here, but also in caam_ctrl_rng_init.
> > As already communicated by Horia, a separate patch is good to cover this.
>
> Are you interested in writing that separate patch?
Yes interested but cannot send this change immediately. later will do it.
>
> Cheers,
> Ahmad
>
> >
> > Thanks
> > Gaurav
> >>
> >> Thanks,
> >> Ahmad
> >>
> >>
> >>> if (moo != CSTA_MOO_SECURE && moo != CSTA_MOO_TRUSTED)
> >>> dev_warn(jrdev,
> >>> "using insecure test key, enable HAB to use
> >>> unique device key!\n");
> >>
> >>
> >> --
> >> Pengutronix e.K. | |
> >> Steuerwalder Str. 21 |
> >>
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> %2F&data=05%7C02%7Cgaurav.jain%40nxp.com%7C0fdec24d19fc4e21578
> 308dd0a197a2c%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C
> 638677826741678192%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGk
> iOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIj
> oyfQ%3D%3D%7C0%7C%7C%7C&sdata=RKumouL64QDlhqgV8lV%2FHetWt
> cU2bFLctzolWoY5iDo%3D&reserved=0.
> >>
> pengutronix.de%2F&data=05%7C02%7Cgaurav.jain%40nxp.com%7C758768
> >>
> 98a8044b366f4808dd024b7740%7C686ea1d3bc2b4c6fa92cd99c5c30163
> >>
> 5%7C0%7C0%7C638669245367988594%7CUnknown%7CTWFpbGZsb3d8e
> >>
> yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIj
> >>
> oiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aaQ65iMsvuHn3q
> >> 0bo5UU%2FYU7Fpyw3El7wNVHd%2BMNee0%3D&reserved=0 |
> >> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> >> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555
> |
> >
>
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 |
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
> pengutronix.de%2F&data=05%7C02%7Cgaurav.jain%40nxp.com%7C0fdec24
> d19fc4e21578308dd0a197a2c%7C686ea1d3bc2b4c6fa92cd99c5c301635%
> 7C0%7C0%7C638677826741698749%7CUnknown%7CTWFpbGZsb3d8eyJF
> bXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT
> WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=h09U3v1B3wkZdemP
> IyiRsoMlDuRMPG%2F2IgXkvqdAOng%3D&reserved=0 |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-21 11:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 12:10 [PATCH] crypto: caam - use JobR's space to access page 0 regs Gaurav Jain
2024-11-11 12:22 ` Ahmad Fatoum
2024-11-13 16:22 ` Horia Geanta
2024-11-18 9:31 ` [EXT] " Gaurav Jain
2024-11-21 10:44 ` Ahmad Fatoum
2024-11-21 11:25 ` Gaurav Jain
-- strict thread matches above, loose matches on Subject: below --
2024-11-11 12:12 Gaurav Jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox