Revert "crypto: hisilicon - Kunpeng916 crypto driver don't sleep when in softirq"

This reverts commit cf411bcc65.

Revert to facilitate integration of higher version drivers: 1.3.11

Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
Reviewed-by: Chun Liu <kaicliu@tencent.com>
Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
This commit is contained in:
Jinliang Zheng 2024-04-25 16:21:44 +08:00 committed by Jianping Liu
parent a5d4379c97
commit 3f292f4946
2 changed files with 8 additions and 8 deletions

View File

@ -449,7 +449,7 @@ static void sec_skcipher_alg_callback(struct sec_bd_info *sec_resp,
*/ */
} }
spin_lock_bh(&ctx->queue->queuelock); mutex_lock(&ctx->queue->queuelock);
/* Put the IV in place for chained cases */ /* Put the IV in place for chained cases */
switch (ctx->cipher_alg) { switch (ctx->cipher_alg) {
case SEC_C_AES_CBC_128: case SEC_C_AES_CBC_128:
@ -509,7 +509,7 @@ static void sec_skcipher_alg_callback(struct sec_bd_info *sec_resp,
list_del(&backlog_req->backlog_head); list_del(&backlog_req->backlog_head);
} }
} }
spin_unlock_bh(&ctx->queue->queuelock); mutex_unlock(&ctx->queue->queuelock);
mutex_lock(&sec_req->lock); mutex_lock(&sec_req->lock);
list_del(&sec_req_el->head); list_del(&sec_req_el->head);
@ -798,7 +798,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq,
*/ */
/* Grab a big lock for a long time to avoid concurrency issues */ /* Grab a big lock for a long time to avoid concurrency issues */
spin_lock_bh(&queue->queuelock); mutex_lock(&queue->queuelock);
/* /*
* Can go on to queue if we have space in either: * Can go on to queue if we have space in either:
@ -814,15 +814,15 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq,
ret = -EBUSY; ret = -EBUSY;
if ((skreq->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) { if ((skreq->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) {
list_add_tail(&sec_req->backlog_head, &ctx->backlog); list_add_tail(&sec_req->backlog_head, &ctx->backlog);
spin_unlock_bh(&queue->queuelock); mutex_unlock(&queue->queuelock);
goto out; goto out;
} }
spin_unlock_bh(&queue->queuelock); mutex_unlock(&queue->queuelock);
goto err_free_elements; goto err_free_elements;
} }
ret = sec_send_request(sec_req, queue); ret = sec_send_request(sec_req, queue);
spin_unlock_bh(&queue->queuelock); mutex_unlock(&queue->queuelock);
if (ret) if (ret)
goto err_free_elements; goto err_free_elements;
@ -881,7 +881,7 @@ static int sec_alg_skcipher_init(struct crypto_skcipher *tfm)
if (IS_ERR(ctx->queue)) if (IS_ERR(ctx->queue))
return PTR_ERR(ctx->queue); return PTR_ERR(ctx->queue);
spin_lock_init(&ctx->queue->queuelock); mutex_init(&ctx->queue->queuelock);
ctx->queue->havesoftqueue = false; ctx->queue->havesoftqueue = false;
return 0; return 0;

View File

@ -347,7 +347,7 @@ struct sec_queue {
DECLARE_BITMAP(unprocessed, SEC_QUEUE_LEN); DECLARE_BITMAP(unprocessed, SEC_QUEUE_LEN);
DECLARE_KFIFO_PTR(softqueue, typeof(struct sec_request_el *)); DECLARE_KFIFO_PTR(softqueue, typeof(struct sec_request_el *));
bool havesoftqueue; bool havesoftqueue;
spinlock_t queuelock; struct mutex queuelock;
void *shadow[SEC_QUEUE_LEN]; void *shadow[SEC_QUEUE_LEN];
}; };