The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Qingfang Deng <dqfext@gmail.com>
To: Christian Marangi <ansuelsmth@gmail.com>,
	Antoine Tenart <atenart@kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Richard van Schagen <vschagen@icloud.com>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] crypto: eip93: fix sleep inside spinlock
Date: Wed,  3 Dec 2025 11:11:17 +0800	[thread overview]
Message-ID: <20251203031118.32421-1-dqfext@gmail.com> (raw)

When busy waiting, usleep_range() is called in ring->write_lock's
critical section. Remove the sleep.

Fixes: 9739f5f93b78 ("crypto: eip93 - Add Inside Secure SafeXcel EIP-93 crypto engine support")
Signed-off-by: Qingfang Deng <dqfext@gmail.com>
---
 drivers/crypto/inside-secure/eip93/eip93-common.c | 5 +----
 drivers/crypto/inside-secure/eip93/eip93-hash.c   | 5 +----
 drivers/crypto/inside-secure/eip93/eip93-main.h   | 2 --
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/inside-secure/eip93/eip93-common.c b/drivers/crypto/inside-secure/eip93/eip93-common.c
index 66153aa2493f..00772c7be189 100644
--- a/drivers/crypto/inside-secure/eip93/eip93-common.c
+++ b/drivers/crypto/inside-secure/eip93/eip93-common.c
@@ -496,11 +496,8 @@ static int eip93_scatter_combine(struct eip93_device *eip93,
 again:
 		scoped_guard(spinlock_irqsave, &eip93->ring->write_lock)
 			err = eip93_put_descriptor(eip93, cdesc);
-		if (err) {
-			usleep_range(EIP93_RING_BUSY_DELAY,
-				     EIP93_RING_BUSY_DELAY * 2);
+		if (err)
 			goto again;
-		}
 		/* Writing new descriptor count starts DMA action */
 		writel(1, eip93->base + EIP93_REG_PE_CD_COUNT);
 	} while (n);
diff --git a/drivers/crypto/inside-secure/eip93/eip93-hash.c b/drivers/crypto/inside-secure/eip93/eip93-hash.c
index ac13d90a2b7c..13b723bb9830 100644
--- a/drivers/crypto/inside-secure/eip93/eip93-hash.c
+++ b/drivers/crypto/inside-secure/eip93/eip93-hash.c
@@ -270,11 +270,8 @@ static int eip93_send_hash_req(struct crypto_async_request *async, u8 *data,
 again:
 	scoped_guard(spinlock_irqsave, &eip93->ring->write_lock)
 		ret = eip93_put_descriptor(eip93, &cdesc);
-	if (ret) {
-		usleep_range(EIP93_RING_BUSY_DELAY,
-			     EIP93_RING_BUSY_DELAY * 2);
+	if (ret)
 		goto again;
-	}
 
 	/* Writing new descriptor count starts DMA action */
 	writel(1, eip93->base + EIP93_REG_PE_CD_COUNT);
diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.h b/drivers/crypto/inside-secure/eip93/eip93-main.h
index 79b078f0e5da..45afeaa51d00 100644
--- a/drivers/crypto/inside-secure/eip93/eip93-main.h
+++ b/drivers/crypto/inside-secure/eip93/eip93-main.h
@@ -14,8 +14,6 @@
 #include <linux/bitfield.h>
 #include <linux/interrupt.h>
 
-#define EIP93_RING_BUSY_DELAY		500
-
 #define EIP93_RING_NUM			512
 #define EIP93_RING_BUSY			32
 #define EIP93_CRA_PRIORITY		1500
-- 
2.43.0


             reply	other threads:[~2025-12-03  3:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03  3:11 Qingfang Deng [this message]
2025-12-03 11:45 ` [PATCH] crypto: eip93: fix sleep inside spinlock Qingfang Deng

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=20251203031118.32421-1-dqfext@gmail.com \
    --to=dqfext@gmail.com \
    --cc=ansuelsmth@gmail.com \
    --cc=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vschagen@icloud.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