* [PATCH] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode [not found] <CGME20260211060105epcms2p6631646c964afae761c5d8b93db5a476d@epcms2p6> @ 2026-02-11 6:01 ` Won Jung 2026-02-11 13:00 ` Peter Wang (王信友) ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Won Jung @ 2026-02-11 6:01 UTC (permalink / raw) To: ALIM AKHTAR, avri.altman, bvanassche, James.Bottomley, martin.petersen, peter.wang, beanhuo, adrian.hunter, quic_nguyenb, linux-scsi, linux-kernel, Jinyoung Choi, Jeuk Kim This patch ensures that UFS Runtime PM can achieve power saving after System PM suspend by resetting hba->urgent_bkops_lvl. It also modifies ufshcd_bkops_exception_event_handler to avoid setting urgent_bkops_lvl when status is 0, which helps maintain optimal power management. On UFS devices supporting UFSHCD_CAP_AUTO_BKOPS_SUSPEND, a BKOPS exception event can lead to a situation where UFS Runtime PM can't enter low-power mode states even after the BKOPS exception has been resolved. BKOPS exception with bkops status 0 occurs, the driver logs: "ufshcd_bkops_exception_event_handler: device raised urgent BKOPS exception for bkops status 0" When a BKOPS exception occurs, `ufshcd_bkops_exception_event_handler()` reads the BKOPS status and sets `hba->urgent_bkops_lvl` to BKOPS_STATUS_NO_OP(0). This allows the device to perform Runtime PM without changing the UFS power mode. (`__ufshcd_wl_suspend(hba, UFS_RUNTIME_PM)`) During system PM suspend, `ufshcd_disable_auto_bkops()` is called, disabling auto bkops. After UFS System PM Resume, when runtime PM attempts to suspend again, `ufshcd_urgent_bkops()` is invoked. Since `hba->urgent_bkops_lvl` remains at BKOPS_STATUS_NO_OP(0), `ufshcd_enable_auto_bkops()` is triggered. However, in `ufshcd_bkops_ctrl()`, the driver compares the current BKOPS status with `hba->urgent_bkops_lvl`, and only enables auto bkops if `curr_status >= hba->urgent_bkops_lvl`. Since both values are 0, the condition is met As a result, `__ufshcd_wl_suspend(hba, UFS_RUNTIME_PM)` skips power mode transitions and remains in an active state, preventing power saving even though no urgent BKOPS condition exists. Signed-off-by: wone.jung <wone.jung@samsung.com> --- drivers/ufs/core/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 604043a7533d..e2d3e834ccba 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -5959,6 +5959,7 @@ static int ufshcd_disable_auto_bkops(struct ufs_hba *hba) hba->auto_bkops_enabled = false; trace_ufshcd_auto_bkops_state(hba, "Disabled"); + hba->urgent_bkops_lvl = BKOPS_STATUS_PERF_IMPACT; hba->is_urgent_bkops_lvl_checked = false; out: return err; @@ -6062,7 +6063,7 @@ static void ufshcd_bkops_exception_event_handler(struct ufs_hba *hba) * impacted or critical. Handle these device by determining their urgent * bkops status at runtime. */ - if (curr_status < BKOPS_STATUS_PERF_IMPACT) { + if ((curr_status > BKOPS_STATUS_NO_OP) && (curr_status < BKOPS_STATUS_PERF_IMPACT)) { dev_err(hba->dev, "%s: device raised urgent BKOPS exception for bkops status %d\n", __func__, curr_status); /* update the current status as the urgent bkops level */ -- 2.17.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode 2026-02-11 6:01 ` [PATCH] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode Won Jung @ 2026-02-11 13:00 ` Peter Wang (王信友) 2026-02-18 2:30 ` Martin K. Petersen 2026-02-24 16:47 ` Martin K. Petersen 2 siblings, 0 replies; 4+ messages in thread From: Peter Wang (王信友) @ 2026-02-11 13:00 UTC (permalink / raw) To: beanhuo, avri.altman, jeuk20.kim, quic_nguyenb, linux-scsi, bvanassche, linux-kernel, adrian.hunter, alim.akhtar, wone.jung, martin.petersen, James.Bottomley, j-young.choi On Wed, 2026-02-11 at 15:01 +0900, Won Jung wrote: > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index 604043a7533d..e2d3e834ccba 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -5959,6 +5959,7 @@ static int ufshcd_disable_auto_bkops(struct > ufs_hba *hba) > > hba->auto_bkops_enabled = false; > trace_ufshcd_auto_bkops_state(hba, "Disabled"); > + hba->urgent_bkops_lvl = BKOPS_STATUS_PERF_IMPACT; > hba->is_urgent_bkops_lvl_checked = false; > out: > return err; > @@ -6062,7 +6063,7 @@ static void > ufshcd_bkops_exception_event_handler(struct ufs_hba *hba) > * impacted or critical. Handle these device by determining > their urgent > * bkops status at runtime. > */ > - if (curr_status < BKOPS_STATUS_PERF_IMPACT) { > + if ((curr_status > BKOPS_STATUS_NO_OP) && (curr_status < > BKOPS_STATUS_PERF_IMPACT)) { > dev_err(hba->dev, "%s: device raised urgent BKOPS > exception for bkops status %d\n", > __func__, curr_status); > /* update the current status as the urgent bkops > level */ Reviewed-by: Peter Wang <peter.wang@mediatek.com> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode 2026-02-11 6:01 ` [PATCH] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode Won Jung 2026-02-11 13:00 ` Peter Wang (王信友) @ 2026-02-18 2:30 ` Martin K. Petersen 2026-02-24 16:47 ` Martin K. Petersen 2 siblings, 0 replies; 4+ messages in thread From: Martin K. Petersen @ 2026-02-18 2:30 UTC (permalink / raw) To: Won Jung Cc: ALIM AKHTAR, avri.altman, bvanassche, James.Bottomley, martin.petersen, peter.wang, beanhuo, adrian.hunter, quic_nguyenb, linux-scsi, linux-kernel, Jinyoung Choi, Jeuk Kim Won, > This patch ensures that UFS Runtime PM can achieve power saving after > System PM suspend by resetting hba->urgent_bkops_lvl. It also modifies > ufshcd_bkops_exception_event_handler to avoid setting urgent_bkops_lvl > when status is 0, which helps maintain optimal power management. Applied to 7.0/scsi-staging, thanks! -- Martin K. Petersen ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode 2026-02-11 6:01 ` [PATCH] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode Won Jung 2026-02-11 13:00 ` Peter Wang (王信友) 2026-02-18 2:30 ` Martin K. Petersen @ 2026-02-24 16:47 ` Martin K. Petersen 2 siblings, 0 replies; 4+ messages in thread From: Martin K. Petersen @ 2026-02-24 16:47 UTC (permalink / raw) To: ALIM AKHTAR, avri.altman, bvanassche, James.Bottomley, peter.wang, beanhuo, adrian.hunter, quic_nguyenb, linux-scsi, linux-kernel, Jinyoung Choi, Jeuk Kim, Won Jung Cc: Martin K . Petersen On Wed, 11 Feb 2026 15:01:05 +0900, Won Jung wrote: > This patch ensures that UFS Runtime PM can achieve power saving > after System PM suspend by resetting hba->urgent_bkops_lvl. > It also modifies ufshcd_bkops_exception_event_handler to avoid > setting urgent_bkops_lvl when status is 0, which helps maintain > optimal power management. > > On UFS devices supporting UFSHCD_CAP_AUTO_BKOPS_SUSPEND, > a BKOPS exception event can lead to a situation > where UFS Runtime PM can't enter low-power mode states even > after the BKOPS exception has been resolved. > > [...] Applied to 7.0/scsi-fixes, thanks! [1/1] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode https://git.kernel.org/mkp/scsi/c/5b313760059c -- Martin K. Petersen ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-24 16:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20260211060105epcms2p6631646c964afae761c5d8b93db5a476d@epcms2p6>
2026-02-11 6:01 ` [PATCH] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode Won Jung
2026-02-11 13:00 ` Peter Wang (王信友)
2026-02-18 2:30 ` Martin K. Petersen
2026-02-24 16:47 ` Martin K. Petersen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome