scsi: ufs: core: Remove dev cmd clock scaling busy
authorPeter Wang <peter.wang@mediatek.com>
Wed, 4 Oct 2023 06:24:54 +0000 (14:24 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 10 Oct 2023 01:37:23 +0000 (21:37 -0400)
If a dev command times out, clk_scaling.active_reqs is not decreased which
causes abnormal clock scaling.

It is complicated to handle different dev command timeout cases in both
legacy mode and MCQ mode. Besides, dev cmds are rarely used and the busy
time is short.

Remove clock scaling busy window for dev cmds like we do for UIC or TM cmds
which don't update busy window either.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20231004062454.29165-1-peter.wang@mediatek.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c

index 1839e188a2c5fe8978d6b60906858667645aa46a..c45737c5adb90533adb00ab93a559c631d8f6fce 100644 (file)
@@ -2165,7 +2165,8 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag,
        lrbp->compl_time_stamp = ktime_set(0, 0);
        lrbp->compl_time_stamp_local_clock = 0;
        ufshcd_add_command_trace(hba, task_tag, UFS_CMD_SEND);
-       ufshcd_clk_scaling_start_busy(hba);
+       if (lrbp->cmd)
+               ufshcd_clk_scaling_start_busy(hba);
        if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
                ufshcd_start_monitor(hba, lrbp);
 
@@ -5401,7 +5402,6 @@ void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag,
                                lrbp->utr_descriptor_ptr->header.ocs = ocs;
                        }
                        complete(hba->dev_cmd.complete);
-                       ufshcd_clk_scaling_update_busy(hba);
                }
        }
 }