Re: [PATCH v6 07/15] drm/rockchip: vop2: Reset AXI and DCLK to improve robustness

From: Cristian Ciocaltea

Date: Tue Nov 24 2026 - 20:58:26 EST


Hi Tim,

On 11/21/26 4:31 AM, Tim Surber wrote:
> Hi Cristian,
>
> On Thu, 05 Nov 2026 03:00:41 +0200, Cristian Ciocaltea wrote:
>> @@ -953,6 +974,8 @@ 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);
>
> with this patch my RK3588 board (FriendlyElec
> CM3588) hangs hard sometimes when the last CRTC is switched off. Without the series
> or with the AXI reset in vop2_disable() removed it does not happen.
>
> Here is a minimal reproducer, run 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
>
> This hangs the board within a few blank cycles. In
> practice I hit it when a KMS application exits: it frees its buffers
> while fbcon takes the display back with a full modeset.

Thanks for reporting this - with your reproducer I could also trigger the hang
on my Rock5B board, after ~15 cycles.

> This issue can be fixed for me by moving vop2_reset_assert_deassert(vop2, vop2->axi_rst) from vop2_disable to vop2_enable.
>
> --8<--
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> --- 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);
> -->8--
>
> Does that work for the cases the reset was added for (the RGB <-> YUV420
> switch glitches and the DSI panel on the EVB1)? I can't test those here.

I briefly tested the RGB <-> YUV420 mode switches and didn't notice any obvious
regressions. For the EVB1 we need Sebastian's help, as I don't have that board.

Would you like to send a proper patch in the meantime?

Regards,
Cristian