* [PATCH v1 1/1] scsi: ufs: mcq: Fix the search/wrap around logic
@ 2023-08-16 1:38 Bao D. Nguyen
2023-08-16 23:45 ` Bart Van Assche
0 siblings, 1 reply; 2+ messages in thread
From: Bao D. Nguyen @ 2023-08-16 1:38 UTC (permalink / raw)
To: quic_cang, quic_nitirawa, bvanassche, avri.altman, beanhuo,
stanley.chu, adrian.hunter, martin.petersen
Cc: linux-scsi, Bao D. Nguyen, Alim Akhtar, James E.J. Bottomley,
Manivannan Sadhasivam, Asutosh Das, Po-Wen Kao, Yang Li,
open list
The search and wrap around logic in the ufshcd_mcq_sqe_search()
function does not work correctly when the hwq's queue depth
is not a power of two number. Correct it so that any queue depth
with a positive integer value within the supported range would work.
Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
---
drivers/ufs/core/ufs-mcq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 66a4e24..2ba8ec2 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -578,7 +578,6 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
{
struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
struct utp_transfer_req_desc *utrd;
- u32 mask = hwq->max_entries - 1;
__le64 cmd_desc_base_addr;
bool ret = false;
u64 addr, match;
@@ -606,7 +605,10 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
ret = true;
goto out;
}
- sq_head_slot = (sq_head_slot + 1) & mask;
+
+ sq_head_slot++;
+ if (sq_head_slot == hwq->max_entries)
+ sq_head_slot = 0;
}
out:
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] scsi: ufs: mcq: Fix the search/wrap around logic
2023-08-16 1:38 [PATCH v1 1/1] scsi: ufs: mcq: Fix the search/wrap around logic Bao D. Nguyen
@ 2023-08-16 23:45 ` Bart Van Assche
0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2023-08-16 23:45 UTC (permalink / raw)
To: Bao D. Nguyen, quic_cang, quic_nitirawa, avri.altman, beanhuo,
stanley.chu, adrian.hunter, martin.petersen
Cc: linux-scsi, Alim Akhtar, James E.J. Bottomley,
Manivannan Sadhasivam, Asutosh Das, Po-Wen Kao, Yang Li,
open list
On 8/15/23 18:38, Bao D. Nguyen wrote:
> The search and wrap around logic in the ufshcd_mcq_sqe_search()
> function does not work correctly when the hwq's queue depth
> is not a power of two number. Correct it so that any queue depth
> with a positive integer value within the supported range would work.
Does this patch need a Fixes: tag?
Anyway:
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-16 23:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 1:38 [PATCH v1 1/1] scsi: ufs: mcq: Fix the search/wrap around logic Bao D. Nguyen
2023-08-16 23:45 ` Bart Van Assche
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).