aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c
diff options
context:
space:
mode:
authorchr[] <[email protected]>2025-02-12 15:51:38 +0000
committerAlex Deucher <[email protected]>2025-02-25 16:43:58 +0000
commitee3dc9e204d271c9c7a8d4d38a0bce4745d33e71 (patch)
treed8b995cce11e751d1ead94661bb8ea1af27f1845 /drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c
parentdrm/amdgpu: update the handle ptr in is_idle (diff)
downloadkernel-ee3dc9e204d271c9c7a8d4d38a0bce4745d33e71.tar.gz
kernel-ee3dc9e204d271c9c7a8d4d38a0bce4745d33e71.zip
amdgpu/pm/legacy: fix suspend/resume issues
resume and irq handler happily races in set_power_state() * amdgpu_legacy_dpm_compute_clocks() needs lock * protect irq work handler * fix dpm_enabled usage v2: fix clang build, integrate Lijo's comments (Alex) Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2524 Fixes: 3712e7a49459 ("drm/amd/pm: unified lock protections in amdgpu_dpm.c") Reviewed-by: Lijo Lazar <[email protected]> Tested-by: Maciej S. Szmigiero <[email protected]> # on Oland PRO Signed-off-by: chr[] <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c')
-rw-r--r--drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c
index e861355ebd75..c7518b13e787 100644
--- a/drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c
+++ b/drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c
@@ -1009,9 +1009,12 @@ void amdgpu_dpm_thermal_work_handler(struct work_struct *work)
enum amd_pm_state_type dpm_state = POWER_STATE_TYPE_INTERNAL_THERMAL;
int temp, size = sizeof(temp);
- if (!adev->pm.dpm_enabled)
- return;
+ mutex_lock(&adev->pm.mutex);
+ if (!adev->pm.dpm_enabled) {
+ mutex_unlock(&adev->pm.mutex);
+ return;
+ }
if (!pp_funcs->read_sensor(adev->powerplay.pp_handle,
AMDGPU_PP_SENSOR_GPU_TEMP,
(void *)&temp,
@@ -1033,4 +1036,5 @@ void amdgpu_dpm_thermal_work_handler(struct work_struct *work)
adev->pm.dpm.state = dpm_state;
amdgpu_legacy_dpm_compute_clocks(adev->powerplay.pp_handle);
+ mutex_unlock(&adev->pm.mutex);
}