Linux cryptographic layer development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "T Pratham" <t-pratham@ti.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: "Sebin Francis" <sebin.francis@ti.com>,
	"Manorit Chawdhry" <m-chawdhry@ti.com>,
	"Vishal Mahaveer" <vishalm@ti.com>,
	"Praneeth Bajjuri" <praneeth@ti.com>,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH v10 1/2] crypto: ti - Add support for SHA224/256/384/512 in DTHEv2 driver
Date: Mon, 23 Nov 2026 14:51:05 +0000	[thread overview]
Message-ID: <sashiko-outbox-229446@kernel.org> (raw)
In-Reply-To: <20261123142918.3451969-2-t-pratham@ti.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] crypto: ti - HZ passed as microsecond timeout to
  readl_relaxed_poll_timeout()
- [Low] crypto: ti - open-coded DMA callback assignment in
  dthe_hash_dma_start()
- [Low] crypto: ti - kernel-doc warnings from /** comments in
  dthev2-hash.c
--

commit 126808907819f62702aad01a36f54c290b6711fe
Author: T Pratham <t-pratham@ti.com>

crypto: ti - Add support for SHA224/256/384/512 in DTHEv2 driver

This commit adds ahash support for SHA224, SHA256, SHA384, and SHA512
using the DTHEv2 hashing engine and separates the AES and hash crypto
engine instances.

> diff --git a/drivers/crypto/ti/dthev2-common.h b/drivers/crypto/ti/dthev2-common.h
> index f1b0396b322a0..8d243006d4dd2 100644
> --- a/drivers/crypto/ti/dthev2-common.h
> +++ b/drivers/crypto/ti/dthev2-common.h
> @@ -24,16 +25,28 @@
>  #include <linux/dmapool.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/io.h>
> +#include <linux/iopoll.h>
>  #include <linux/scatterlist.h>
>  
>  #define DTHE_REG_SIZE		4
>  #define DTHE_DMA_TIMEOUT_MS	2000
> +#define DTHE_POLL_TIMEOUT_INTERVAL	HZ

[Severity: Medium]
Should DTHE_POLL_TIMEOUT_INTERVAL be defined in microseconds (such as
USEC_PER_SEC) instead of HZ?

dthe_hash_dma_start() and dthe_aead_read_tag() pass
DTHE_POLL_TIMEOUT_INTERVAL as the timeout_us argument to
readl_relaxed_poll_timeout(), which evaluates the timeout in microseconds
rather than jiffies.  A timeout of HZ microseconds (100 to 1000 us) can
cause spurious -ETIMEDOUT failures if the crypto engine worker thread is
preempted while polling for hardware completion.

[ ... ]

> diff --git a/drivers/crypto/ti/dthev2-hash.c b/drivers/crypto/ti/dthev2-hash.c
> new file mode 100644
> index 0000000000000..ac6119e4e4d68
> --- /dev/null
> +++ b/drivers/crypto/ti/dthev2-hash.c

[ ... ]

> +static int dthe_hash_dma_start(struct ahash_request *req, struct scatterlist *src,
> +			       int src_nents, size_t len)
> +{

[ ... ]

> +	desc_out = dmaengine_prep_slave_sg(dev_data->dma_sha_tx, src, mapped_nents,
> +					   DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> +	if (!desc_out) {
> +		dev_err(dev_data->dev, "OUT prep_slave_sg() failed\n");
> +		ret = -EINVAL;
> +		goto hash_prep_err;
> +	}
> +
> +	desc_out->callback = dthe_hash_dma_in_callback;
> +	desc_out->callback_param = req;

[Severity: Low]
This isn't a bug, but should this use dmaengine_desc_set_callback() like
dthe_aes_run() does, instead of accessing desc_out->callback and
desc_out->callback_param directly?

[ ... ]

> +	/* Poll output ready status register */
> +	if (!ret)
> +		ret = readl_relaxed_poll_timeout(sha_base_reg + DTHE_P_HASH_IRQSTATUS, _status,
> +						 (_status & DTHE_HASH_IRQSTATUS_OP_READY),
> +						 0, DTHE_POLL_TIMEOUT_INTERVAL);
> +
> +	/**
> +	 * We need to read the output registers even in case of failure (ret != 0) to clear
> +	 * them properly for future operations. But the function returning a non-zero value
> +	 * should indicate that something went wrong and the result value should not be used.
> +	 */

[Severity: Low]
This comment and a similar comment in dthe_hash_final() start with "/**"
instead of "/*", which causes scripts/kernel-doc warnings under W=1 builds.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123142918.3451969-1-t-pratham@ti.com?part=1

  reply	other threads:[~2026-11-23 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 14:29 [PATCH v10 0/2] Add support for hashing algorithms in TI DTHE V2 T Pratham
2026-11-23 14:29 ` [PATCH v10 1/2] crypto: ti - Add support for SHA224/256/384/512 in DTHEv2 driver T Pratham
2026-11-23 14:51   ` sashiko-bot [this message]
2026-11-23 14:29 ` [PATCH v10 2/2] crypto: ti - Add support for HMAC " T Pratham
2026-11-23 14:50   ` sashiko-bot

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=sashiko-outbox-229446@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=m-chawdhry@ti.com \
    --cc=praneeth@ti.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sebin.francis@ti.com \
    --cc=t-pratham@ti.com \
    --cc=vishalm@ti.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