public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Pavitrakumar Managutte <pavitrakumarm@vayavyalabs.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	Ruud.Derwig@synopsys.com, manjunath.hadli@vayavyalabs.com,
	adityak@vayavyalabs.com, navami.telsang@vayavyalabs.com,
	bhoomikak@vayavyalabs.com
Subject: Re: [PATCH v12 2/4] crypto: spacc - Add SPAcc ahash support
Date: Tue, 5 May 2026 11:31:32 +0800	[thread overview]
Message-ID: <aflklGva2ZoAz-A9@gondor.apana.org.au> (raw)
In-Reply-To: <20260416064451.99886-3-pavitrakumarm@vayavyalabs.com>

On Thu, Apr 16, 2026 at 12:14:49PM +0530, Pavitrakumar Managutte wrote:
>
> +/*
> + * Allocate a job for spacc module context and initialize
> + * it with an appropriate type.
> + */
> +int spacc_open(struct spacc_device *spacc, int enc, int hash, int ctxid,
> +	       int secure_mode, spacc_callback cb, void *cbdata)
> +{
> +	size_t i;
> +	int ret = 0;
> +	u32 ctrl = 0;
> +	int job_idx = 0;
> +	bool ctx_reused = false;
> +	struct spacc_job *job = NULL;
> +	const struct enc_config *enc_cfg = NULL;
> +	const struct hash_config *hash_cfg = NULL;
> +	unsigned long flags;
> +
> +	/*
> +	 * Acquire the semaphore. This will decrement the count. If the count
> +	 * is already zero (meaning all HW contexts are in use), this call
> +	 * will sleep interruptibly until another thread calls up().
> +	 */
> +	if (down_interruptible(&spacc->ctx_sem)) {
> +		dev_dbg(spacc->dptr, "ERR: Interrupted by signal\n");
> +		return -ERESTARTSYS; /* Woken by a signal */
> +	}

This may sleep.  While we used to allow sleeping in setkey, this
is being phased out so new drivers should not do that.

This also raises the question of whether spacc_open should even
be called from setkey.  The setkey call could be very far away
from the actual hash processing, so allocating a handle in setkey
seems to be a waste.

As you can allocate handles from do_one_request, why not just do
that always?

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2026-05-05  3:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16  6:44 [PATCH v12 0/4] crypto: spacc - Add SPAcc Crypto Driver Pavitrakumar Managutte
2026-04-16  6:44 ` [PATCH v12 1/4] dt-bindings: crypto: Document support for SPAcc Pavitrakumar Managutte
2026-04-16  6:44 ` [PATCH v12 2/4] crypto: spacc - Add SPAcc ahash support Pavitrakumar Managutte
2026-05-05  3:31   ` Herbert Xu [this message]
2026-04-16  6:44 ` [PATCH v12 3/4] crypto: spacc - Add SPAcc AUTODETECT Support Pavitrakumar Managutte
2026-04-16  6:44 ` [PATCH v12 4/4] crypto: spacc - Add SPAcc Kconfig and Makefile Pavitrakumar Managutte
2026-04-29 10:06 ` [PATCH v12 0/4] crypto: spacc - Add SPAcc Crypto Driver Pavitrakumar Managutte

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=aflklGva2ZoAz-A9@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=Ruud.Derwig@synopsys.com \
    --cc=adityak@vayavyalabs.com \
    --cc=bhoomikak@vayavyalabs.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manjunath.hadli@vayavyalabs.com \
    --cc=navami.telsang@vayavyalabs.com \
    --cc=pavitrakumarm@vayavyalabs.com \
    --cc=robh@kernel.org \
    /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