From fef08ba19327813ed1cb5f963215aa5dfa5b0c2b Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 13 Jun 2023 03:26:00 +0000 Subject: [PATCH] drm/amd/pm: parse pp_handle under appropriate conditions From Guchun Chen 17a69415679c6e0b55b390e86d59de82d7e53b9e in linux-6.1.y/6.1.29 58d9b9a14b47c2a3da6effcbb01607ad7edc0275 in mainline linux --- sys/dev/pci/drm/amd/pm/amdgpu_dpm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sys/dev/pci/drm/amd/pm/amdgpu_dpm.c b/sys/dev/pci/drm/amd/pm/amdgpu_dpm.c index 3142c2bf20e..a3c1a66131e 100644 --- a/sys/dev/pci/drm/amd/pm/amdgpu_dpm.c +++ b/sys/dev/pci/drm/amd/pm/amdgpu_dpm.c @@ -1414,15 +1414,21 @@ int amdgpu_dpm_get_smu_prv_buf_details(struct amdgpu_device *adev, int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev) { - struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; - struct smu_context *smu = adev->powerplay.pp_handle; + if (is_support_sw_smu(adev)) { + struct smu_context *smu = adev->powerplay.pp_handle; + + return (smu->od_enabled || smu->is_apu); + } else { + struct pp_hwmgr *hwmgr; - if ((is_support_sw_smu(adev) && smu->od_enabled) || - (is_support_sw_smu(adev) && smu->is_apu) || - (!is_support_sw_smu(adev) && hwmgr->od_enabled)) - return true; + /* SI asic does not carry od_enabled */ + if (adev->family == AMDGPU_FAMILY_SI) + return false; - return false; + hwmgr = (struct pp_hwmgr *)adev->powerplay.pp_handle; + + return hwmgr->od_enabled; + } } int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev, -- 2.20.1