summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam
diff options
context:
space:
mode:
authorAymen Sghaier <aymen.sghaier@nxp.com>2017-12-18 12:06:00 +0100
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commitb0f96a4d9ab411799a65f98136b8b58b18d43122 (patch)
tree27b0f23f4f2548f9d31e4f02f9ca8df3a002b048 /drivers/crypto/caam
parente2750ede274e45f211c3366ec5e5cd11d0b1f7f9 (diff)
MLK-17111-4: crypto: caam: Fix RNG Kernel oops on i.MX8QXP
Seen on i.MX8QXP board by reboot test, that Kernel oops occurs due to failing RNG instantiation with default entropy delay. The fix is to disable all job rings if RNG failed to prevent Kernel crash. And print an error message saying that this is a known limitation on REV A0 SoC. Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Diffstat (limited to 'drivers/crypto/caam')
-rw-r--r--drivers/crypto/caam/jr.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index 335667670c22..b218bd387678 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -487,7 +487,7 @@ static int caam_jr_probe(struct platform_device *pdev)
struct device *jrdev;
struct device_node *nprop;
struct caam_job_ring __iomem *ctrl;
- struct caam_drv_private_jr *jrpriv;
+ struct caam_drv_private_jr *jrpriv, *jrppriv;
static int total_jobrs;
int error;
@@ -547,7 +547,20 @@ static int caam_jr_probe(struct platform_device *pdev)
/*
* Instantiate RNG by JR rather than DECO
*/
- if (jrpriv->ridx == 0) {
+ spin_lock(&driver_data.jr_alloc_lock);
+ if (list_empty(&driver_data.jr_list)) {
+ spin_unlock(&driver_data.jr_alloc_lock);
+ dev_err(jrdev, "jr_list is empty\n");
+ return -ENODEV;
+ }
+ jrppriv = list_first_entry(&driver_data.jr_list,
+ struct caam_drv_private_jr, list_node);
+ spin_unlock(&driver_data.jr_alloc_lock);
+ /*
+ * If this is the first available JR
+ * then try to instantiate RNG
+ */
+ if (jrppriv->ridx == jrpriv->ridx) {
if (of_machine_is_compatible("fsl,imx8qm") ||
of_machine_is_compatible("fsl,imx8qxp")) {
/*
@@ -568,6 +581,17 @@ static int caam_jr_probe(struct platform_device *pdev)
error = inst_rng_imx6(pdev);
}
}
+ if (error != 0) {
+#ifdef CONFIG_HAVE_IMX8_SOC
+ if (imx8_get_soc_revision() == IMX_CHIP_REVISION_1_0)
+ dev_err(jrdev,
+ "This is a known limitation on A0 SOC revision\n"
+ "RNG instantiation failed, CAAM needs a reboot\n");
+#endif /* CONFIG_HAVE_IMX8_SOC */
+ spin_lock(&driver_data.jr_alloc_lock);
+ list_del(&jrpriv->list_node);
+ spin_unlock(&driver_data.jr_alloc_lock);
+ }
return error;
}