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

Message ID 20221220081750.2D0183BDB@mail.steuer-voss.de
State New
Headers
Series [v2] crypto: caam: blob_gen.c: fix CAAM io mem access |

Commit Message

Nikolaus Voss Dec. 20, 2022, 8:17 a.m. UTC
  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: 6a83830f649a ("crypto: caam - warn if blob_gen key is insecure")
Signed-off-by: Nikolaus Voss <nikolaus.voss@haag-streit.com>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

---
v2: added upstream commit ref and reviewed-by line

 drivers/crypto/caam/blob_gen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Herbert Xu Dec. 30, 2022, 3:15 p.m. UTC | #1
On Tue, Dec 20, 2022 at 09:17:50AM +0100, 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: 6a83830f649a ("crypto: caam - warn if blob_gen key is insecure")
> Signed-off-by: Nikolaus Voss <nikolaus.voss@haag-streit.com>
> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
> ---
> v2: added upstream commit ref and reviewed-by line
> 
>  drivers/crypto/caam/blob_gen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
  

Patch

diff --git a/drivers/crypto/caam/blob_gen.c b/drivers/crypto/caam/blob_gen.c
index 1f65df4898478..f46b161d2cda6 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");