From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796309826; b=4iI1iMbZHcqbOqd7L83JP46auJlaYVPXxNdPoKv1GvwVYzgzGqwYNAG3PbTu/EvDhFSQ gNw18h62Gh00oRjYqc9r72vAaqI4/bwfNdgLKAz/xeAdAAsy7s22P7rSHxzKRbf8ExdlT +L24jezVG/Cwi8buEXyIyIZODaSNv4H935b13d6qOvaYT3AZRD6XNpNziaye7PkiXAkqr f1rf9l4Dopyoa5ZnUgfIbfgtvC35/yuULwvhtxdgDLuyrmGHEA6O8ODLywyKZDNbwhTdU F9xHSPwLPJ1CGEQXE36KEbBSfwWLs2QAaFIReabP4u3tRn5lE/ZMWwMGNhryjIXClqA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796309826; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=CpoghkC8gS71foz1XzThWW6dPGEvSO12tcEuC8WxWZc=; b=jcDROskVs7EuvO9Mds55jz2wkbmr5gaSQcI8nL7lXlXQpuMIekq2U2mFJDE/bZbhlWye kXN9Aw9HgBXgamFUp4RVEps8HcD8eW0/tRH+yQP/3xbL7Pc55P25zif9ldAEd4be/IeL7 LVowEl2FMgrLLZkS4zcZbaUqA9fYkkRgTEhxAj8791cpaIBQji7WAjOfZXLpC2JN7IxJi 178KbyixBcGEu5iG1+uyczZ9MgZi6h0JbPQz0TJda5BjQI0HHAUvbtfEJK7VFRjA/Sch7 5rNR5UaRmWOX7Hy7eiUp8Tqwg63k5QYLUVGWArVuZgm6FTkFhNSCSOSXSww1KInJCIw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ORC7L7Lq; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F18F0606A32D for ; Thu, 3 Dec 2026 14:57:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ORC7L7Lq Received: by smtp.kernel.org (Postfix) with ESMTPSA id 631FA1F0089F; Thu, 3 Dec 2026 14:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796309825; bh=CpoghkC8gS71foz1XzThWW6dPGEvSO12tcEuC8WxWZc=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=ORC7L7Lq1NaiJ+TlgJEa42Z2So6/DTpQ0ee4dyRGtWq/cuBuJXRa9N89kOlPjVpKF P8Ex/dJA2V8PDTrD1hBKRF5ftBdE3PbTtcrQ3G2zArB3NhP2zjMmePFQ7NZTMaEi5i 2JXPxmHxddSM+k5OEamMSMHLjUZPukNeV/tXVqML/Z8oXecli+nXWiWNVyfTWiD7Qt 4hHwtjXIzOBoUIlprR2ZkohZjk9wUFIcg6pynYc4na8gtuaZJsvU4KeVIGDlJ7XRsf 6IHkUx6FxDXZ/XTNb1R4A/8TvTeQWwWZeOp/hZ/i8rRm0nhYEjpuLt04UiPoMopdu8 lEMXE20QjE+LQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/sun4i: mixer: Disable layers of detached planes Reply-To: sashiko-reviews@lists.linux.dev To: "Daniel Golle" , dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 14:57:04 +0000 X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] drm/sun4i: mixer: sun8i_mixer_commit() disables layers after TCON enable - [Low] drm/sun4i: mixer: sun8i_layer_disable() re-couples mixer to UI/VI layers -- commit 53bd44a6ebfa3f50f281886c006e3cce03db081b Author: Daniel Golle drm/sun4i: mixer: Disable layers of detached planes This commit exports sun8i_ui_layer_disable() and sun8i_vi_layer_disable(), adds a sun8i_layer_disable() wrapper in sun8i_mixer.c, and calls it for every disabled plane during sun8i_mixer_commit(). > diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/= sun8i_mixer.c > index dbde80b320808..9e8b43a0c622e 100644 > --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c > +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c > @@ -251,6 +251,14 @@ int sun8i_mixer_drm_format_to_hw(u32 format, u32 *hw= _format) > return -EINVAL; > } > =20 > +static void sun8i_layer_disable(struct sun8i_layer *layer) > +{ > + if (layer->type =3D=3D SUN8I_LAYER_TYPE_VI) > + sun8i_vi_layer_disable(layer); > + else > + sun8i_ui_layer_disable(layer); > +} > + > static void sun8i_mixer_commit(struct sunxi_engine *engine, > struct drm_crtc *crtc, > struct drm_atomic_commit *state) [Severity: Low] Does reintroducing sun8i_layer_disable() reverse the mixer/layer decoupling from commit fc9b4e3b78d9 ("drm/sun4i: mixer: Move layer enabling to atomic_update")? That commit moved layer enabling into plane callbacks so DE33 can use a separate layer driver, and the plane atomic_update callbacks already disable inactive layers. Calling sun8i_layer_disable() from sun8i_mixer_commit() re-couples the mixer to UI/VI helpers and repeats the disable MMIO writes. Implementing drm_plane_helper_funcs.atomic_disable and disabling planes via drm_atomic_helper_disable_planes_on_crtc() on CRTC disable would preserve the separation. > @@ -287,8 +295,11 @@ static void sun8i_mixer_commit(struct sunxi_engine *= engine, > plane->base.id, layer->index, layer->overlay, > enable, zpos, x, y, w, h); > =20 > - if (!enable) > + /* a plane detached while the CRTC was off missed atomic_update() */ > + if (!enable) { > + sun8i_layer_disable(layer); > continue; > + } > =20 > /* Route layer to pipe based on zpos */ > route |=3D layer->index << SUN8I_MIXER_BLEND_ROUTE_PIPE_SHIFT(zpos); [Severity: High] Does disabling detached layers in sun8i_mixer_commit() leave a DMA use-after-free window when the CRTC is re-enabled? drm_atomic_helper_commit_tail_rpm() enables modeset before committing planes. Because sun4i_crtc_atomic_disable() leaves mixer layers enabled, a plane detached while the CRTC is off still points at its freed framebuffer when sun4i_crtc_atomic_enable() calls sun4i_tcon_set_status(..., true). Stale scanout then runs across encoder, bridge, and panel enable callbacks until sun4i_crtc_atomic_flush() -> sun8i_mixer_commit() runs, and on DE2/DE3 mixers it persists until the next vblank latches SUN8I_MIXER_GLOBAL_DBUFF_ENABLE. This can still trigger IOMMU page faults on SoCs like H6/H616 or scan out reallocated physical pages on non-IOMMU SoCs. Disabling the layers before stopping the TCON on CRTC disable, or before sun4i_tcon_set_status(..., true), would close this window. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/bec35b18caaf6ae11c5= 6ca49e2bbd7666a9f6367.1796256748.git.daniel@makrotopia.org?part=3D1