amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu/jpeg: Hold pg_lock before jpeg poweroff
@ 2025-08-06  7:16 Sathishkumar S
  2025-08-06  7:16 ` [PATCH 2/2] drm/amdgpu/vcn: Hold pg_lock before vcn power off Sathishkumar S
  0 siblings, 1 reply; 3+ messages in thread
From: Sathishkumar S @ 2025-08-06  7:16 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander Deucher, Leo Liu, Sathishkumar S

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 <sathishkumar.sundararaju@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
index 82d58ac7afb0..5d5e9ee83a5d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
@@ -121,10 +121,12 @@ static void amdgpu_jpeg_idle_work_handler(struct work_struct *work)
 			fences += amdgpu_fence_count_emitted(&adev->jpeg.inst[i].ring_dec[j]);
 	}
 
-	if (!fences && !atomic_read(&adev->jpeg.total_submission_cnt))
+	if (!fences && !atomic_read(&adev->jpeg.total_submission_cnt)) {
+		mutex_lock(&adev->jpeg.jpeg_pg_lock);
 		amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_JPEG,
 						       AMD_PG_STATE_GATE);
-	else
+		mutex_unlock(&adev->jpeg.jpeg_pg_lock);
+	} else
 		schedule_delayed_work(&adev->jpeg.idle_work, JPEG_IDLE_TIMEOUT);
 }
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] drm/amdgpu/vcn: Hold pg_lock before vcn power off
  2025-08-06  7:16 [PATCH 1/2] drm/amdgpu/jpeg: Hold pg_lock before jpeg poweroff Sathishkumar S
@ 2025-08-06  7:16 ` Sathishkumar S
  2025-08-06 12:34   ` Liu, Leo
  0 siblings, 1 reply; 3+ messages in thread
From: Sathishkumar S @ 2025-08-06  7:16 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander Deucher, Leo Liu, Sathishkumar S

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>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index b497a6714138..e965b624efdb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -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,
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH 2/2] drm/amdgpu/vcn: Hold pg_lock before vcn power off
  2025-08-06  7:16 ` [PATCH 2/2] drm/amdgpu/vcn: Hold pg_lock before vcn power off Sathishkumar S
@ 2025-08-06 12:34   ` Liu, Leo
  0 siblings, 0 replies; 3+ messages in thread
From: Liu, Leo @ 2025-08-06 12:34 UTC (permalink / raw)
  To: Sundararaju, Sathishkumar, amd-gfx@lists.freedesktop.org
  Cc: Deucher, Alexander

[AMD Official Use Only - AMD Internal Distribution Only]

Reviewed-by: Leo Liu <leo.liu@amd.com>

> -----Original Message-----
> From: Sundararaju, Sathishkumar <Sathishkumar.Sundararaju@amd.com>
> Sent: August 6, 2025 3:17 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Liu, Leo
> <Leo.Liu@amd.com>; Sundararaju, Sathishkumar
> <Sathishkumar.Sundararaju@amd.com>
> Subject: [PATCH 2/2] drm/amdgpu/vcn: Hold pg_lock before vcn power off
>
> 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>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> index b497a6714138..e965b624efdb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> @@ -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,
> --
> 2.48.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-06 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06  7:16 [PATCH 1/2] drm/amdgpu/jpeg: Hold pg_lock before jpeg poweroff Sathishkumar S
2025-08-06  7:16 ` [PATCH 2/2] drm/amdgpu/vcn: Hold pg_lock before vcn power off Sathishkumar S
2025-08-06 12:34   ` Liu, Leo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).