Skip to contentSkip to conversation

drm/amd/powerplay: check for invalid profile_exit setting

PATCH In review Evan Quan 2 participants 2 messages May 5, 2019 1 message 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_exit setting

profile_exit performance level setting is valid only when current mode is in profile mode.

Change-Id I6940102d38dbb7a4b0233fce5277e1704672d8f4
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +10 -0
index b80873348624..df78372296bf 100644
@@ -404,6 +404,16 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
 	if (current_level == level)
 		return count;
 
+	/* profile_exit setting is valid only when current mode is in profile mode */
+	if (!(current_level & (AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD |
+	    AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK |
+	    AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK |
+	    AMD_DPM_FORCED_LEVEL_PROFILE_PEAK)) &&
+	    (level == AMD_DPM_FORCED_LEVEL_PROFILE_EXIT)) {
+		pr_err("Currently not in any profile mode!\n");
+		return -EINVAL;
+	}
+
 	if (is_support_sw_smu(adev)) {
 		mutex_lock(&adev->pm.mutex);
 		if (adev->pm.dpm.thermal_active) {
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]

Reviewed-by Tao Zhou
#2 lore raw
Quoted 42 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: 2019年5月5日 11:20
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: check for invalid profile_exit setting

profile_exit performance level setting is valid only when current mode is in profile mode.

Change-Id I6940102d38dbb7a4b0233fce5277e1704672d8f4
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -0
index b80873348624..df78372296bf 100644
@@ -404,6 +404,16 @@ static ssize_t
 amdgpu_set_dpm_forced_performance_level(struct device *dev,
 	if (current_level == level)
 		return count;
 
+	/* profile_exit setting is valid only when current mode is in profile

mode */

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -0
+	if (!(current_level &

(AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD |

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +8 -1
+	    AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK |
+	    AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK |
+	    AMD_DPM_FORCED_LEVEL_PROFILE_PEAK)) &&
+	    (level == AMD_DPM_FORCED_LEVEL_PROFILE_EXIT)) {
+		pr_err("Currently not in any profile mode!\n");
+		return -EINVAL;
+	}
+
 	if (is_support_sw_smu(adev)) {
 		mutex_lock(&adev->pm.mutex);
 		if (adev->pm.dpm.thermal_active) {
--
Quoted 1 line

2.21.0

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