public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
@ 2025-11-20 13:21 Chenghai Huang
  2025-12-19  6:56 ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Chenghai Huang @ 2025-11-20 13:21 UTC (permalink / raw)
  To: herbert, davem
  Cc: linux-kernel, linux-crypto, linuxarm, liulongfang, qianweili,
	linwenkai6, wangzhou1

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")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
---
 drivers/crypto/hisilicon/qm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 8533384e3eaa..56bbb46f1877 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -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);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
  2025-11-20 13:21 [PATCH] crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num() Chenghai Huang
@ 2025-12-19  6:56 ` Herbert Xu
  2025-12-22  3:00   ` huangchenghai
  0 siblings, 1 reply; 6+ messages in thread
From: Herbert Xu @ 2025-12-19  6:56 UTC (permalink / raw)
  To: Chenghai Huang
  Cc: davem, linux-kernel, linux-crypto, linuxarm, liulongfang,
	qianweili, linwenkai6, wangzhou1

On Thu, Nov 20, 2025 at 09:21:24PM +0800, Chenghai Huang wrote:
> 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")
> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
> ---
>  drivers/crypto/hisilicon/qm.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Patch applied.  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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
  2025-12-19  6:56 ` Herbert Xu
@ 2025-12-22  3:00   ` huangchenghai
  2025-12-22  4:22     ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: huangchenghai @ 2025-12-22  3:00 UTC (permalink / raw)
  To: Herbert Xu
  Cc: davem, linux-kernel, linux-crypto, linuxarm, liulongfang,
	qianweili, linwenkai6, wangzhou1


在 2025/12/19 14:56, Herbert Xu 写道:
> On Thu, Nov 20, 2025 at 09:21:24PM +0800, Chenghai Huang wrote:
>> 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")
>> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
>> ---
>>   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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
  2025-12-22  3:00   ` huangchenghai
@ 2025-12-22  4:22     ` Herbert Xu
  2025-12-23  1:46       ` huangchenghai
  0 siblings, 1 reply; 6+ messages in thread
From: Herbert Xu @ 2025-12-22  4:22 UTC (permalink / raw)
  To: huangchenghai
  Cc: davem, linux-kernel, linux-crypto, linuxarm, liulongfang,
	qianweili, linwenkai6, wangzhou1

On Mon, Dec 22, 2025 at 11:00:28AM +0800, huangchenghai wrote:
> 
> 在 2025/12/19 14:56, Herbert Xu 写道:
> > On Thu, Nov 20, 2025 at 09:21:24PM +0800, Chenghai Huang wrote:
> > > 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")
> > > Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
> > > ---
> > >   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?

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

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
  2025-12-22  4:22     ` Herbert Xu
@ 2025-12-23  1:46       ` huangchenghai
  2025-12-24  2:52         ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: huangchenghai @ 2025-12-23  1:46 UTC (permalink / raw)
  To: Herbert Xu
  Cc: davem, linux-kernel, linux-crypto, liulongfang, qianweili,
	linwenkai6, wangzhou1


在 2025/12/22 12:22, Herbert Xu 写道:
> On Mon, Dec 22, 2025 at 11:00:28AM +0800, huangchenghai wrote:
>> 在 2025/12/19 14:56, Herbert Xu 写道:
>>> On Thu, Nov 20, 2025 at 09:21:24PM +0800, Chenghai Huang wrote:
>>>> 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")
>>>> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
>>>> ---
>>>>    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?
> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
  2025-12-23  1:46       ` huangchenghai
@ 2025-12-24  2:52         ` Herbert Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2025-12-24  2:52 UTC (permalink / raw)
  To: huangchenghai
  Cc: davem, linux-kernel, linux-crypto, liulongfang, qianweili,
	linwenkai6, wangzhou1

On Tue, Dec 23, 2025 at 09:46:31AM +0800, huangchenghai wrote:
>
> 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,
-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-12-24  2:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-20 13:21 [PATCH] crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num() Chenghai Huang
2025-12-19  6:56 ` Herbert Xu
2025-12-22  3:00   ` huangchenghai
2025-12-22  4:22     ` Herbert Xu
2025-12-23  1:46       ` huangchenghai
2025-12-24  2:52         ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox