Skip to contentSkip to conversation

drm/amd/powerplay: check for invalid profile mode before switching

PATCH In review Evan Quan 2 participants 3 messages Mar 28, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: check for invalid profile mode before switching

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

Change-Id Ie47cd75a73a8369c349410ea74d322df1d3d38d1
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2 -3
index 85a536924571..973a8896fa9d 100644
@@ -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;
Signature · 6 lines
2.21.0

_______________________________________________
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): [email protected]

author
#2 lore raw

It's kind of an improvement of the previous commit
drm/amd/powerplay: update current profile mode only when it's really applied

No need to update current profile mode if the new profile mode does not take effect in fact.

Maybe @Deucher, Alexander can help to combine them as one.

Regards,
Evan

Quoted 48 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: Thursday, March 28, 2019 9:51 AM
To: [email protected]
Cc: Russell, Kent <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: check for invalid profile mode before switching

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

Change-Id Ie47cd75a73a8369c349410ea74d322df1d3d38d1
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index 85a536924571..973a8896fa9d 100644
@@ -4906,9 +4906,6 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
 	uint8_t min_active_level;
 	uint32_t power_profile_mode = input[size];
 
-	smum_send_msg_to_smc_with_parameter(hwmgr,

PPSMC_MSG_SetWorkloadMask,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -2
-						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);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 -0
 	}
 
+	smum_send_msg_to_smc_with_parameter(hwmgr,

PPSMC_MSG_SetWorkloadMask,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 -1
+						1 << power_profile_mode);
 	hwmgr->power_profile_mode = power_profile_mode;
 
 	return 0;
--
Quoted 1 line

2.21.0

_______________________________________________
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): MN2PR12MB3344778D716CA5D11CCC5D52E4590-rweVpJHSKToDMgCC8P//[email protected]

#4 lore raw

Sure no problem.

________________________________
From: Quan, Evan
Sent: Wednesday, March 27, 2019 9:55 PM
To: Quan, Evan; [email protected]; Deucher, Alexander
Cc: Russell, Kent
Subject: RE: [PATCH] drm/amd/powerplay: check for invalid profile mode before switching

It's kind of an improvement of the previous commit
drm/amd/powerplay: update current profile mode only when it's really applied

No need to update current profile mode if the new profile mode does not take effect in fact.

Maybe @Deucher, Alexander can help to combine them as one.

Regards,
Evan

Quoted 41 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: Thursday, March 28, 2019 9:51 AM
To: [email protected]
Cc: Russell, Kent <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: check for invalid profile mode before switching

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

Change-Id Ie47cd75a73a8369c349410ea74d322df1d3d38d1
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index 85a536924571..973a8896fa9d 100644
@@ -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,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -2
-                                             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);
       }
Quoted 8 lines

+ 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx