Commit 5d8b936d authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu/smu: properly handle runpm/suspend/reset

We need some special handling when using baco vs. other
things.
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f0f7ddfc
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment