Skip to contentSkip to conversation

drm/amd/pp: Fix bug not sync with firmware when update pptable

PATCH Superseded Rex Zhu 2 participants 2 messages Feb 9, 2018 1 message not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amd/pp: Fix bug not sync with firmware when update pptable

Change-Id Ibb250af8a8cf2af0c30acbad16a354ed0dffa130
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +14 -8
index 79a14de..5c1e445 100644
@@ -4689,20 +4689,26 @@ static int smu7_set_power_profile_state(struct pp_hwmgr *hwmgr,
 	if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_AUTO)
 		return -EINVAL;
 
-	tmp_result = smu7_freeze_sclk_mclk_dpm(hwmgr);
-	PP_ASSERT_WITH_CODE(!tmp_result,
-			"Failed to freeze SCLK MCLK DPM!",
-			result = tmp_result);
+	if (smum_is_dpm_running(hwmgr) {
+		if (!data->sclk_dpm_key_disabled )
+			smum_send_msg_to_smc(hwmgr, PPSMC_MSG_SCLKDPM_FreezeLevel);
+
+		if (!data->mclk_dpm_key_disabled)
+			smum_send_msg_to_smc(hwmgr, PPSMC_MSG_MCLKDPM_FreezeLevel);
+	}
 
 	tmp_result = smum_populate_requested_graphic_levels(hwmgr, request);
 	PP_ASSERT_WITH_CODE(!tmp_result,
 			"Failed to populate requested graphic levels!",
 			result = tmp_result);
 
-	tmp_result = smu7_unfreeze_sclk_mclk_dpm(hwmgr);
-	PP_ASSERT_WITH_CODE(!tmp_result,
-			"Failed to unfreeze SCLK MCLK DPM!",
-			result = tmp_result);
+	if (smum_is_dpm_running(hwmgr) {
+		if (!data->sclk_dpm_key_disabled )
+			smum_send_msg_to_smc(hwmgr, PPSMC_MSG_SCLKDPM_UnfreezeLevel);
+
+		if (!data->mclk_dpm_key_disabled)
+			smum_send_msg_to_smc(hwmgr, PPSMC_MSG_MCLKDPM_UnfreezeLevel);
+	}
 
 	smu7_find_min_clock_masks(hwmgr, &sclk_mask, &mclk_mask,
 			request->min_sclk, request->min_mclk);
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1518166195-19880-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

Please provide a better message body. E.g.,

Lock the dpm levels when we modify the dpm tables to avoid a possible race with the smu.

With that:

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <[email protected]>
Sent: Friday, February 9, 2018 3:49 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amd/pp: Fix bug not sync with firmware when update pptable

Change-Id Ibb250af8a8cf2af0c30acbad16a354ed0dffa130
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +14 -8
index 79a14de..5c1e445 100644
@@ -4689,20 +4689,26 @@ static int smu7_set_power_profile_state(struct pp_hwmgr *hwmgr,
         if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_AUTO)
                 return -EINVAL;
 
-       tmp_result = smu7_freeze_sclk_mclk_dpm(hwmgr);
-       PP_ASSERT_WITH_CODE(!tmp_result,
-                       "Failed to freeze SCLK MCLK DPM!",
-                       result = tmp_result);
+       if (smum_is_dpm_running(hwmgr) {
+               if (!data->sclk_dpm_key_disabled )
+                       smum_send_msg_to_smc(hwmgr, PPSMC_MSG_SCLKDPM_FreezeLevel);
+
+               if (!data->mclk_dpm_key_disabled)
+                       smum_send_msg_to_smc(hwmgr, PPSMC_MSG_MCLKDPM_FreezeLevel);
+       }
 
         tmp_result = smum_populate_requested_graphic_levels(hwmgr, request);
         PP_ASSERT_WITH_CODE(!tmp_result,
                         "Failed to populate requested graphic levels!",
                         result = tmp_result);
 
-       tmp_result = smu7_unfreeze_sclk_mclk_dpm(hwmgr);
-       PP_ASSERT_WITH_CODE(!tmp_result,
-                       "Failed to unfreeze SCLK MCLK DPM!",
-                       result = tmp_result);
+       if (smum_is_dpm_running(hwmgr) {
+               if (!data->sclk_dpm_key_disabled )
+                       smum_send_msg_to_smc(hwmgr, PPSMC_MSG_SCLKDPM_UnfreezeLevel);
+
+               if (!data->mclk_dpm_key_disabled)
+                       smum_send_msg_to_smc(hwmgr, PPSMC_MSG_MCLKDPM_UnfreezeLevel);
+       }
 
         smu7_find_min_clock_masks(hwmgr, &sclk_mask, &mclk_mask,
                         request->min_sclk, request->min_mclk);

--
1.9.1

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx