amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Fix SDMA UTC_L1 handling during start/stop sequences
@ 2025-06-16 11:43 Jesse Zhang
  2025-06-16 13:51 ` Philip Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Jesse Zhang @ 2025-06-16 11:43 UTC (permalink / raw)
  To: amd-gfx
  Cc: Alexander.Deucher, Christian Koenig, Jesse Zhang, Jonathan Kim,
	Jesse Zhang

This commit makes two key fixes to SDMA v4.4.2 handling:

1. disable UTC_L1 in sdma_cntl register when stopping SDMA engines
   by reading the current value before modifying UTC_L1_ENABLE bit.

2. Ensure UTC_L1_ENABLE is consistently managed by:
   - Adding the missing register write when enabling UTC_L1 during start
   - Keeping UTC_L1 enabled by default as per hardware requirements

Fixes the commit 7f03b1d14d51 ("drm/amdgpu:
Remove sdma halt/unhalt during frontdoor load") by maintaining proper
SDMA controller state during initialization sequences.

Suggested-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
index e6af50c947a1..1f6a8944b1ea 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
@@ -492,7 +492,7 @@ static void sdma_v4_4_2_inst_gfx_stop(struct amdgpu_device *adev,
 {
 	struct amdgpu_ring *sdma[AMDGPU_MAX_SDMA_INSTANCES];
 	u32 doorbell_offset, doorbell;
-	u32 rb_cntl, ib_cntl;
+	u32 rb_cntl, ib_cntl, sdma_cntl;
 	int i;
 
 	for_each_inst(i, inst_mask) {
@@ -504,6 +504,8 @@ static void sdma_v4_4_2_inst_gfx_stop(struct amdgpu_device *adev,
 		ib_cntl = RREG32_SDMA(i, regSDMA_GFX_IB_CNTL);
 		ib_cntl = REG_SET_FIELD(ib_cntl, SDMA_GFX_IB_CNTL, IB_ENABLE, 0);
 		WREG32_SDMA(i, regSDMA_GFX_IB_CNTL, ib_cntl);
+		sdma_cntl = REG_SET_FIELD(sdma_cntl, SDMA_CNTL, UTC_L1_ENABLE, 0);
+		WREG32_SDMA(i, regSDMA_CNTL, sdma_cntl);
 
 		if (sdma[i]->use_doorbell) {
 			doorbell = RREG32_SDMA(i, regSDMA_GFX_DOORBELL);
@@ -997,6 +999,7 @@ static int sdma_v4_4_2_inst_start(struct amdgpu_device *adev,
 		/* set utc l1 enable flag always to 1 */
 		temp = RREG32_SDMA(i, regSDMA_CNTL);
 		temp = REG_SET_FIELD(temp, SDMA_CNTL, UTC_L1_ENABLE, 1);
+		WREG32_SDMA(i, regSDMA_CNTL, temp);
 
 		if (amdgpu_ip_version(adev, SDMA0_HWIP, 0) < IP_VERSION(4, 4, 5)) {
 			/* enable context empty interrupt during initialization */
-- 
2.34.1


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

* Re: [PATCH] drm/amdgpu: Fix SDMA UTC_L1 handling during start/stop sequences
  2025-06-16 11:43 [PATCH] drm/amdgpu: Fix SDMA UTC_L1 handling during start/stop sequences Jesse Zhang
@ 2025-06-16 13:51 ` Philip Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Philip Yang @ 2025-06-16 13:51 UTC (permalink / raw)
  To: Jesse Zhang, amd-gfx; +Cc: Alexander.Deucher, Christian Koenig, Jonathan Kim


On 2025-06-16 07:43, Jesse Zhang wrote:
> This commit makes two key fixes to SDMA v4.4.2 handling:
>
> 1. disable UTC_L1 in sdma_cntl register when stopping SDMA engines
>     by reading the current value before modifying UTC_L1_ENABLE bit.
>
> 2. Ensure UTC_L1_ENABLE is consistently managed by:
>     - Adding the missing register write when enabling UTC_L1 during start
>     - Keeping UTC_L1 enabled by default as per hardware requirements
>
> Fixes the commit 7f03b1d14d51 ("drm/amdgpu:
> Remove sdma halt/unhalt during frontdoor load") by maintaining proper
> SDMA controller state during initialization sequences.
>
> Suggested-by: Jonathan Kim <jonathan.kim@amd.com>
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
> index e6af50c947a1..1f6a8944b1ea 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
> @@ -492,7 +492,7 @@ static void sdma_v4_4_2_inst_gfx_stop(struct amdgpu_device *adev,
>   {
>   	struct amdgpu_ring *sdma[AMDGPU_MAX_SDMA_INSTANCES];
>   	u32 doorbell_offset, doorbell;
> -	u32 rb_cntl, ib_cntl;
> +	u32 rb_cntl, ib_cntl, sdma_cntl;
>   	int i;
>   
>   	for_each_inst(i, inst_mask) {
> @@ -504,6 +504,8 @@ static void sdma_v4_4_2_inst_gfx_stop(struct amdgpu_device *adev,
>   		ib_cntl = RREG32_SDMA(i, regSDMA_GFX_IB_CNTL);
>   		ib_cntl = REG_SET_FIELD(ib_cntl, SDMA_GFX_IB_CNTL, IB_ENABLE, 0);
>   		WREG32_SDMA(i, regSDMA_GFX_IB_CNTL, ib_cntl);

seems using random value sdma_cntl to init, probably you need add this?

sdma_cntl = RREG32_SDMA(i, SDMA_CNTL);

Regards,

Philip

> +		sdma_cntl = REG_SET_FIELD(sdma_cntl, SDMA_CNTL, UTC_L1_ENABLE, 0);
> +		WREG32_SDMA(i, regSDMA_CNTL, sdma_cntl);
>   
>   		if (sdma[i]->use_doorbell) {
>   			doorbell = RREG32_SDMA(i, regSDMA_GFX_DOORBELL);
> @@ -997,6 +999,7 @@ static int sdma_v4_4_2_inst_start(struct amdgpu_device *adev,
>   		/* set utc l1 enable flag always to 1 */
>   		temp = RREG32_SDMA(i, regSDMA_CNTL);
>   		temp = REG_SET_FIELD(temp, SDMA_CNTL, UTC_L1_ENABLE, 1);
> +		WREG32_SDMA(i, regSDMA_CNTL, temp);
>   
>   		if (amdgpu_ip_version(adev, SDMA0_HWIP, 0) < IP_VERSION(4, 4, 5)) {
>   			/* enable context empty interrupt during initialization */

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

end of thread, other threads:[~2025-06-16 13:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 11:43 [PATCH] drm/amdgpu: Fix SDMA UTC_L1 handling during start/stop sequences Jesse Zhang
2025-06-16 13:51 ` Philip Yang

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).