drivers/ufs/core/ufshcd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
This reverts commit 85b2b966285498e1b551ac85f02c79cd06c0cff0.
Qcom UFS Host Controllers do not support scaling clocks when the traffic is
ongoing. But the offending commit removed the block I/O quiesce in the
clock scaling path, which causes below UFS failures during clock scaling:
ufshcd-qcom 1d84000.ufshc: ufshcd_check_errors: saved_err 0x80 saved_uic_err 0x0
ufshcd-qcom 1d84000.ufshc: ufshcd_err_handler started; HBA state eh_fatal; powered 1; shutting down 0; saved_err = 0x80; saved_uic_err = 0x0; force_reset = 0
ufshcd-qcom 1d84000.ufshc: pwr ctrl cmd 0x2 with (MIBattribute 0x1571, mode 0x11) completion timeout
ufshcd-qcom 1d84000.ufshc: UFS Host state=3
ufshcd-qcom 1d84000.ufshc: 7 outstanding reqs, tasks=0x0
ufshcd-qcom 1d84000.ufshc: saved_err=0x80, saved_uic_err=0x0
ufshcd-qcom 1d84000.ufshc: Device power mode=1, UIC link state=1
ufshcd-qcom 1d84000.ufshc: PM in progress=0, sys. suspended=0
ufshcd-qcom 1d84000.ufshc: Auto BKOPS=0, Host self-block=0
ufshcd-qcom 1d84000.ufshc: Clk gate=1
ufshcd-qcom 1d84000.ufshc: last_hibern8_exit_tstamp at 196451913 us, hibern8_exit_cnt=20
ufshcd-qcom 1d84000.ufshc: error handling flags=0x0, req. abort count=0
ufshcd-qcom 1d84000.ufshc: hba->ufs_version=0x300, Host capabilities=0x1587031f, caps=0x124f
ufshcd-qcom 1d84000.ufshc: quirks=0x0, dev. quirks=0x310c4
ufshcd-qcom 1d84000.ufshc: UFS dev info: SAMSUNG KLUDG4UHDB-B2D1 rev 0400
ufshcd-qcom 1d84000.ufshc: clk: core_clk, rate: 300000000
ufshcd-qcom 1d84000.ufshc: clk: core_clk_unipro, rate: 300000000
Hence, revert the commit to bring back UFS on all Qcom platforms.
Reported-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Closes: https://lore.kernel.org/linux-scsi/al8YkXydXJQZrl_Y@QCOM-aGQu4IUr3Y
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/ufs/core/ufshcd.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 79331c2bd38d..1a5a851d43b2 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -1445,7 +1445,7 @@ static int ufshcd_scale_gear(struct ufs_hba *hba, u32 target_gear, bool scale_up
*
* Return: 0 upon success; -EBUSY upon timeout.
*/
-static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba)
+static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba, u64 timeout_us)
{
int ret = 0;
/*
@@ -1453,13 +1453,16 @@ static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba)
* clock scaling is in progress
*/
mutex_lock(&hba->host->scan_mutex);
+ blk_mq_quiesce_tagset(&hba->host->tag_set);
mutex_lock(&hba->wb_mutex);
down_write(&hba->clk_scaling_lock);
- if (!hba->clk_scaling.is_allowed) {
+ if (!hba->clk_scaling.is_allowed ||
+ ufshcd_wait_for_pending_cmds(hba, timeout_us)) {
ret = -EBUSY;
up_write(&hba->clk_scaling_lock);
mutex_unlock(&hba->wb_mutex);
+ blk_mq_unquiesce_tagset(&hba->host->tag_set);
mutex_unlock(&hba->host->scan_mutex);
goto out;
}
@@ -1475,6 +1478,7 @@ static void ufshcd_clock_scaling_unprepare(struct ufs_hba *hba, int err)
{
up_write(&hba->clk_scaling_lock);
mutex_unlock(&hba->wb_mutex);
+ blk_mq_unquiesce_tagset(&hba->host->tag_set);
mutex_unlock(&hba->host->scan_mutex);
/* Enable Write Booster if current gear requires it else disable it */
@@ -1502,7 +1506,7 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, unsigned long freq,
new_gear = ufshcd_vops_freq_to_gear_speed(hba, freq);
- ret = ufshcd_clock_scaling_prepare(hba);
+ ret = ufshcd_clock_scaling_prepare(hba, 1 * USEC_PER_SEC);
if (ret)
return ret;
--
2.43.0
On Thu, Jul 23, 2026 at 02:47:33PM +0200, Manivannan Sadhasivam wrote: > This reverts commit 85b2b966285498e1b551ac85f02c79cd06c0cff0. > > Qcom UFS Host Controllers do not support scaling clocks when the traffic is > ongoing. But the offending commit removed the block I/O quiesce in the > clock scaling path, which causes below UFS failures during clock scaling: > > ufshcd-qcom 1d84000.ufshc: ufshcd_check_errors: saved_err 0x80 saved_uic_err 0x0 > ufshcd-qcom 1d84000.ufshc: ufshcd_err_handler started; HBA state eh_fatal; powered 1; shutting down 0; saved_err = 0x80; saved_uic_err = 0x0; force_reset = 0 > ufshcd-qcom 1d84000.ufshc: pwr ctrl cmd 0x2 with (MIBattribute 0x1571, mode 0x11) completion timeout > ufshcd-qcom 1d84000.ufshc: UFS Host state=3 > ufshcd-qcom 1d84000.ufshc: 7 outstanding reqs, tasks=0x0 > ufshcd-qcom 1d84000.ufshc: saved_err=0x80, saved_uic_err=0x0 > ufshcd-qcom 1d84000.ufshc: Device power mode=1, UIC link state=1 > ufshcd-qcom 1d84000.ufshc: PM in progress=0, sys. suspended=0 > ufshcd-qcom 1d84000.ufshc: Auto BKOPS=0, Host self-block=0 > ufshcd-qcom 1d84000.ufshc: Clk gate=1 > ufshcd-qcom 1d84000.ufshc: last_hibern8_exit_tstamp at 196451913 us, hibern8_exit_cnt=20 > ufshcd-qcom 1d84000.ufshc: error handling flags=0x0, req. abort count=0 > ufshcd-qcom 1d84000.ufshc: hba->ufs_version=0x300, Host capabilities=0x1587031f, caps=0x124f > ufshcd-qcom 1d84000.ufshc: quirks=0x0, dev. quirks=0x310c4 > ufshcd-qcom 1d84000.ufshc: UFS dev info: SAMSUNG KLUDG4UHDB-B2D1 rev 0400 > ufshcd-qcom 1d84000.ufshc: clk: core_clk, rate: 300000000 > ufshcd-qcom 1d84000.ufshc: clk: core_clk_unipro, rate: 300000000 > > Hence, revert the commit to bring back UFS on all Qcom platforms. > > Reported-by: Shawn Guo <shengchao.guo@oss.qualcomm.com> > Closes: https://lore.kernel.org/linux-scsi/al8YkXydXJQZrl_Y@QCOM-aGQu4IUr3Y > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Tested-by: Shawn Guo <shengchao.guo@oss.qualcomm.com> # Qualcomm Nord SoC
On 7/23/26 5:47 AM, Manivannan Sadhasivam wrote: > This reverts commit 85b2b966285498e1b551ac85f02c79cd06c0cff0. Reviewed-by: Bart Van Assche <bvanassche@acm.org>
On 7/23/26 2:47 PM, Manivannan Sadhasivam wrote: > This reverts commit 85b2b966285498e1b551ac85f02c79cd06c0cff0. > > Qcom UFS Host Controllers do not support scaling clocks when the traffic is > ongoing. But the offending commit removed the block I/O quiesce in the > clock scaling path, which causes below UFS failures during clock scaling: > > ufshcd-qcom 1d84000.ufshc: ufshcd_check_errors: saved_err 0x80 saved_uic_err 0x0 > ufshcd-qcom 1d84000.ufshc: ufshcd_err_handler started; HBA state eh_fatal; powered 1; shutting down 0; saved_err = 0x80; saved_uic_err = 0x0; force_reset = 0 > ufshcd-qcom 1d84000.ufshc: pwr ctrl cmd 0x2 with (MIBattribute 0x1571, mode 0x11) completion timeout > ufshcd-qcom 1d84000.ufshc: UFS Host state=3 > ufshcd-qcom 1d84000.ufshc: 7 outstanding reqs, tasks=0x0 > ufshcd-qcom 1d84000.ufshc: saved_err=0x80, saved_uic_err=0x0 > ufshcd-qcom 1d84000.ufshc: Device power mode=1, UIC link state=1 > ufshcd-qcom 1d84000.ufshc: PM in progress=0, sys. suspended=0 > ufshcd-qcom 1d84000.ufshc: Auto BKOPS=0, Host self-block=0 > ufshcd-qcom 1d84000.ufshc: Clk gate=1 > ufshcd-qcom 1d84000.ufshc: last_hibern8_exit_tstamp at 196451913 us, hibern8_exit_cnt=20 > ufshcd-qcom 1d84000.ufshc: error handling flags=0x0, req. abort count=0 > ufshcd-qcom 1d84000.ufshc: hba->ufs_version=0x300, Host capabilities=0x1587031f, caps=0x124f > ufshcd-qcom 1d84000.ufshc: quirks=0x0, dev. quirks=0x310c4 > ufshcd-qcom 1d84000.ufshc: UFS dev info: SAMSUNG KLUDG4UHDB-B2D1 rev 0400 > ufshcd-qcom 1d84000.ufshc: clk: core_clk, rate: 300000000 > ufshcd-qcom 1d84000.ufshc: clk: core_clk_unipro, rate: 300000000 > > Hence, revert the commit to bring back UFS on all Qcom platforms. > > Reported-by: Shawn Guo <shengchao.guo@oss.qualcomm.com> > Closes: https://lore.kernel.org/linux-scsi/al8YkXydXJQZrl_Y@QCOM-aGQu4IUr3Y > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> > --- Tested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> # SC8280XP CRD Konrad
On Thu, 2026-07-23 at 14:47 +0200, Manivannan Sadhasivam wrote: > This reverts commit 85b2b966285498e1b551ac85f02c79cd06c0cff0. > > Qcom UFS Host Controllers do not support scaling clocks when the > traffic is > ongoing. But the offending commit removed the block I/O quiesce in > the > clock scaling path, which causes below UFS failures during clock > scaling: > > ufshcd-qcom 1d84000.ufshc: ufshcd_check_errors: saved_err 0x80 > saved_uic_err 0x0 > ufshcd-qcom 1d84000.ufshc: ufshcd_err_handler started; HBA state > eh_fatal; powered 1; shutting down 0; saved_err = 0x80; saved_uic_err > = 0x0; force_reset = 0 > ufshcd-qcom 1d84000.ufshc: pwr ctrl cmd 0x2 with (MIBattribute > 0x1571, mode 0x11) completion timeout > ufshcd-qcom 1d84000.ufshc: UFS Host state=3 > ufshcd-qcom 1d84000.ufshc: 7 outstanding reqs, tasks=0x0 > ufshcd-qcom 1d84000.ufshc: saved_err=0x80, saved_uic_err=0x0 > ufshcd-qcom 1d84000.ufshc: Device power mode=1, UIC link state=1 > ufshcd-qcom 1d84000.ufshc: PM in progress=0, sys. suspended=0 > ufshcd-qcom 1d84000.ufshc: Auto BKOPS=0, Host self-block=0 > ufshcd-qcom 1d84000.ufshc: Clk gate=1 > ufshcd-qcom 1d84000.ufshc: last_hibern8_exit_tstamp at 196451913 us, > hibern8_exit_cnt=20 > ufshcd-qcom 1d84000.ufshc: error handling flags=0x0, req. abort > count=0 > ufshcd-qcom 1d84000.ufshc: hba->ufs_version=0x300, Host > capabilities=0x1587031f, caps=0x124f > ufshcd-qcom 1d84000.ufshc: quirks=0x0, dev. quirks=0x310c4 > ufshcd-qcom 1d84000.ufshc: UFS dev info: SAMSUNG KLUDG4UHDB-B2D1 > rev 0400 > ufshcd-qcom 1d84000.ufshc: clk: core_clk, rate: 300000000 > ufshcd-qcom 1d84000.ufshc: clk: core_clk_unipro, rate: 300000000 > > Hence, revert the commit to bring back UFS on all Qcom platforms. > > Reported-by: Shawn Guo <shengchao.guo@oss.qualcomm.com> > Closes: > https://lore.kernel.org/linux-scsi/al8YkXydXJQZrl_Y@QCOM-aGQu4IUr3Y > Signed-off-by: Manivannan Sadhasivam > <manivannan.sadhasivam@oss.qualcomm.com> > --- Reviewed-by: Peter Wang <peter.wang@mediatek.com>
© 2016 - 2026 Red Hat, Inc.