Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu/vpe: Force collaborate sync after TRAP
@ 2026-05-12  2:48 Alan Liu
  2026-05-12  3:12 ` Mario Limonciello
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Liu @ 2026-05-12  2:48 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, Mario Limonciello, Lang Yu, Alan Liu, stable

VPE1 could possibly hang and fail to power off at the end of commands in
collaboration mode. This workaround adds a COLLAB_SYNC after TRAP to
force instances synchronized to avoid VPE1 fail to power off.

v2: adjust number of DW for ring allocation, and improve commit message.

Reviewed-by: Lang Yu <lang.yu@amd.com>
Signed-off-by: Alan liu <haoping.liu@amd.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5171
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
index fd881388d612..f27f917e3cdb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
@@ -562,6 +562,11 @@ static void vpe_ring_emit_fence(struct amdgpu_ring *ring, uint64_t addr,
 		amdgpu_ring_write(ring, 0);
 	}
 
+	/* WA: Force sync after TRAP to avoid VPE1 fail to power off */
+	if (ring->adev->vpe.collaborate_mode) {
+		amdgpu_ring_write(ring, VPE_CMD_HEADER(VPE_CMD_OPCODE_COLLAB_SYNC, 0));
+		amdgpu_ring_write(ring, 0xabcd);
+	}
 }
 
 static void vpe_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
@@ -968,7 +973,7 @@ static const struct amdgpu_ring_funcs vpe_ring_funcs = {
 	.emit_frame_size =
 		5 + /* vpe_ring_init_cond_exec */
 		6 + /* vpe_ring_emit_pipeline_sync */
-		10 + 10 + 10 + /* vpe_ring_emit_fence */
+		12 + 12 + 12 + /* vpe_ring_emit_fence */
 		/* vpe_ring_emit_vm_flush */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
 		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6,
-- 
2.43.0


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

* Re: [PATCH] drm/amdgpu/vpe: Force collaborate sync after TRAP
  2026-05-12  2:48 [PATCH] drm/amdgpu/vpe: Force collaborate sync after TRAP Alan Liu
@ 2026-05-12  3:12 ` Mario Limonciello
  0 siblings, 0 replies; 2+ messages in thread
From: Mario Limonciello @ 2026-05-12  3:12 UTC (permalink / raw)
  To: Alan Liu, amd-gfx; +Cc: Alex Deucher, Lang Yu, stable



On 5/11/26 21:48, Alan Liu wrote:
> VPE1 could possibly hang and fail to power off at the end of commands in
> collaboration mode. This workaround adds a COLLAB_SYNC after TRAP to
> force instances synchronized to avoid VPE1 fail to power off.
> 
> v2: adjust number of DW for ring allocation, and improve commit message.
> 

You can drop this v2 line when committing, this is the first public commit.

> Reviewed-by: Lang Yu <lang.yu@amd.com>
> Signed-off-by: Alan liu <haoping.liu@amd.com>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5171
> Cc: stable@vger.kernel.org

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
> index fd881388d612..f27f917e3cdb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
> @@ -562,6 +562,11 @@ static void vpe_ring_emit_fence(struct amdgpu_ring *ring, uint64_t addr,
>   		amdgpu_ring_write(ring, 0);
>   	}
>   
> +	/* WA: Force sync after TRAP to avoid VPE1 fail to power off */
> +	if (ring->adev->vpe.collaborate_mode) {
> +		amdgpu_ring_write(ring, VPE_CMD_HEADER(VPE_CMD_OPCODE_COLLAB_SYNC, 0));
> +		amdgpu_ring_write(ring, 0xabcd);
> +	}
>   }
>   
>   static void vpe_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
> @@ -968,7 +973,7 @@ static const struct amdgpu_ring_funcs vpe_ring_funcs = {
>   	.emit_frame_size =
>   		5 + /* vpe_ring_init_cond_exec */
>   		6 + /* vpe_ring_emit_pipeline_sync */
> -		10 + 10 + 10 + /* vpe_ring_emit_fence */
> +		12 + 12 + 12 + /* vpe_ring_emit_fence */
>   		/* vpe_ring_emit_vm_flush */
>   		SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
>   		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6,


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

end of thread, other threads:[~2026-05-12  3:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12  2:48 [PATCH] drm/amdgpu/vpe: Force collaborate sync after TRAP Alan Liu
2026-05-12  3:12 ` Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox