All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: caam/qi - execute library only on DPAA 1.x
@ 2019-08-05 12:39 Horia Geantă
  0 siblings, 0 replies; only message in thread
From: Horia Geantă @ 2019-08-05 12:39 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, Aymen Sghaier, linux-crypto, NXP Linux Team

In the process of turning caam/qi into a library, the check of
MCFGR[QI] bit has been inadvertently dropped.
Fix the condition for DPAA 1.x QI detection, which should be:
MCFGR[QI] && !MCFGR[DPAA2]

An identical check is added in the library exit point, even though
currently it's not strictly required (list of registered algorithms
being empty).

While here, silence the library initialization abort - since jr.c
calls it unconditionally.

Fixes: 1b46c90c8e00 ("crypto: caam - convert top level drivers to libraries")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
---
 drivers/crypto/caam/caamalg_qi.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c
index 32f0f8a72067..c25479d2efa4 100644
--- a/drivers/crypto/caam/caamalg_qi.c
+++ b/drivers/crypto/caam/caamalg_qi.c
@@ -2474,6 +2474,10 @@ void caam_qi_algapi_exit(void)
 {
 	int i;
 
+	/* Make sure this runs only on (DPAA 1.x) QI */
+	if (!priv->qi_present || caam_dpaa2)
+		return 0;
+
 	for (i = 0; i < ARRAY_SIZE(driver_aeads); i++) {
 		struct caam_aead_alg *t_alg = driver_aeads + i;
 
@@ -2523,10 +2527,9 @@ int caam_qi_algapi_init(struct device *ctrldev)
 	unsigned int md_limit = SHA512_DIGEST_SIZE;
 	bool registered = false;
 
-	if (caam_dpaa2) {
-		dev_info(ctrldev, "caam/qi frontend driver not suitable for DPAA 2.x, aborting...\n");
-		return -ENODEV;
-	}
+	/* Make sure this runs only on (DPAA 1.x) QI */
+	if (!priv->qi_present || caam_dpaa2)
+		return 0;
 
 	/*
 	 * Register crypto algorithms the device supports.
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-05 12:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05 12:39 [PATCH] crypto: caam/qi - execute library only on DPAA 1.x Horia Geantă

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.