From d0fd6552e4a89ce7901cb0a314e67df04efdf365 Mon Sep 17 00:00:00 2001 From: Manish Pandey Date: Wed, 2 Dec 2026 16:16:37 +0530 Subject: [PATCH] UPSTREAM: scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on ufshcd_setup_clocks() applied the PM QoS vote only when clock scaling was not supported, relying on ufshcd_scale_clks() otherwise. But that only updates the vote while scaling up or down, and a scale-down drops it while the clocks stay on. The CPUs can then enter deep idle while a request (e.g. a Query request) is still outstanding, delaying the completion interrupt and causing command timeouts. Apply the vote in ufshcd_setup_clocks() unconditionally and drop the ufshcd_pm_qos_update() call from ufshcd_scale_clks(), so the vote tracks only the clock on/off state: held whenever the clocks are on, released when they are gated off. Fixes: 2777e73fc154 ("scsi: ufs: core: Add CPU latency QoS support for UFS driver") Link: https://lore.kernel.org/all/20261202104637.1339868-2-manish.pandey@oss.qualcomm.com/ Signed-off-by: Manish Pandey Signed-off-by: Giri Prasad Goriparthi --- drivers/ufs/core/ufshcd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index c9b2eefbd7b0b..2622791bad0f8 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1214,8 +1214,6 @@ int ufshcd_scale_clks(struct ufs_hba *hba, unsigned long freq, bool scale_up) goto out; } - ufshcd_pm_qos_update(hba, scale_up); - out: trace_ufshcd_profile_clk_scaling(hba, (scale_up ? "up" : "down"), @@ -9950,8 +9948,8 @@ static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on) if (ret) return ret; - if (!ufshcd_is_clkscaling_supported(hba)) - ufshcd_pm_qos_update(hba, on); + /* Hold the PM QoS vote while the controller is active to keep CPUs out of deep idle. */ + ufshcd_pm_qos_update(hba, on); out: if (ret) { list_for_each_entry(clki, head, list) {