All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: fix wrong plane_count check in dm_gpureset_toggle_interrupts()
@ 2026-07-23  1:55 yaolu
  2026-07-23  2:03 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: yaolu @ 2026-07-23  1:55 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, alexander.deucher, christian.koenig
  Cc: siqueira, amd-gfx, dri-devel, linux-kernel, Lu Yao

From: Lu Yao <yaolu@kylinos.cn>

The else-if branch in dm_gpureset_toggle_interrupts() condition was
incorrectly checking plane_count != 0, which is the same as the
preceding if-branch and can never be true in the else path.

Fixes: 8382cd234981 ("drm/amd/display: consolidate DCN vblank/flip handling onto vupdate_no_lock")
Signed-off-by: Lu Yao <yaolu@kylinos.cn>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 9c564cd5edee..a11c64277d1d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3353,7 +3353,7 @@ static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev,
 			if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))
 				drm_warn(adev_to_drm(adev), "Failed to %sable vblank interrupt\n", enable ? "en" : "dis");
 
-		} else if (acrtc && state->stream_status[i].plane_count != 0) {
+		} else if (acrtc && state->stream_status[i].plane_count == 0) {
 			/* DCN only needs to toggle VUPDATE_NO_LOCK */
 			rc = amdgpu_dm_crtc_set_vupdate_irq(&acrtc->base, enable);
 			if (rc)
-- 
2.25.1


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

* Re: [PATCH] drm/amd/display: fix wrong plane_count check in dm_gpureset_toggle_interrupts()
  2026-07-23  1:55 [PATCH] drm/amd/display: fix wrong plane_count check in dm_gpureset_toggle_interrupts() yaolu
@ 2026-07-23  2:03 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-23  2:03 UTC (permalink / raw)
  To: yaolu; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch introduces a critical boolean logic error in `dm_gpureset_toggle_interrupts` that breaks DCN interrupt toggling during GPU reset.
--

--- Patch [1]: [PATCH] drm/amd/display: fix wrong plane_count check in dm_gpureset_toggle_interrupts() ---
commit 019af4e190dd8d0cacc73ad6b2cdd860d90cbb1b
Author: Lu Yao <yaolu@kylinos.cn>
drm/amd/display: fix wrong plane_count check in dm_gpureset_toggle_interrupts()

The else-if branch in dm_gpureset_toggle_interrupts() condition was incorrectly
checking plane_count != 0, which the author states is the same as the
preceding if-branch and can never be true in the else path.

> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index f8d8132ea50ed..e3d490d27171f 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1587,7 +1587,7 @@ static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev,
>  			if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))
>  				drm_warn(adev_to_drm(adev), "Failed to %sable vblank interrupt\n", enable ? "en" : "dis");
>  
> -		} else if (acrtc && state->stream_status[i].plane_count != 0) {
> +		} else if (acrtc && state->stream_status[i].plane_count == 0) {

[Severity: High]
Does this change unintentionally break interrupt toggling for DCN hardware?

The commit message states that the preceding if-branch already checks for
plane_count != 0, making it impossible to be true here. However, looking at
the preceding if-condition in dm_gpureset_toggle_interrupts():

		if (acrtc && state->stream_status[i].plane_count != 0 &&
		    amdgpu_ip_version(adev, DCE_HWIP, 0) == 0) {

The if-branch also requires amdgpu_ip_version(adev, DCE_HWIP, 0) == 0. For
DCN hardware, this IP version check evaluates to false, which causes the
execution to fall through to this else-if branch even when plane_count != 0.

With this patch changing the check to plane_count == 0, won't DCN streams
with active planes incorrectly skip toggling VUPDATE_NO_LOCK during a GPU
reset?

>  			/* DCN only needs to toggle VUPDATE_NO_LOCK */
>  			rc = amdgpu_dm_crtc_set_vupdate_irq(&acrtc->base, enable);
>  			if (rc)
>  				drm_warn(adev_to_drm(adev), "Failed to %sable vupdate interrupt\n",
>  					 enable ? "en" : "dis");
>  		}
>  	}
>  
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260723015503.32122-1-yaolu@kylinos.cn?part=1

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

end of thread, other threads:[~2026-07-23  2:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23  1:55 [PATCH] drm/amd/display: fix wrong plane_count check in dm_gpureset_toggle_interrupts() yaolu
2026-07-23  2:03 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.