Skip to content

Commit d19d963

Browse files
committed
accel/amdxdna: Fix incorrect DPM level after suspend/resume
The suspend routine sets the DPM level to 0, which unintentionally overwrites the previously saved DPM level. As a result, the device always resumes with DPM level 0 instead of restoring the original value. Fix this by ensuring the suspend path does not overwrite the saved DPM level, allowing the correct DPM level to be restored during resume. Fixes: f4d7b8a ("accel/amdxdna: Enhance power management settings") Reviewed-by: Mario Limonciello (AMD) <[email protected]> Signed-off-by: Lizhi Hou <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent d19512f commit d19d963

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/accel/amdxdna/aie2_pm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ int aie2_pm_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
3636
return ret;
3737

3838
ret = ndev->priv->hw_ops.set_dpm(ndev, dpm_level);
39+
if (!ret)
40+
ndev->dpm_level = dpm_level;
3941
amdxdna_pm_suspend_put(ndev->xdna);
4042

4143
return ret;
@@ -65,6 +67,7 @@ int aie2_pm_init(struct amdxdna_dev_hdl *ndev)
6567
ret = ndev->priv->hw_ops.set_dpm(ndev, ndev->max_dpm_level);
6668
if (ret)
6769
return ret;
70+
ndev->dpm_level = ndev->max_dpm_level;
6871

6972
ret = aie2_pm_set_clk_gating(ndev, AIE2_CLK_GATING_ENABLE);
7073
if (ret)

drivers/accel/amdxdna/aie2_smu.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ int npu1_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
8484
}
8585

8686
ndev->hclk_freq = freq;
87-
ndev->dpm_level = dpm_level;
8887
ndev->max_tops = 2 * ndev->total_col;
8988
ndev->curr_tops = ndev->max_tops * freq / 1028;
9089

@@ -114,7 +113,6 @@ int npu4_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
114113

115114
ndev->npuclk_freq = ndev->priv->dpm_clk_tbl[dpm_level].npuclk;
116115
ndev->hclk_freq = ndev->priv->dpm_clk_tbl[dpm_level].hclk;
117-
ndev->dpm_level = dpm_level;
118116
ndev->max_tops = NPU4_DPM_TOPS(ndev, ndev->max_dpm_level);
119117
ndev->curr_tops = NPU4_DPM_TOPS(ndev, dpm_level);
120118

0 commit comments

Comments
 (0)