Skip to content

Commit 0e7581e

Browse files
pldrcalexdeucher
authored andcommitted
drm/amdgpu/jpeg: Hold pg_lock before jpeg poweroff
Acquire jpeg_pg_lock before changes to jpeg power state and release it after power off from idle work handler. Signed-off-by: Sathishkumar S <[email protected]> Reviewed-by: Leo Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 0b4d79d commit 0e7581e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ static void amdgpu_jpeg_idle_work_handler(struct work_struct *work)
121121
fences += amdgpu_fence_count_emitted(&adev->jpeg.inst[i].ring_dec[j]);
122122
}
123123

124-
if (!fences && !atomic_read(&adev->jpeg.total_submission_cnt))
124+
if (!fences && !atomic_read(&adev->jpeg.total_submission_cnt)) {
125+
mutex_lock(&adev->jpeg.jpeg_pg_lock);
125126
amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_JPEG,
126127
AMD_PG_STATE_GATE);
127-
else
128+
mutex_unlock(&adev->jpeg.jpeg_pg_lock);
129+
} else
128130
schedule_delayed_work(&adev->jpeg.idle_work, JPEG_IDLE_TIMEOUT);
129131
}
130132

0 commit comments

Comments
 (0)