drm/amd/pm: parse pp_handle under appropriate conditions
authorjsg <jsg@openbsd.org>
Tue, 13 Jun 2023 03:26:00 +0000 (03:26 +0000)
committerjsg <jsg@openbsd.org>
Tue, 13 Jun 2023 03:26:00 +0000 (03:26 +0000)
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

index 3142c2b..a3c1a66 100644 (file)
@@ -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,