Skip to content

Commit

Permalink
Merge pull request #305 from MingcongBai/bai/linux-6.6.y/amdgpu-fix
Browse files Browse the repository at this point in the history
fix: device 0x15d8 don't use AMD_DPM_FORCED_LEVEL_* except AMD_DPM_FO…
  • Loading branch information
opsiff authored Jul 2, 2024
2 parents 7e9b2be + fbf7017 commit 166e797
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/gpu/drm/amd/pm/amdgpu_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ static ssize_t amdgpu_set_power_dpm_force_performance_level(struct device *dev,
{
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = drm_to_adev(ddev);
struct pci_dev *pdev = adev->pdev;
enum amd_dpm_forced_level level;
int ret = 0;

Expand Down Expand Up @@ -302,13 +303,21 @@ static ssize_t amdgpu_set_power_dpm_force_performance_level(struct device *dev,
return ret;
}

//Some devices have stablity issue on AMD_DPM_FORCED_LEVEL_* except AMD_DPM_FORCED_LEVEL_AUTO. Don't use these AMD_DPM_FORCED_LEVEL
if(pdev->device == 0x15d8 && (level != AMD_DPM_FORCED_LEVEL_AUTO))
{
pr_warn("device 0x%04X don't allow dpm force level %d\n", pdev->device, level);
return count;
}

mutex_lock(&adev->pm.stable_pstate_ctx_lock);
if (amdgpu_dpm_force_performance_level(adev, level)) {
pm_runtime_mark_last_busy(ddev->dev);
pm_runtime_put_autosuspend(ddev->dev);
mutex_unlock(&adev->pm.stable_pstate_ctx_lock);
return -EINVAL;
}

/* override whatever a user ctx may have set */
adev->pm.stable_pstate_ctx = NULL;
mutex_unlock(&adev->pm.stable_pstate_ctx_lock);
Expand Down

0 comments on commit 166e797

Please sign in to comment.