Need to check for invalid profile mode settings before determining
to switch to that.

Change-Id: Ie47cd75a73a8369c349410ea74d322df1d3d38d1
Signed-off-by: Evan Quan <evan.q...@amd.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 85a536924571..973a8896fa9d 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -4906,9 +4906,6 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr 
*hwmgr, long *input, ui
        uint8_t min_active_level;
        uint32_t power_profile_mode = input[size];
 
-       smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask,
-                                               1 << power_profile_mode);
-
        if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
                if (size == 0 || size > 4)
                        return -EINVAL;
@@ -4923,6 +4920,8 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr 
*hwmgr, long *input, ui
                                        use_rlc_busy << 16 | 
min_active_level<<24);
        }
 
+       smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask,
+                                               1 << power_profile_mode);
        hwmgr->power_profile_mode = power_profile_mode;
 
        return 0;
-- 
2.21.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to