Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: ufs: mcq: Fix the search/wrap around logic

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>
Link: https://lore.kernel.org/r/ff49c15be205135ed3ec186f3086694c02867dbd.1692149603.git.quic_nguyenb@quicinc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Fixes: 8d7290348992 ("scsi: ufs: mcq: Add supporting functions for MCQ abort")
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bao D. Nguyen and committed by
Martin K. Petersen
d0c89af3 ef222f55

+4 -2
+4 -2
drivers/ufs/core/ufs-mcq.c
··· 580 580 { 581 581 struct ufshcd_lrb *lrbp = &hba->lrb[task_tag]; 582 582 struct utp_transfer_req_desc *utrd; 583 - u32 mask = hwq->max_entries - 1; 584 583 __le64 cmd_desc_base_addr; 585 584 bool ret = false; 586 585 u64 addr, match; ··· 607 608 ret = true; 608 609 goto out; 609 610 } 610 - sq_head_slot = (sq_head_slot + 1) & mask; 611 + 612 + sq_head_slot++; 613 + if (sq_head_slot == hwq->max_entries) 614 + sq_head_slot = 0; 611 615 } 612 616 613 617 out: