Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: vop2: Reset the AXI master in vop2_enable()
@ 2026-11-25 20:45 Tim Surber
  2026-11-26  2:15 ` Chaoyi Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Surber @ 2026-11-25 20:45 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: Tim Surber, Cristian Ciocaltea, Sandy Huang, Andy Yan, Andy Yan,
	Sebastian Reichel, Daniel Stone, Philipp Zabel,
	Nicolas Frattaroli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, kernel, dri-devel,
	linux-rockchip, linux-arm-kernel, linux-kernel

Asserting the AXI reset in vop2_disable(), while the IOMMU is still
attached, can hang RK3588 hard when buffers are mapped into or unmapped
from the VOP's IOMMU domain at the same time, e.g. when a KMS client
exits and fbcon takes the display back.

Do the reset in vop2_enable() instead, before the IOMMU is attached,
where the AXI master is idle.

Fixes: 67a391e50271 ("drm/rockchip: vop2: Reset AXI and DCLK to improve robustness")
Signed-off-by: Tim Surber <me@timsurber.de>
---

On my RK3588 board (FriendlyElec CM3588) the AXI reset in vop2_disable()
sometimes hangs the SoC hard when the last CRTC is switched off. Without
the reset there, it does not happen.

Here is a minimal reproducer. Run it as root, with a display on HDMI and
fbcon on it:

  python3 - <<'EOF' &
  import fcntl, os, struct
  fd = os.open("/dev/dri/by-path/platform-display-subsystem-card", os.O_RDWR)
  try:
      fcntl.ioctl(fd, 0x641F)        # DRM_IOCTL_DROP_MASTER: leave KMS to fbcon
  except OSError:
      pass
  while True:
      b = bytearray(struct.pack("6IQ", 2160, 3840, 32, 0, 0, 0, 0))
      fcntl.ioctl(fd, 0xC02064B2, b)                         # DRM_IOCTL_MODE_CREATE_DUMB
      handle = struct.unpack("6IQ", b)[4]
      fcntl.ioctl(fd, 0xC00464B4, struct.pack("I", handle))  # DRM_IOCTL_MODE_DESTROY_DUMB
  EOF
  while :; do
  	echo 4 > /sys/class/graphics/fb0/blank; sleep 0.3
  	echo 0 > /sys/class/graphics/fb0/blank; sleep 0.7
  done

Without this patch the board hangs within a few blank cycles. With it,
300 cycles ran without a hang.


 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 76d151b8bc52..a86ac9173aac 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -913,6 +913,9 @@ static int vop2_enable(struct vop2 *vop2)
 	if (ret)
 		goto err_put_pm;
 
+	/* Reset while idle; doing it in vop2_disable() can hang the SoC */
+	vop2_reset_assert_deassert(vop2, vop2->axi_rst);
+
 	ret = rockchip_drm_dma_attach_device(vop2->drm, vop2->dev);
 	if (ret) {
 		drm_err(vop2->drm, "failed to attach dma mapping: %d\n", ret);
@@ -973,8 +976,6 @@ static int vop2_enable(struct vop2 *vop2)
 
 static void vop2_disable(struct vop2 *vop2)
 {
-	vop2_reset_assert_deassert(vop2, vop2->axi_rst);
-
 	rockchip_drm_dma_detach_device(vop2->drm, vop2->dev);
 
 	regcache_drop_region(vop2->map, 0, vop2_regmap_config.max_register);

base-commit: 479e381e77dcde0dfcc9d51e89ff3273da199804
-- 
2.55.0



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

* Re: [PATCH] drm/rockchip: vop2: Reset the AXI master in vop2_enable()
  2026-11-25 20:45 [PATCH] drm/rockchip: vop2: Reset the AXI master in vop2_enable() Tim Surber
@ 2026-11-26  2:15 ` Chaoyi Chen
  2026-12-01 22:42   ` Tim Surber
  0 siblings, 1 reply; 3+ messages in thread
From: Chaoyi Chen @ 2026-11-26  2:15 UTC (permalink / raw)
  To: Tim Surber
  Cc: Heiko Stuebner, Cristian Ciocaltea, Sandy Huang, Andy Yan,
	Andy Yan, Sebastian Reichel, Daniel Stone, Philipp Zabel,
	Nicolas Frattaroli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, kernel, dri-devel,
	linux-rockchip, linux-arm-kernel, linux-kernel

Hi Tim,

On 11/26/2026 4:45 AM, Tim Surber wrote:
> Asserting the AXI reset in vop2_disable(), while the IOMMU is still
> attached, can hang RK3588 hard when buffers are mapped into or unmapped
> from the VOP's IOMMU domain at the same time, e.g. when a KMS client
> exits and fbcon takes the display back.
> 
> Do the reset in vop2_enable() instead, before the IOMMU is attached,
> where the AXI master is idle.
> 
> Fixes: 67a391e50271 ("drm/rockchip: vop2: Reset AXI and DCLK to improve robustness")
> Signed-off-by: Tim Surber <me@timsurber.de>
> ---
> 
> On my RK3588 board (FriendlyElec CM3588) the AXI reset in vop2_disable()
> sometimes hangs the SoC hard when the last CRTC is switched off. Without
> the reset there, it does not happen.
> 
> Here is a minimal reproducer. Run it as root, with a display on HDMI and
> fbcon on it:
> 
>   python3 - <<'EOF' &
>   import fcntl, os, struct
>   fd = os.open("/dev/dri/by-path/platform-display-subsystem-card", os.O_RDWR)
>   try:
>       fcntl.ioctl(fd, 0x641F)        # DRM_IOCTL_DROP_MASTER: leave KMS to fbcon
>   except OSError:
>       pass
>   while True:
>       b = bytearray(struct.pack("6IQ", 2160, 3840, 32, 0, 0, 0, 0))
>       fcntl.ioctl(fd, 0xC02064B2, b)                         # DRM_IOCTL_MODE_CREATE_DUMB
>       handle = struct.unpack("6IQ", b)[4]
>       fcntl.ioctl(fd, 0xC00464B4, struct.pack("I", handle))  # DRM_IOCTL_MODE_DESTROY_DUMB
>   EOF
>   while :; do
>   	echo 4 > /sys/class/graphics/fb0/blank; sleep 0.3
>   	echo 0 > /sys/class/graphics/fb0/blank; sleep 0.7
>   done
> 
> Without this patch the board hangs within a few blank cycles. With it,
> 300 cycles ran without a hang.
> 
> 
>  drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> index 76d151b8bc52..a86ac9173aac 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> @@ -913,6 +913,9 @@ static int vop2_enable(struct vop2 *vop2)
>  	if (ret)
>  		goto err_put_pm;
>  
> +	/* Reset while idle; doing it in vop2_disable() can hang the SoC */
> +	vop2_reset_assert_deassert(vop2, vop2->axi_rst);
> +
>  	ret = rockchip_drm_dma_attach_device(vop2->drm, vop2->dev);
>  	if (ret) {
>  		drm_err(vop2->drm, "failed to attach dma mapping: %d\n", ret);
> @@ -973,8 +976,6 @@ static int vop2_enable(struct vop2 *vop2)
>  
>  static void vop2_disable(struct vop2 *vop2)
>  {
> -	vop2_reset_assert_deassert(vop2, vop2->axi_rst);
> -
>  	rockchip_drm_dma_detach_device(vop2->drm, vop2->dev);
> 

This looks great. But what happens if you place 
vop2_reset_assert_deassert() after rockchip_drm_dma_detach_device()?

>  	regcache_drop_region(vop2->map, 0, vop2_regmap_config.max_register);
> 
> base-commit: 479e381e77dcde0dfcc9d51e89ff3273da199804

-- 
Best, 
Chaoyi


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

* Re: [PATCH] drm/rockchip: vop2: Reset the AXI master in vop2_enable()
  2026-11-26  2:15 ` Chaoyi Chen
