linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: caam - limit AXI pipeline to a depth of 1
@ 2019-03-22 13:39 Iuliana Prodan
  2019-03-22 13:49 ` Horia Geanta
  2019-03-28  6:08 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Iuliana Prodan @ 2019-03-22 13:39 UTC (permalink / raw)
  To: Herbert Xu, Horia Geanta, Aymen Sghaier
  Cc: David S. Miller, linux-crypto, linux-kernel, linux-imx

Some i.MX6 devices (imx6D, imx6Q, imx6DL, imx6S, imx6DP and imx6DQ) have
an issue wherein AXI bus transactions may not occur in the correct order.
This isn't a problem running single descriptors, but can be if running
multiple concurrent descriptors. Reworking the CAAM driver to throttle
to single requests is impractical, so this patch limits the AXI pipeline
to a depth of one (from a default of 4) to preclude this situation from
occurring.
This patch applies to known affected platforms.

Signed-off-by: Radu Solea <radu.solea@nxp.com>
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
---
 drivers/crypto/caam/ctrl.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 858bdc9..e2ba3d2 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -468,6 +468,24 @@ static int caam_get_era(struct caam_ctrl __iomem *ctrl)
 		return caam_get_era_from_hw(ctrl);
 }
 
+/*
+ * ERRATA: imx6 devices (imx6D, imx6Q, imx6DL, imx6S, imx6DP and imx6DQ)
+ * have an issue wherein AXI bus transactions may not occur in the correct
+ * order. This isn't a problem running single descriptors, but can be if
+ * running multiple concurrent descriptors. Reworking the driver to throttle
+ * to single requests is impractical, thus the workaround is to limit the AXI
+ * pipeline to a depth of 1 (from it's default of 4) to preclude this situation
+ * from occurring.
+ */
+static void handle_imx6_err005766(u32 *mcr)
+{
+	if (of_machine_is_compatible("fsl,imx6q") ||
+	    of_machine_is_compatible("fsl,imx6dl") ||
+	    of_machine_is_compatible("fsl,imx6qp"))
+		clrsetbits_32(mcr, MCFGR_AXIPIPE_MASK,
+			      1 << MCFGR_AXIPIPE_SHIFT);
+}
+
 static const struct of_device_id caam_match[] = {
 	{
 		.compatible = "fsl,sec-v4.0",
@@ -640,6 +658,8 @@ static int caam_probe(struct platform_device *pdev)
 			      (sizeof(dma_addr_t) == sizeof(u64) ?
 			       MCFGR_LONG_PTR : 0));
 
+	handle_imx6_err005766(&ctrl->mcr);
+
 	/*
 	 *  Read the Compile Time paramters and SCFGR to determine
 	 * if Virtualization is enabled for this platform
-- 
2.1.0


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

* Re: [PATCH] crypto: caam - limit AXI pipeline to a depth of 1
  2019-03-22 13:39 [PATCH] crypto: caam - limit AXI pipeline to a depth of 1 Iuliana Prodan
@ 2019-03-22 13:49 ` Horia Geanta
  2019-03-28  6:08 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Horia Geanta @ 2019-03-22 13:49 UTC (permalink / raw)
  To: Iuliana Prodan, Herbert Xu, Aymen Sghaier
  Cc: David S. Miller, linux-crypto, linux-kernel, dl-linux-imx

On 3/22/2019 3:39 PM, Iuliana Prodan wrote:
> Some i.MX6 devices (imx6D, imx6Q, imx6DL, imx6S, imx6DP and imx6DQ) have
> an issue wherein AXI bus transactions may not occur in the correct order.
> This isn't a problem running single descriptors, but can be if running
> multiple concurrent descriptors. Reworking the CAAM driver to throttle
> to single requests is impractical, so this patch limits the AXI pipeline
> to a depth of one (from a default of 4) to preclude this situation from
> occurring.
> This patch applies to known affected platforms.
> 
> Signed-off-by: Radu Solea <radu.solea@nxp.com>
> Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>

Thanks,
Horia

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

* Re: [PATCH] crypto: caam - limit AXI pipeline to a depth of 1
  2019-03-22 13:39 [PATCH] crypto: caam - limit AXI pipeline to a depth of 1 Iuliana Prodan
  2019-03-22 13:49 ` Horia Geanta
@ 2019-03-28  6:08 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2019-03-28  6:08 UTC (permalink / raw)
  To: Iuliana Prodan
  Cc: Horia Geanta, Aymen Sghaier, David S. Miller, linux-crypto,
	linux-kernel, linux-imx

On Fri, Mar 22, 2019 at 03:39:28PM +0200, Iuliana Prodan wrote:
> Some i.MX6 devices (imx6D, imx6Q, imx6DL, imx6S, imx6DP and imx6DQ) have
> an issue wherein AXI bus transactions may not occur in the correct order.
> This isn't a problem running single descriptors, but can be if running
> multiple concurrent descriptors. Reworking the CAAM driver to throttle
> to single requests is impractical, so this patch limits the AXI pipeline
> to a depth of one (from a default of 4) to preclude this situation from
> occurring.
> This patch applies to known affected platforms.
> 
> Signed-off-by: Radu Solea <radu.solea@nxp.com>
> Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
> ---
>  drivers/crypto/caam/ctrl.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)

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

end of thread, other threads:[~2019-03-28  6:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 13:39 [PATCH] crypto: caam - limit AXI pipeline to a depth of 1 Iuliana Prodan
2019-03-22 13:49 ` Horia Geanta
2019-03-28  6:08 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).