The amdgpu tree adds od_uclk_changed to struct smu_table_context in
commit 62d932f72037 ("drm/amd/pm: smu13.0.0: refresh the UCLK DPM table
after an OD_MCLK change"). It sits right next to user_od_feature_mask,
which mainline added too, so amdgpu_smu.h conflicts, and the merge
dropped the new field.

After that, commit c62c2736d82f ("amdgpu: Merge merge merge cherry-pick
cherry-pick cherry-pick") made smu_od_uclk_changed() return false and
removed the code that sets the flag. So DC never re-reads the UCLK
levels after an overdrive change, which is the whole point of
commit b7483797b085 ("drm/amd: let DC re-read UCLK DPM levels after an
OD_MCLK change").

Keep both fields and put the removed code back.

Fixes: af8e519642bd ("Merge branch 'drm-next' of 
https://gitlab.freedesktop.org/agd5f/linux.git";)
Link: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Sasha Levin <[email protected]>
---
Mark, this is against next-20261110. Please fold it into the amdgpu merge;
it replaces the smu_od_uclk_changed() part of c62c2736d82f.

With this the three files are the same as in the amdgpu tree.

Found by comparing with our llminus-assisted integration tree. Build tested
only.

 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c            | 9 ++++++++-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h        | 2 ++
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c 
b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index ff51ff875bfed..86e34e814fe6a 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -601,6 +601,9 @@ static void smu_restore_dpm_user_profile(struct smu_context 
*smu)
                        ret = smu->ppt_funcs->restore_user_od_settings(smu);
                        if (ret)
                                dev_err(smu->adev->dev, "Failed to upload 
customized OD settings\n");
+                       else if (smu_od_uclk_changed(smu))
+                               /* DC read the stock UCLK levels in its init_hw 
*/
+                               amdgpu_dm_update_memclk_states(smu->adev);
                }
        }
 
@@ -3701,7 +3704,11 @@ static int smu_baco_set_state(void *handle, int state)
  */
 bool smu_od_uclk_changed(struct smu_context *smu)
 {
-       return false;
+       bool changed = smu->smu_table.od_uclk_changed;
+
+       smu->smu_table.od_uclk_changed = false;
+
+       return changed;
 }
 
 bool smu_mode1_reset_is_support(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h 
b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
index 41d665591d62a..2a0cdc6e80596 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
@@ -434,6 +434,8 @@ struct smu_table_context {
        void                            *user_overdrive_table;
 
        uint32_t                        user_od_feature_mask;
+       /* Set when an OD commit/restore changed the UCLK levels */
+       bool                            od_uclk_changed;
 
        struct smu_driver_table driver_tables[SMU_DRIVER_TABLE_COUNT];
 };
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index 02bd2b15066cc..1a02ba70d3000 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -1306,6 +1306,8 @@ static void smu_v13_0_0_od_refresh_uclk_table(struct 
smu_context *smu)
                dev_err(smu->adev->dev, "Failed to refresh UCLK dpm table!\n");
                return;
        }
+
+       smu->smu_table.od_uclk_changed = true;
 }
 
 static int smu_v13_0_0_emit_clk_levels(struct smu_context *smu,

base-commit: 793807ca13bf3072fc6d16ce6d90e9ab9beff2a5
-- 
2.53.0

Reply via email to