Skip to content

Commit 1a5665f

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: core: WLUN suspend SSU/enter hibern8 fail recovery
When SSU/enter hibern8 fail in WLUN suspend flow, trigger the error handler and return busy to break the suspend. Otherwise the consumer will get stuck in runtime suspend status. Fixes: b294ff3 ("scsi: ufs: core: Enable power management for wlun") Signed-off-by: Peter Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Stanley Chu <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Adrian Hunter <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent c411a42 commit 1a5665f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6056,6 +6056,14 @@ void ufshcd_schedule_eh_work(struct ufs_hba *hba)
60566056
}
60576057
}
60586058

6059+
static void ufshcd_force_error_recovery(struct ufs_hba *hba)
6060+
{
6061+
spin_lock_irq(hba->host->host_lock);
6062+
hba->force_reset = true;
6063+
ufshcd_schedule_eh_work(hba);
6064+
spin_unlock_irq(hba->host->host_lock);
6065+
}
6066+
60596067
static void ufshcd_clk_scaling_allow(struct ufs_hba *hba, bool allow)
60606068
{
60616069
down_write(&hba->clk_scaling_lock);
@@ -9083,6 +9091,15 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
90839091

90849092
if (!hba->dev_info.b_rpm_dev_flush_capable) {
90859093
ret = ufshcd_set_dev_pwr_mode(hba, req_dev_pwr_mode);
9094+
if (ret && pm_op != UFS_SHUTDOWN_PM) {
9095+
/*
9096+
* If return err in suspend flow, IO will hang.
9097+
* Trigger error handler and break suspend for
9098+
* error recovery.
9099+
*/
9100+
ufshcd_force_error_recovery(hba);
9101+
ret = -EBUSY;
9102+
}
90869103
if (ret)
90879104
goto enable_scaling;
90889105
}
@@ -9094,6 +9111,15 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
90949111
*/
90959112
check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba);
90969113
ret = ufshcd_link_state_transition(hba, req_link_state, check_for_bkops);
9114+
if (ret && pm_op != UFS_SHUTDOWN_PM) {
9115+
/*
9116+
* If return err in suspend flow, IO will hang.
9117+
* Trigger error handler and break suspend for
9118+
* error recovery.
9119+
*/
9120+
ufshcd_force_error_recovery(hba);
9121+
ret = -EBUSY;
9122+
}
90979123
if (ret)
90989124
goto set_dev_active;
90999125

0 commit comments

Comments
 (0)