diff options
author | Evan Quan <evan.quan@amd.com> | 2019-05-05 11:00:50 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-05-07 13:24:57 -0500 |
commit | db8a974f7e6966d73b4e6afa673c5b8bc31a111e (patch) | |
tree | 9517abe8a48e270ed39fa24bb12731cac5cb0f81 /drivers/gpu/drm | |
parent | 992fbe8ce035d8c3fb2615ac6e8faeaa7c2fa2c3 (diff) | |
download | linux-db8a974f7e6966d73b4e6afa673c5b8bc31a111e.tar.bz2 |
drm/amd/powerplay: check for invalid profile_exit setting
profile_exit performance level setting is valid only
when current mode is in profile mode.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index 95144e49c7f9..34471dbaa872 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c @@ -342,6 +342,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) { |