]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amdgpu/vcn: Hold pg_lock before vcn power off
authorSathishkumar S <sathishkumar.sundararaju@amd.com>
Tue, 5 Aug 2025 16:05:10 +0000 (21:35 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Aug 2025 18:34:54 +0000 (14:34 -0400)
Acquire vcn_pg_lock before changes to vcn power state
and release it after power off in idle work handler.

Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c

index 050a5411aae5445121810e37a6e9267195da5fa2..9a76e11d1c184664007a2e62256f126b9bfc6509 100644 (file)
@@ -443,7 +443,9 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
        fences += fence[i];
 
        if (!fences && !atomic_read(&vcn_inst->total_submission_cnt)) {
+               mutex_lock(&vcn_inst->vcn_pg_lock);
                vcn_inst->set_pg_state(vcn_inst, AMD_PG_STATE_GATE);
+               mutex_unlock(&vcn_inst->vcn_pg_lock);
                mutex_lock(&adev->vcn.workload_profile_mutex);
                if (adev->vcn.workload_profile_active) {
                        r = amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_VIDEO,