Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c3b3ab9 authored by Can Guo's avatar Can Guo
Browse files

scsi: ufs: Narrow down fast pass in system suspend path



If spm_lvl is set to 0 or 1, when system suspend kicks start and hba is
runtime active, system suspend may just bail without doing anything (the
fast pass), leaving other contexts still running, e.g., clock gating and
clock scaling. When system resume kicks start, concurrency can happen btw
ufshcd_resume() and these contexts, leading to various stability issues.
Fix it by adding a check against hba's runtime status and allowing fast
pass only if hba is runtime suspended, otherwise let system suspend go
ahead call ufshcd_suspend(). This can guarantee that these contexts are
stopped by either runtime suspend or system suspend.

Change-Id: I4fb08a2224774cba849c5e8cefe9f0971595d84b
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
parent 46bc219c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -9072,7 +9072,8 @@ int ufshcd_system_suspend(struct ufs_hba *hba)
	if (!hba || !hba->is_powered)
		return 0;

	if ((ufs_get_pm_lvl_to_dev_pwr_mode(hba->spm_lvl) ==
	if (pm_runtime_suspended(hba->dev) &&
	    (ufs_get_pm_lvl_to_dev_pwr_mode(hba->spm_lvl) ==
	     hba->curr_dev_pwr_mode) &&
	    (ufs_get_pm_lvl_to_link_pwr_state(hba->spm_lvl) ==
	     hba->uic_link_state))