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=1796393993; b=S/567UfT8tUqbOkxfva2NiAsNC/sqlVVXM3nch8nfnHRsOWtC8VA2mpFKvux4SSxADQq p85nrtTZLh//rkkV1fMnlSJjkG4woEa6iVvAbpxNTEPsqHpjDNP/Ja25+Wb9Dyyojsffw pp/Cdu8WFHVEjk7mtarhu1RsYvTQ/uJDq84tbigQuuVcxOfMSgA69bxMsAMBNZZW7HP6/ tCxHi5A0I4A4Vv9tMOojcF6tStGq+6Y0ye1zqnWRLSQBKqFaWhAWwyf3EfPOeiIxhgtvq I9wmEXFoJiSEhDqhcTTcZMCbNdKNGsUavfC8i/tT9jxfMhqy3JDE0K+H3u3o027Aywg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796393993; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=PSYb4ZvBAQ01tjpZaaKAFjybh27UqPnAQqHm/MsN1Q4=; b=TTy2LJ5JG8aMF88o8CyQqKRHukT1xXGTgd5Q572yaCz5xwcIKcgmOialiQjNoIr/UXxO 77BLg4EFgGEPsGCMZrKEEE9bJUe8fOT62Ar+IC5gjJ7ad0S+Jdh7+GsDHeCdpCDGPCbi8 rgS43vvW4MlQK2l28uawEBrAmPl4ew/FAnR5cEzAZVjQbAwTTCs9Y1tpC7aQD4/QL7ZRK XNPyIUwuqCr2rW01/hgFNxLjRfgqPArHbI5Z31u1o/iSPDRrrnbLpiWCmuE6rnizlesG2 FDX7K4w6St3aaZxv+Yf98JYXH8enbopY7Dp88vQT5q/Jzm5NfqfLxrs5WP9WIoJ6fdA== 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=Lu2Ih1Si; 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 AACF9606A322 for ; Fri, 4 Dec 2026 14:19:53 +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=Lu2Ih1Si Received: by smtp.kernel.org (Postfix) with ESMTPSA id 556FF1F000C2; Fri, 4 Dec 2026 14:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796393993; bh=PSYb4ZvBAQ01tjpZaaKAFjybh27UqPnAQqHm/MsN1Q4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Lu2Ih1SiGaJotk83w6XwTLF+x/JhDtLBag4jp75q0b/EQhvMTn/g85pYpAePy+CaU TM9jRlJjw64Qv9GxmtTbeXi3aK81ASif8A2WNDP3ftp5HkBHTl9TZ8eqvw6fDoVI88 XuuBNUgeOmTOq4QOSpB8LJMeaNGll5HoUc4scnZXL/+zVbrVI5mVvLOSFaPjd0UgUx wC87cCztj7WpW0FF/yYgokcGUm3Txl5PymHFMI0t6DdvHKLNRHn1+MHGL5EAulG+o6 dVZRUNPfkUBthls1dPzxPfBTOe2RqSMMVaGRqNVnzGOue793v7McvNZXP5Xo9QZDfp VcGLPcE+rAbow== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v11 3/5] drm/bridge: trilinear: add the DPTX DRM bridge Reply-To: sashiko-reviews@lists.linux.dev To: "Luo Liu" Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261204131053.351956-4-Luo.Liu@cixtech.com> References: <20261204131053.351956-1-Luo.Liu@cixtech.com> <20261204131053.351956-4-Luo.Liu@cixtech.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:19:52 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] drm/bridge: lock inversion and late mode_changed in dptx_bridge_atomic_check() - [Medium] drm/bridge: trilinear: dptx_hpd_notify() echo filter bypassed downstream - [Medium] drm/bridge: trilinear: unlocked display_info read in dptx_bridge_mode_set() - [Low] drm/bridge: trilinear: dptx_bridge_get_modes() skips clearing stale EDID -- commit 0fb996722a63499df5034e482ec6a2609d1bce26 Author: Luo Liu drm/bridge: trilinear: add the DPTX DRM bridge This commit adds the DRM bridge layer for the Trilinear DisplayPort transmitter, implementing connector detection, EDID and downstream mode enumeration, mode validation, atomic check, and atomic enable/disable. > diff --git a/drivers/gpu/drm/bridge/trilinear/dptx_drm.c b/drivers/gpu/dr= m/bridge/trilinear/dptx_drm.c > new file mode 100644 > index 0000000000000..5372cbf920084 > --- /dev/null > +++ b/drivers/gpu/drm/bridge/trilinear/dptx_drm.c [ ... ] > +static enum drm_connector_status dptx_bridge_detect(struct drm_bridge *b= ridge, > + struct drm_connector *connector) > +{ > + struct dptx_dev *dp =3D bridge_to_dp(bridge); > + enum drm_connector_status status; > + > + status =3D dp->ops->detect_status(dp); > + WRITE_ONCE(dp->detect_task, current); > + > + return status; > +} > + > +static void dptx_hpd_notify(struct dptx_dev *dp, > + enum drm_connector_status hpd_state) > +{ > + if (READ_ONCE(dp->detect_task) =3D=3D current) { > + WRITE_ONCE(dp->detect_task, NULL); > + return; > + } > + > + if (READ_ONCE(dp->notify_task) =3D=3D current) { > + WRITE_ONCE(dp->notify_task, NULL); > + return; > + } > + > + if (!dp->oob_hpd) > + return; > + > + guard(mutex)(&dp->lock); > + > + if (dp->hpd_stopped || > + hpd_state =3D=3D connector_status_unknown) > + return; > + > + dp->force_hpd =3D hpd_state; > + > + if (!(dp->state & DPTX_STATE_SUSPENDED)) { > + queue_delayed_work(system_freezable_wq, &dp->hpd_event_work, 0); > + if (hpd_state =3D=3D connector_status_connected) > + queue_delayed_work(system_freezable_wq, > + &dp->hpd_irq_work, > + msecs_to_jiffies(20)); > + } > +} [Severity: Medium] Can the echo filter in dptx_hpd_notify() be bypassed when a downstream bridge advertises DRM_BRIDGE_OP_DETECT? drm_bridge_connector_init() assigns bridge_detect to the last bridge in the chain that sets DRM_BRIDGE_OP_DETECT. When dp->oob_hpd is true and a downstream bridge sets DRM_BRIDGE_OP_DETECT, connector probes call that bridge's detect() instead of dptx_bridge_detect(), leaving dp->detect_task NULL, and drm_bridge_connector_hpd_notify() still notifies dp->bridge. Every read-only probe then overwrites dp->force_hpd and queues hpd_event_work (and hpd_irq_work when connected). In addition, commit "drm/bridge: trilinear: add the DPTX core and build glue" only omits DRM_BRIDGE_OP_HPD on dp->bridge when the immediate dp->next_bridge sets DRM_BRIDGE_OP_DETECT. With an intermediate pass-through bridge (ops =3D=3D 0) ahead of a downstream detect-only bridge, dp->bridge remains bridge_hpd: drm_bridge_connector_handle_hpd() clears dp->notify_task via drm_bridge_connector_hpd_notify() before calling drm_kms_helper_connector_hotplug_event() -> drm_client_dev_hotplug() -> drm_bridge_connector_detect_ctx(), which re-enters dptx_hpd_notify() and re-queues hpd_event_work with zero delay in an infinite hotplug loop. [ ... ] > +static int dptx_bridge_get_modes(struct drm_bridge *bridge, > + struct drm_connector *connector) > +{ > + struct dptx_dev *dp =3D bridge_to_dp(bridge); > + const struct drm_edid *edid; > + struct drm_display_mode *mode; > + int ret; > + > + scoped_guard(mutex, &dp->lock) { > + if (dp->released || > + (dp->state & DPTX_STATE_SUSPENDED) || > + !(dp->state & DPTX_STATE_INITIALIZED) || > + !(dp->state & DPTX_STATE_CONNECTED)) > + return 0; > + > + edid =3D drm_edid_read(connector); > + } > + > + if (edid) { > + drm_edid_connector_update(connector, edid); > + ret =3D drm_edid_connector_add_modes(connector); > + drm_edid_free(edid); > + > + return ret; > + } > + > + drm_edid_connector_update(connector, NULL); [Severity: Low] Does this early return leave a stale EDID blob and stale connector->display_info fields on the connector? When a connector is forced on (DRM_FORCE_ON or DRM_FORCE_ON_DIGITAL) after a sink is unplugged, drm_helper_probe_single_connector_modes() skips its disconnected EDID-clearing path and calls get_modes() directly. Returning 0 before drm_edid_connector_update(connector, NULL) leaves the previous sink's bpc, color_formats, and YCbCr 4:2:0 mode masks populated; clearing EDID before returning 0 would match drm_bridge_connector_get_modes_edid(). [ ... ] > +static int dptx_bridge_mode_set(struct dptx_dev *dp, > + struct drm_crtc_state *crtc_state, > + struct drm_connector_state *conn_state) > +{ > + struct drm_display_mode *adjusted_mode =3D &crtc_state->adjusted_mode; > + int color_format; > + int link_rate; > + int bw_code; > + int bpc; > + int bpp; > + int ret; > + > + ret =3D dp->ops->detect(dp); > + if (ret) > + return ret; > + > + guard(mutex)(&dp->lock); > + > + if (dp->released) > + return -ENODEV; > + > + ret =3D dptx_pick_config(dp, conn_state, &crtc_state->mode, > + adjusted_mode, &color_format, &bpc, &bpp); [Severity: Medium] Is there a data race on connector->display_info between dptx_bridge_mode_set() and a concurrent connector probe? CPU0 (commit_work) CPU1 (DRM_IOCTL_MODE_GETCONNECTOR) ------------------ ---------------------------------- drm_helper_probe_single_connector_modes() dptx_bridge_get_modes() /* releases dp->lock */ dptx_bridge_atomic_enable() dptx_bridge_mode_set() lock(&dp->lock) drm_edid_connector_update() drm_reset_display_info() info->color_formats =3D 0; memset(&info->hdmi, 0, ...); dptx_pick_config() <-- data race on connector->display_info For a non-blocking atomic commit, drm_mode_atomic_ioctl() drops connection_mutex after queuing state->commit_work, so dptx_bridge_mode_set() holds only dp->lock while dptx_bridge_get_modes() calls drm_edid_connector_update() without dp->lock. If dptx_pick_config() runs during drm_reset_display_info() for a mode that needs YCbCr 4:2:0 or 4:2:2, it fails with -EINVAL and dptx_bridge_atomic_enable() aborts, leaving the output blank after the ioctl already succeeded. Storing the format, bpc, and bpp computed in dptx_bridge_atomic_check() in bridge state would avoid reading display_info in atomic_enable. [ ... ] > +static int dptx_bridge_atomic_check(struct drm_bridge *bridge, > + struct drm_bridge_state *bridge_state, > + struct drm_crtc_state *crtc_state, > + struct drm_connector_state *conn_state) > +{ [ ... ] > + if (vsc_supported) { > + const struct drm_connector_state *old_conn_state; > + > + old_conn_state =3D > + drm_atomic_get_old_connector_state(bridge_state->base.state, > + conn_state->connector); > + if (old_conn_state && > + old_conn_state->colorspace !=3D conn_state->colorspace) { > + crtc_state->mode_changed =3D true; > + > + ret =3D drm_atomic_add_affected_planes(bridge_state->base.state, > + crtc_state->crtc); > + if (ret) > + return ret; > + } > + } [Severity: High] Can calling drm_atomic_add_affected_planes() from dptx_bridge_atomic_check() cause an ABBA deadlock with encoder->bridge_chain_mutex? CPU0 CPU1 ---- ---- lock(&encoder->bridge_chain_mutex) lock(&plane->mutex) lock(&plane->mutex) lock(&encoder->bridge_chain_mutex) *** DEADLOCK *** CPU0: drm_atomic_bridge_chain_check() -> dptx_bridge_atomic_check() -> drm_atomic_add_affected_planes() -> drm_atomic_get_plane_state() CPU1: drm_atomic_helper_check_modeset() -> drm_atomic_add_affected_planes() -> mode_fixup() -> drm_atomic_bridge_chain_check() drm_atomic_bridge_chain_check() holds the plain mutex encoder->bridge_chain_mutex across dptx_bridge_atomic_check(), whereas drm_atomic_add_affected_planes() acquires plane->mutex (a crtc_ww_class ww_mutex). Because encoder->bridge_chain_mutex is not a ww_mutex, CPU1 cannot back off with -EDEADLK when a colorspace-only atomic commit races with a commit holding plane->mutex. Setting crtc_state->mode_changed here also happens after mode_fixup() in drm_atomic_helper_check_modeset() has already skipped copying mode into adjusted_mode, so the CRTC's mode_fixup() runs on a stale adjusted_mode. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204131053.3519= 56-1-Luo.Liu@cixtech.com?part=3D3