[PATCH] crypto: caam: blob_gen.c: fix CAAM io mem access

Nikolaus Voss posted 1 patch 1 year, 3 months ago
There is a newer version of this series
drivers/crypto/caam/blob_gen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] crypto: caam: blob_gen.c: fix CAAM io mem access
Posted by Nikolaus Voss 1 year, 3 months ago
IO memory access has to be done with accessors defined in caam/regs.h
as there are little-endian architectures with a big-endian CAAM unit.

Fixes ("crypto: caam: blob_gen.c: warn if key is insecure")
Signed-off-by: Nikolaus Voss <nikolaus.voss@haag-streit.com>
---
 drivers/crypto/caam/blob_gen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/caam/blob_gen.c b/drivers/crypto/caam/blob_gen.c
index 1f65df489847..f46b161d2cda 100644
--- a/drivers/crypto/caam/blob_gen.c
+++ b/drivers/crypto/caam/blob_gen.c
@@ -104,7 +104,7 @@ int caam_process_blob(struct caam_blob_priv *priv,
 	}
 
 	ctrlpriv = dev_get_drvdata(jrdev->parent);
-	moo = FIELD_GET(CSTA_MOO, ioread32(&ctrlpriv->ctrl->perfmon.status));
+	moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl->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.34.1
Re: [PATCH] crypto: caam: blob_gen.c: fix CAAM io mem access
Posted by Ahmad Fatoum 1 year, 3 months ago
On 05.12.22 08:58, Nikolaus Voss wrote:
> IO memory access has to be done with accessors defined in caam/regs.h
> as there are little-endian architectures with a big-endian CAAM unit.
> 
> Fixes ("crypto: caam: blob_gen.c: warn if key is insecure")

@Herbert, is there a stable commit revision Nikolaus could reference here?

> Signed-off-by: Nikolaus Voss <nikolaus.voss@haag-streit.com>

LGTM.

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

> ---
>  drivers/crypto/caam/blob_gen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/caam/blob_gen.c b/drivers/crypto/caam/blob_gen.c
> index 1f65df489847..f46b161d2cda 100644
> --- a/drivers/crypto/caam/blob_gen.c
> +++ b/drivers/crypto/caam/blob_gen.c
> @@ -104,7 +104,7 @@ int caam_process_blob(struct caam_blob_priv *priv,
>  	}
>  
>  	ctrlpriv = dev_get_drvdata(jrdev->parent);
> -	moo = FIELD_GET(CSTA_MOO, ioread32(&ctrlpriv->ctrl->perfmon.status));
> +	moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl->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 |