From: Vincent Jardin via B4 Relay <devnull+vjardin.free.fr@kernel.org>
To: "Horia Geantă" <horia.geanta@nxp.com>,
"Pankaj Gupta" <pankaj.gupta@nxp.com>,
"Sahil Malhotra" <sahil.malhotra@nxp.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Gaurav Jain" <gaurav.jain@nxp.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Vincent Jardin <vjardin@free.fr>
Subject: [PATCH 1/3] crypto: caam/qi2 - algorithm priority be a parameter
Date: Mon, 28 Sep 2026 16:01:03 +0200 [thread overview]
Message-ID: <20260928-for-upstream-caam-qi2-priority-v1-1-e4a8e5f01dbc@free.fr> (raw)
In-Reply-To: <20260928-for-upstream-caam-qi2-priority-v1-0-e4a8e5f01dbc@free.fr>
From: Vincent Jardin <vjardin@free.fr>
dpaa2_caam registers every skcipher, aead and ahash at a fixed priority
of 2000.
It is above the ARMv8 Crypto Extensions (200 to 300), so on any DPAA2 SoC,
every in-kernel user of AES, SHA or GCM moves from the CPU to the SEC,
whatever the request size.
Whether the SEC should be the default or only be reached by driver name
depends on the system, and there is no way to choose/tune it.
Add a priority parameter
dpaa2_caam.priority=
on the command line
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
drivers/crypto/caam/caamalg_qi2.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c
index 6b47bcc16a50..dbb84a6996a2 100644
--- a/drivers/crypto/caam/caamalg_qi2.c
+++ b/drivers/crypto/caam/caamalg_qi2.c
@@ -28,6 +28,13 @@
#define CAAM_CRA_PRIORITY 2000
+static unsigned int priority;
+module_param(priority, uint, 0444);
+MODULE_PARM_DESC(priority,
+ "Crypto API priority of the algorithms (0: default, 2000)");
+
+static int cra_priority = CAAM_CRA_PRIORITY;
+
/* max key is sum of AES_MAX_KEY_SIZE, max split key size */
#define CAAM_MAX_KEY_SIZE (AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE + \
SHA512_DIGEST_SIZE * 2)
@@ -3014,7 +3021,7 @@ static void caam_skcipher_alg_init(struct caam_skcipher_alg *t_alg)
struct skcipher_alg *alg = &t_alg->skcipher;
alg->base.cra_module = THIS_MODULE;
- alg->base.cra_priority = CAAM_CRA_PRIORITY;
+ alg->base.cra_priority = cra_priority;
alg->base.cra_ctxsize = sizeof(struct caam_ctx) + crypto_dma_padding();
alg->base.cra_flags |= (CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY |
CRYPTO_ALG_KERN_DRIVER_ONLY);
@@ -3028,7 +3035,7 @@ static void caam_aead_alg_init(struct caam_aead_alg *t_alg)
struct aead_alg *alg = &t_alg->aead;
alg->base.cra_module = THIS_MODULE;
- alg->base.cra_priority = CAAM_CRA_PRIORITY;
+ alg->base.cra_priority = cra_priority;
alg->base.cra_ctxsize = sizeof(struct caam_ctx) + crypto_dma_padding();
alg->base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY |
CRYPTO_ALG_KERN_DRIVER_ONLY;
@@ -4659,7 +4666,7 @@ static struct caam_hash_alg *caam_hash_alloc(struct device *dev,
alg->cra_init = caam_hash_cra_init;
alg->cra_exit = caam_hash_cra_exit;
alg->cra_ctxsize = sizeof(struct caam_hash_ctx) + crypto_dma_padding();
- alg->cra_priority = CAAM_CRA_PRIORITY;
+ alg->cra_priority = cra_priority;
alg->cra_blocksize = template->blocksize;
alg->cra_alignmask = 0;
alg->cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY;
@@ -5208,6 +5215,9 @@ static int dpaa2_caam_probe(struct fsl_mc_device *dpseci_dev)
caam_imx = false;
+ if (priority)
+ cra_priority = priority;
+
dev = &dpseci_dev->dev;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
--
2.43.0
next prev parent reply other threads:[~2026-09-28 14:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 14:01 [PATCH 0/3] crypto: caam/qi2 - algorithm priority configurable Vincent Jardin via B4 Relay
2026-09-28 14:01 ` Vincent Jardin via B4 Relay [this message]
2026-09-29 12:29 ` [PATCH 1/3] crypto: caam/qi2 - algorithm priority be a parameter Herbert Xu
2026-09-29 12:57 ` Vincent Jardin
2026-09-28 14:01 ` [PATCH 2/3] dt-bindings: crypto: fsl,sec-v4.0: add fsl,qi2-crypto-priority Vincent Jardin via B4 Relay
2026-09-29 9:08 ` Krzysztof Kozlowski
2026-09-29 12:58 ` Vincent Jardin
2026-09-28 14:01 ` [PATCH 3/3] crypto: caam/qi2 - priority from the DTS Vincent Jardin via B4 Relay
2026-09-28 22:41 ` [PATCH 0/3] crypto: caam/qi2 - algorithm priority configurable Eric Biggers
2026-09-29 16:45 ` Vincent Jardin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260928-for-upstream-caam-qi2-priority-v1-1-e4a8e5f01dbc@free.fr \
--to=devnull+vjardin.free.fr@kernel.org \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=gaurav.jain@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=krzk+dt@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pankaj.gupta@nxp.com \
--cc=robh@kernel.org \
--cc=sahil.malhotra@nxp.com \
--cc=vjardin@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®