@ 2026-12-01 22:42   ` Tim Surber
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Surber @ 2026-12-01 22:42 UTC (permalink / raw)
  To: Chaoyi Chen
  Cc: Tim Surber, Heiko Stuebner, Cristian Ciocaltea, Sandy Huang,
	Andy Yan, Andy Yan, Sebastian Reichel, Daniel Stone,
	Philipp Zabel, Nicolas Frattaroli, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	kernel, dri-devel, linux-rockchip, linux-arm-kernel, linux-kernel

Hi Chaoyi,

On 11/26/26 03:15, Chaoyi Chen wrote:
> On 11/26/2026 4:45 AM, Tim Surber wrote:
>>  static void vop2_disable(struct vop2 *vop2)
>>  {
>> -	vop2_reset_assert_deassert(vop2, vop2->axi_rst);
>> -
>>  	rockchip_drm_dma_detach_device(vop2->drm, vop2->dev);
>
> This looks great. But what happens if you place
> vop2_reset_assert_deassert() after rockchip_drm_dma_detach_device()?

That works as well. 

Would you prefer it this way?

Best regards,
Tim


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

end of thread, other threads:[~2026-12-01 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 20:45 [PATCH] drm/rockchip: vop2: Reset the AXI master in vop2_enable() Tim Surber
2026-11-26  2:15 ` Chaoyi Chen
2026-12-01 22:42   ` Tim Surber

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