Skip to contentSkip to conversation

crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()

PATCH In review Chenghai Huang 2 participants 6 messages Nov 20, 2025 – Dec 24, 2025

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

PATCH 1/1 crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()

In qm_get_complete_eqe_num(), the function entry has already checked whether the interrupt is valid, so the interrupt event can be processed directly. Currently, the interrupt valid bit is being checked again redundantly, and no interrupt processing is performed. Therefore, the loop condition should be modified to directly process the interrupt event, and use do while instead of the current while loop, because the condition is always satisfied on the first iteration.

Fixes f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")
---
 drivers/crypto/hisilicon/qm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/crypto/hisilicon/qm.c +4 -5
index 8533384e3eaa..56bbb46f1877 100644
@@ -991,7 +991,7 @@ static void qm_get_complete_eqe_num(struct hisi_qm *qm)
 		return;
 	poll_data = &qm->poll_data[cqn];
 
-	while (QM_EQE_PHASE(dw0) != qm->status.eqc_phase) {
+	do {
 		poll_data->qp_finish_id[eqe_num] = dw0 & QM_EQE_CQN_MASK;
 		eqe_num++;
 
@@ -1004,11 +1004,10 @@ static void qm_get_complete_eqe_num(struct hisi_qm *qm)
 			qm->status.eq_head++;
 		}
 
-		if (eqe_num == (eq_depth >> 1) - 1)
-			break;
-
 		dw0 = le32_to_cpu(eqe->dw0);
-	}
+		if (QM_EQE_PHASE(dw0) != qm->status.eqc_phase)
+			break;
+	} while (eqe_num < (eq_depth >> 1) - 1);
 
 	poll_data->eqe_num = eqe_num;
 	queue_work(qm->wq, &poll_data->work);
Signature · 1 line
2.33.0
maintainer
#1 lore raw
Quoted 9 lines · Chenghai Huang

In qm_get_complete_eqe_num(), the function entry has already checked whether the interrupt is valid, so the interrupt event can be processed directly. Currently, the interrupt valid bit is being checked again redundantly, and no interrupt processing is performed. Therefore, the loop condition should be modified to directly process the interrupt event, and use do while instead of the current while loop, because the condition is always satisfied on the first iteration.

Quoted 5 lines
Fixes f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")
---
 drivers/crypto/hisilicon/qm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
Quoted 10 lines · Herbert Xu
Quoted 9 lines · Chenghai Huang

In qm_get_complete_eqe_num(), the function entry has already checked whether the interrupt is valid, so the interrupt event can be processed directly. Currently, the interrupt valid bit is being checked again redundantly, and no interrupt processing is performed. Therefore, the loop condition should be modified to directly process the interrupt event, and use do while instead of the current while loop, because the condition is always satisfied on the first iteration.

Quoted 6 lines
Quoted 5 lines
Fixes f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")
---
  drivers/crypto/hisilicon/qm.c | 9 ++++-----
  1 file changed, 4 insertions(+), 5 deletions(-)

Patch applied. Thanks.

This patch addresses an issue specific to version 6.19.

Could you please help including this patch in the 6.19?

Thanks,
Chenghai

maintainer
#3 lore raw
Quoted 17 lines · huangchenghai
Quoted 15 lines · Herbert Xu
Quoted 14 lines · Chenghai Huang

In qm_get_complete_eqe_num(), the function entry has already checked whether the interrupt is valid, so the interrupt event can be processed directly. Currently, the interrupt valid bit is being checked again redundantly, and no interrupt processing is performed. Therefore, the loop condition should be modified to directly process the interrupt event, and use do while instead of the current while loop, because the condition is always satisfied on the first iteration.

Fixes f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")
---
  drivers/crypto/hisilicon/qm.c | 9 ++++-----
  1 file changed, 4 insertions(+), 5 deletions(-)
Quoted 5 lines
Quoted 1 line

Patch applied. Thanks.

This patch addresses an issue specific to version 6.19.

Could you please help including this patch in the 6.19?

The patch looked like a clean-up rather than a bug fix.

Could you please explain how it makes any difference at all?

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#4 lore raw
Quoted 18 lines · Herbert Xu
Quoted 17 lines · huangchenghai
Quoted 16 lines · Herbert Xu
Quoted 9 lines · Chenghai Huang

In qm_get_complete_eqe_num(), the function entry has already checked whether the interrupt is valid, so the interrupt event can be processed directly. Currently, the interrupt valid bit is being checked again redundantly, and no interrupt processing is performed. Therefore, the loop condition should be modified to directly process the interrupt event, and use do while instead of the current while loop, because the condition is always satisfied on the first iteration.

Quoted 5 lines
Fixes f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")
---
   drivers/crypto/hisilicon/qm.c | 9 ++++-----
   1 file changed, 4 insertions(+), 5 deletions(-)

Patch applied. Thanks.

Quoted 8 lines
Quoted 3 lines

This patch addresses an issue specific to version 6.19.

Could you please help including this patch in the 6.19?

The patch looked like a clean-up rather than a bug fix.

Could you please explain how it makes any difference at all?

Thanks,

Commit f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")

introduced an incorrect condition check, which prevents

the while loop from being entered to handle interrupt tasks.

Normally, the code should enter the while loop to process these tasks.

Chenghai

maintainer
#5 lore raw
Quoted 9 lines · huangchenghai

Commit f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")

introduced an incorrect condition check, which prevents

the while loop from being entered to handle interrupt tasks.

Normally, the code should enter the while loop to process these tasks.

I see. The original patch description threw me off as I thought the loop condition was simply redundant, rather than inverted :)

I will add this for 6.19.

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt