Skip to contentSkip to conversation

crypto: eip93: fix sleep inside spinlock

PATCH In review Qingfang Deng 1 participant 2 messages Dec 3, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: eip93: fix sleep inside spinlock

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")
---
 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(-)
drivers/crypto/inside-secure/eip93/eip93-common.c +1 -4
index 66153aa2493f..00772c7be189 100644
@@ -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);
drivers/crypto/inside-secure/eip93/eip93-hash.c +1 -4
index ac13d90a2b7c..13b723bb9830 100644
@@ -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);
drivers/crypto/inside-secure/eip93/eip93-main.h +0 -2
index 79b078f0e5da..45afeaa51d00 100644
@@ -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
Signature · 1 line
2.43.0
#1 lore raw

Please disregard the patch, as I found out the issue is that crypto_async_request can be in an atomic context, so the driver is not allowed to sleep unless CRYPTO_TFM_REQ_MAY_SLEEP is set. I'll send v2 with an updated message.

Regards,
Qingfang