Re: [PATCH v3 4/7] ufs: mcq: Add support for clean up mcq resources

From: Bart Van Assche
Date: Wed May 10 2023 - 18:01:06 EST


On 5/9/23 22:24, Bao D. Nguyen wrote:
+bool ufshcd_cmd_inflight(struct scsi_cmnd *cmd)
+{
+ struct request *rq;
+
+ if (!cmd)
+ return false;
+
+ rq = scsi_cmd_to_rq(cmd);
+ if (!rq || !blk_mq_request_started(rq))
+ return false;
+
+ return true;

The return value of scsi_cmd_to_rq() is never NULL so please remove the !rq test.

@@ -7450,8 +7499,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
ufshcd_hold(hba, false);
reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
- /* If command is already aborted/completed, return FAILED. */
- if (!(test_bit(tag, &hba->outstanding_reqs))) {
+ if (!is_mcq_enabled(hba) && !test_bit(tag, &hba->outstanding_reqs)) {
+ /* If command is already aborted/completed, return FAILED. */
dev_err(hba->dev,
"%s: cmd at tag %d already completed, outstanding=0x%lx, doorbell=0x%x\n",
__func__, tag, hba->outstanding_reqs, reg);

With the above change, the doorbell register is read even in MCQ mode. Shouldn't reading the doorbell register be skipped in MCQ mode?

Thanks,

Bart.