mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] crypto: caam - use JobR's space to access page 0 regs
@ 2024-11-26  6:46 Gaurav Jain
  2024-11-26  6:48 ` Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gaurav Jain @ 2024-11-26  6:46 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, linux-kernel, Pengutronix Kernel Team, Gaurav Jain

On iMX8DXL/QM/QXP(SECO) & iMX8ULP(ELE) SoCs, access to controller
region(CAAM page 0) is not permitted from non secure world.
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>
---

changes in v2
Updated commit message with SoCs details on which CAAM page 0 is not
accessible from non secure world.

 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	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] crypto: caam - use JobR's space to access page 0 regs
  2024-11-26  6:46 [PATCH v2] crypto: caam - use JobR's space to access page 0 regs Gaurav Jain
@ 2024-11-26  6:48 ` Ahmad Fatoum
  2024-11-27 15:23 ` Horia Geanta
  2024-12-10  5:48 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2024-11-26  6:48 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, linux-kernel, Pengutronix Kernel Team

On 26.11.24 07:46, Gaurav Jain wrote:
> On iMX8DXL/QM/QXP(SECO) & iMX8ULP(ELE) SoCs, access to controller
> region(CAAM page 0) is not permitted from non secure world.
> 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>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
> 
> changes in v2
> Updated commit message with SoCs details on which CAAM page 0 is not
> accessible from non secure world.
> 
>  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");


-- 
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] 4+ messages in thread

* Re: [PATCH v2] crypto: caam - use JobR's space to access page 0 regs
  2024-11-26  6:46 [PATCH v2] crypto: caam - use JobR's space to access page 0 regs Gaurav Jain
  2024-11-26  6:48 ` Ahmad Fatoum
@ 2024-11-27 15:23 ` Horia Geanta
  2024-12-10  5:48 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Horia Geanta @ 2024-11-27 15:23 UTC (permalink / raw)
  To: Gaurav Jain, Ahmad Fatoum, 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

On 11/26/2024 8:46 AM, Gaurav Jain wrote:
> On iMX8DXL/QM/QXP(SECO) & iMX8ULP(ELE) SoCs, access to controller
> region(CAAM page 0) is not permitted from non secure world.
> 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>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>

Thanks,
Horia


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

* Re: [PATCH v2] crypto: caam - use JobR's space to access page 0 regs
  2024-11-26  6:46 [PATCH v2] crypto: caam - use JobR's space to access page 0 regs Gaurav Jain
  2024-11-26  6:48 ` Ahmad Fatoum
  2024-11-27 15:23 ` Horia Geanta
@ 2024-12-10  5:48 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2024-12-10  5:48 UTC (permalink / raw)
  To: Gaurav Jain
  Cc: Ahmad Fatoum, Horia Geanta, Pankaj Gupta, David S . Miller,
	Silvano Di Ninno, Varun Sethi, Meenakshi Aggarwal,
	Sahil Malhotra, Nikolaus Voss, linux-crypto, linux-kernel,
	Pengutronix Kernel Team

On Tue, Nov 26, 2024 at 12:16:07PM +0530, Gaurav Jain wrote:
> On iMX8DXL/QM/QXP(SECO) & iMX8ULP(ELE) SoCs, access to controller
> region(CAAM page 0) is not permitted from non secure world.
> 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>
> ---
> 
> changes in v2
> Updated commit message with SoCs details on which CAAM page 0 is not
> accessible from non secure world.
> 
>  drivers/crypto/caam/blob_gen.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2024-12-10  5:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-26  6:46 [PATCH v2] crypto: caam - use JobR's space to access page 0 regs Gaurav Jain
2024-11-26  6:48 ` Ahmad Fatoum
2024-11-27 15:23 ` Horia Geanta
2024-12-10  5:48 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®