diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2020-02-07 10:04:37 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2020-02-11 11:51:55 -0500 |
commit | 5d8b936df28482739517d62941c907ac460e7430 (patch) | |
tree | 4bfa34922b8725951b4adb65915ab13454b6b8e7 /drivers | |
parent | f0f7ddfc3421e8a24cd35ed3e70b74c95899c997 (diff) |
drm/amdgpu/smu: properly handle runpm/suspend/reset
We need some special handling when using baco vs. other
things.
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c index 7b1ae2ec78e1..4720aa58a150 100644 --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c @@ -1454,11 +1454,15 @@ int smu_reset(struct smu_context *smu) return ret; } -static int smu_disabled_dpms(struct smu_context *smu) +static int smu_disable_dpm(struct smu_context *smu) { struct amdgpu_device *adev = smu->adev; uint32_t smu_version; int ret = 0; + bool use_baco = !smu->is_apu && + ((adev->in_gpu_reset && + (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) || + (adev->in_runpm && amdgpu_asic_supports_baco(adev))); ret = smu_get_smc_version(smu, NULL, &smu_version); if (ret) { @@ -1467,13 +1471,13 @@ static int smu_disabled_dpms(struct smu_context *smu) } /* - * For baco reset on Arcturus, this operation + * For baco on Arcturus, this operation * (disable all smu feature) will be handled by SMU FW. */ - if (adev->in_gpu_reset && - (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) && - (adev->asic_type == CHIP_ARCTURUS && smu_version > 0x360e00)) - return 0; + if (adev->asic_type == CHIP_ARCTURUS) { + if (use_baco && (smu_version > 0x360e00)) + return 0; + } /* Disable all enabled SMU features */ ret = smu_system_features_control(smu, false); @@ -1482,15 +1486,14 @@ static int smu_disabled_dpms(struct smu_context *smu) return ret; } - /* For baco reset, need to leave BACO feature enabled */ - if (adev->in_gpu_reset && - (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) && - !smu->is_apu && - smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) { - ret = smu_feature_set_enabled(smu, SMU_FEATURE_BACO_BIT, true); - if (ret) { - pr_warn("set BACO feature enabled failed, return %d\n", ret); - return ret; + /* For baco, need to leave BACO feature enabled */ + if (use_baco) { + if (smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) { + ret = smu_feature_set_enabled(smu, SMU_FEATURE_BACO_BIT, true); + if (ret) { + pr_warn("set BACO feature enabled failed, return %d\n", ret); + return ret; + } } } @@ -1510,7 +1513,7 @@ static int smu_suspend(void *handle) return 0; if(!amdgpu_sriov_vf(adev)) { - ret = smu_disabled_dpms(smu); + ret = smu_disable_dpm(smu); if (ret) return ret; } |