Skip to content

Commit 31db98d

Browse files
committed
FROMLIST: ufs: host: Add ICE clock scaling during UFS clock changes
Implement ICE (Inline Crypto Engine) clock scaling in sync with UFS controller clock scaling. This ensures that the ICE operates at an appropriate frequency when the UFS clocks are scaled up or down, improving performance and maintaining stability for crypto operations. For scale_up operation ensure to pass ~round_ceil (round_floor) and vice-versa for scale_down operations. Incase of OPP scaling is not supported by ICE, ensure to not prevent devfreq for UFS, as ICE OPP-table is optional. Link: https://lore.kernel.org/all/20260409-enable-ice-clock-scaling-v8-2-ca1129798606@oss.qualcomm.com/ Acked-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Abhinaba Rakshit <abhinaba.rakshit@oss.qualcomm.com>
1 parent fc2cab8 commit 31db98d

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

drivers/ufs/host/ufs-qcom.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,15 @@ static int ufs_qcom_ice_prepare_key(struct blk_crypto_profile *profile,
305305
return qcom_ice_prepare_key(host->ice, lt_key, lt_key_size, eph_key);
306306
}
307307

308+
static int ufs_qcom_ice_scale_clk(struct ufs_qcom_host *host, unsigned long target_freq,
309+
bool round_ceil)
310+
{
311+
if (host->hba->caps & UFSHCD_CAP_CRYPTO)
312+
return qcom_ice_scale_clk(host->ice, target_freq, round_ceil);
313+
314+
return 0;
315+
}
316+
308317
static const struct blk_crypto_ll_ops ufs_qcom_crypto_ops = {
309318
.keyslot_program = ufs_qcom_ice_keyslot_program,
310319
.keyslot_evict = ufs_qcom_ice_keyslot_evict,
@@ -339,6 +348,12 @@ static void ufs_qcom_config_ice_allocator(struct ufs_qcom_host *host)
339348
{
340349
}
341350

351+
static int ufs_qcom_ice_scale_clk(struct ufs_qcom_host *host, unsigned long target_freq,
352+
bool round_ceil)
353+
{
354+
return 0;
355+
}
356+
342357
#endif
343358

344359
static void ufs_qcom_disable_lane_clks(struct ufs_qcom_host *host)
@@ -1649,12 +1664,17 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba, bool scale_up,
16491664
else
16501665
err = ufs_qcom_clk_scale_down_post_change(hba, target_freq);
16511666

1652-
16531667
if (err) {
16541668
ufshcd_uic_hibern8_exit(hba);
16551669
return err;
16561670
}
16571671

1672+
err = ufs_qcom_ice_scale_clk(host, target_freq, !scale_up);
1673+
if (err && err != -EOPNOTSUPP) {
1674+
ufshcd_uic_hibern8_exit(hba);
1675+
return err;
1676+
}
1677+
16581678
ufs_qcom_icc_update_bw(host);
16591679
ufshcd_uic_hibern8_exit(hba);
16601680
}

0 commit comments

Comments
 (0)