From: Horia Geanta <horia.geanta@nxp.com>
To: Iuliana Prodan <iuliana.prodan@nxp.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Aymen Sghaier <aymen.sghaier@nxp.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Silvano Di Ninno <silvano.dininno@nxp.com>,
Franck Lenormand <franck.lenormand@nxp.com>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
dl-linux-imx <linux-imx@nxp.com>
Subject: Re: [PATCH v5 6/9] crypto: caam - support crypto_engine framework for SKCIPHER algorithms
Date: Tue, 11 Feb 2020 09:51:20 +0000 [thread overview]
Message-ID: <VI1PR0402MB3485F56EEA82139A2BCF698F98180@VI1PR0402MB3485.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 1580345364-7606-7-git-send-email-iuliana.prodan@nxp.com
On 1/30/2020 2:49 AM, Iuliana Prodan wrote:
> @@ -1618,6 +1636,8 @@ static struct skcipher_edesc *skcipher_edesc_alloc(struct skcipher_request *req,
> edesc->sec4_sg_bytes = sec4_sg_bytes;
> edesc->sec4_sg = (struct sec4_sg_entry *)((u8 *)edesc->hw_desc +
> desc_bytes);
> + edesc->bklog = false;
Since edesc is allocated using kzalloc(), this is redundant.
> @@ -3236,7 +3288,9 @@ static int caam_init_common(struct caam_ctx *ctx, struct caam_alg_entry *caam,
>
> dma_addr = dma_map_single_attrs(ctx->jrdev, ctx->sh_desc_enc,
> offsetof(struct caam_ctx,
> - sh_desc_enc_dma),
> + sh_desc_enc_dma) -
> + offsetof(struct caam_ctx,
> + sh_desc_enc),
> ctx->dir, DMA_ATTR_SKIP_CPU_SYNC);
> if (dma_mapping_error(ctx->jrdev, dma_addr)) {
> dev_err(ctx->jrdev, "unable to map key, shared descriptors\n");
> @@ -3246,8 +3300,12 @@ static int caam_init_common(struct caam_ctx *ctx, struct caam_alg_entry *caam,
>
> ctx->sh_desc_enc_dma = dma_addr;
> ctx->sh_desc_dec_dma = dma_addr + offsetof(struct caam_ctx,
> - sh_desc_dec);
> - ctx->key_dma = dma_addr + offsetof(struct caam_ctx, key);
> + sh_desc_dec) -
> + offsetof(struct caam_ctx,
> + sh_desc_enc);
> + ctx->key_dma = dma_addr + offsetof(struct caam_ctx, key) -
> + offsetof(struct caam_ctx,
> + sh_desc_enc);
Let's make this clearer by using a local variable for
offsetof(struct caam_ctx, sh_desc_enc).
> @@ -538,6 +547,26 @@ static int caam_jr_probe(struct platform_device *pdev)
> return error;
> }
>
> + /* Initialize crypto engine */
> + jrpriv->engine = crypto_engine_alloc_init(jrdev, false);
> + if (!jrpriv->engine) {
> + dev_err(jrdev, "Could not init crypto-engine\n");
> + return -ENOMEM;
> + }
> +
> + /* Start crypto engine */
> + error = crypto_engine_start(jrpriv->engine);
> + if (error) {
> + dev_err(jrdev, "Could not start crypto-engine\n");
> + crypto_engine_exit(jrpriv->engine);
> + return error;
> + }
> +
> + error = devm_add_action_or_reset(jrdev, caam_jr_crypto_engine_exit,
> + jrdev);
> + if (error)
> + return error;
This should be moved right after crypto_engine_alloc_init(),
and crypto_engine_exit() should be removed from
crypto_engine_start() error path.
Horia
next prev parent reply other threads:[~2020-02-11 9:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 0:49 [PATCH v5 0/9] crypto: caam - backlogging support Iuliana Prodan
2020-01-30 0:49 ` [PATCH v5 1/9] crypto: caam - refactor skcipher/aead/gcm/chachapoly {en,de}crypt functions Iuliana Prodan
2020-01-30 0:49 ` [PATCH v5 2/9] crypto: caam - refactor ahash_done callbacks Iuliana Prodan
2020-01-30 0:49 ` [PATCH v5 3/9] crypto: caam - refactor ahash_edesc_alloc Iuliana Prodan
2020-01-30 0:49 ` [PATCH v5 4/9] crypto: caam - refactor RSA private key _done callbacks Iuliana Prodan
2020-01-30 0:49 ` [PATCH v5 5/9] crypto: caam - change return code in caam_jr_enqueue function Iuliana Prodan
2020-01-30 0:49 ` [PATCH v5 6/9] crypto: caam - support crypto_engine framework for SKCIPHER algorithms Iuliana Prodan
2020-02-11 9:51 ` Horia Geanta [this message]
2020-01-30 0:49 ` [PATCH v5 7/9] crypto: caam - add crypto_engine support for AEAD algorithms Iuliana Prodan
2020-02-11 10:09 ` Horia Geanta
2020-01-30 0:49 ` [PATCH v5 8/9] crypto: caam - add crypto_engine support for RSA algorithms Iuliana Prodan
2020-02-11 10:23 ` Horia Geanta
2020-01-30 0:49 ` [PATCH v5 9/9] crypto: caam - add crypto_engine support for HASH algorithms Iuliana Prodan
2020-02-11 12:25 ` Horia Geanta
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=VI1PR0402MB3485F56EEA82139A2BCF698F98180@VI1PR0402MB3485.eurprd04.prod.outlook.com \
--to=horia.geanta@nxp.com \
--cc=aymen.sghaier@nxp.com \
--cc=davem@davemloft.net \
--cc=franck.lenormand@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=iuliana.prodan@nxp.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=silvano.dininno@nxp.com \
/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;
as well as URLs for NNTP newsgroup(s).