Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95B94606A31C for ; Mon, 30 Nov 2026 12:21:29 +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=eCSvpl6H Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BFCFE10E46B; Mon, 30 Nov 2026 12:21:23 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id BF12F10E46B for ; Mon, 30 Nov 2026 12:21:16 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D909C61F9C; Mon, 30 Nov 2026 12:21:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BB691F00926; Mon, 30 Nov 2026 12:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796041275; bh=AbrQukLW3BDxddbYWvG43RksZQ1r3SY7TjHKgp2SkGo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=eCSvpl6Hjkb+KA+B9woCxUqT5MPIymvWjjEECmGeS9JSqLweGE6ujReOWFb558ZIJ Qcl1EGfZuxW+yrW1XdEboitSTYrs5xf/+yuYjxbosGqFaj8ZwKLbTwGX2HWaelmUt4 YFuC1RA6TvK71b4BpevTn35dNXJ52ChnVBEMJ7DrteXM8k6NGvdQi1I8M712gpFkdO BJ4yfdYMuRfu4xj5Lj9uXKtvxb4bddW7sVy2YqbxDgQXR0b8zpUaPG7v+DNcfYUWHf SiVsFJwY8YrbGHH+jIhlHqwy5nM2ZX9xd8tcIyXk+aBoHJINQi3gwoR6sijvujHZpY j8cd9N2qPTxNA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v8 19/20] drm/bridge: analogix_dp: Handle HPD notification from downstream bridge To: "Damon Ding" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261130115152.1797928-20-damon.ding@rock-chips.com> References: <20261130115152.1797928-1-damon.ding@rock-chips.com> <20261130115152.1797928-20-damon.ding@rock-chips.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 12:21:15 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] drm/bridge: analogix_dp: stale detect status and redundant AUX probes - [Medium] drm/bridge: analogix_dp: ignored wait_us in analogix_dpaux_wait_hpd_asserted() - [Medium] drm/bridge: analogix_dp: bypassed HPD check in analogix_dp_detect_hpd() -- commit 23ae2fa9f54b40e12639b8192ac7730ca3b660f6 Author: Damon Ding drm/bridge: analogix_dp: Handle HPD notification from downstream bridge This commit adds an HPD notify mode for pipelines where hotplug events come from a downstream bridge, muting native HPD interrupts and probing the sink over the AUX channel on HPD notifications. Link: https://lore.kernel.org/all/5609825.iZASKD2KPV@diego/ > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers= /gpu/drm/bridge/analogix/analogix_dp_core.c > index e156fe9682582..04e9dc20fe86c 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c [ ... ] > @@ -86,10 +86,29 @@ static void analogix_dp_init_dp(struct analogix_dp_de= vice *dp) > analogix_dp_init_aux(dp); > } > =20 > +static bool analogix_dp_probe_sink(struct analogix_dp_device *dp) > +{ > + u8 dpcd_rev =3D 0; > + int ret; > + > + ret =3D pm_runtime_resume_and_get(dp->dev); > + if (ret) > + return false; > + > + ret =3D drm_dp_dpcd_readb(&dp->aux, DP_DPCD_REV, &dpcd_rev); > + > + pm_runtime_put_autosuspend(dp->dev); > + > + return ret =3D=3D 1 && dpcd_rev !=3D 0; > +} > + > static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) > { > int timeout_loop =3D 0; > =20 > + if (dp->hpd_notify_mode) > + return 0; > + > while (timeout_loop < DP_TIMEOUT_LOOP_COUNT) { > if (analogix_dp_get_plug_in_status(dp) =3D=3D 0) > return 0; > @@ -931,6 +950,10 @@ analogix_dp_bridge_detect(struct drm_bridge *bridge,= struct drm_connector *conne > struct analogix_dp_device *dp =3D to_dp(bridge); > enum drm_connector_status status =3D connector_status_disconnected; > =20 > + if (dp->hpd_notify_mode) > + return dp->connection_notified ? connector_status_connected : > + connector_status_disconnected; > + > if (dp->force_connected_mode) > return connector_status_connected; [ ... ] > @@ -1287,6 +1326,17 @@ static void analogix_dp_bridge_atomic_post_disable= (struct drm_bridge *bridge, > DRM_ERROR("Failed to enable psr (%d)\n", ret); > } > =20 > +static void analogix_dp_bridge_notify(struct drm_bridge *bridge, struct = drm_connector *connector, > + enum drm_connector_status status) > +{ > + struct analogix_dp_device *dp =3D to_dp(bridge); > + > + if (!dp->hpd_notify_mode) > + return; > + > + dp->connection_notified =3D analogix_dp_probe_sink(dp); > +} [Severity: High] Does probing the sink in analogix_dp_bridge_notify() instead of analogix_dp_bridge_detect() cause drm_bridge_connector_detect_ctx() to return the stale pre-probe status? drivers/gpu/drm/display/drm_bridge_connector.c:drm_bridge_connector_detect_= ctx() { if (detect) { status =3D detect->funcs->detect(detect, connector); ... drm_bridge_connector_hpd_notify(connector, status); } ... return status; } drm_bridge_connector_detect_ctx() calls .detect() first, notifies the bridge chain with that result, and returns the pre-notify status. During initial driver bind or system resume, before a downstream HPD event runs, analogix_dp_bridge_detect() returns connector_status_disconnected even when analogix_dp_bridge_notify() immediately probes the connected sink at the end of the same detect call, leaving the display without modes because DRM_CONNECTOR_POLL_HPD does not re-poll. Because drm_bridge_connector_detect_ctx() always invokes drm_bridge_connector_hpd_notify(), every detection cycle also triggers analogix_dp_probe_sink() again. On a cable unplug or a detect call with no sink attached, analogix_dp_bridge_notify() ignores status =3D=3D connector_status_disconnected and analogix_dp_detect_hpd() returns 0, so drm_dp_dpcd_readb() performs all 32 AUX retries against a disconnected sink, stalling for ~650 ms and logging 32 dev_err("AUX CH cmd reply timeout!\n") messages per probe. In addition, drm_bridge_connector_handle_hpd() drops dev->mode_config.mutex before calling drm_bridge_connector_hpd_notify(), so a concurrent detect call can read the old dp->connection_notified value while analogix_dp_probe_sink() is still in flight. Finally, the commit message still states that the probe result is refreshed by both the notify and the detect paths. [ ... ] > @@ -1450,7 +1501,12 @@ static int analogix_dpaux_wait_hpd_asserted(struct= drm_dp_aux *aux, unsigned lon > if (dp->force_hpd) > return 0; > =20 > - pm_runtime_get_sync(dp->dev); > + if (dp->hpd_notify_mode) > + return analogix_dp_probe_sink(dp) ? 0 : -ETIMEDOUT; [Severity: Medium] Does analogix_dpaux_wait_hpd_asserted() ignore wait_us in hpd_notify_mode? drm_dp_aux.wait_hpd_asserted is expected to wait up to wait_us microseconds for the sink to come up without logging timeout errors, whereas a single analogix_dp_probe_sink() call fails immediately with -ETIMEDOUT and logs 32 AUX timeout errors if the sink is still powering up. > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/= gpu/drm/bridge/analogix/analogix_dp_reg.c > index af5e5a8ec88d6..125f4fecbaa28 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c [ ... ] > @@ -533,16 +533,15 @@ int analogix_dp_get_plug_in_status(struct analogix_= dp_device *dp) > { > u32 reg; > =20 > - if (dp->hpd_gpiod) { > - if (gpiod_get_value(dp->hpd_gpiod)) > - return 0; > - } else { > - reg =3D readl(dp->reg_base + ANALOGIX_DP_SYS_CTL_3); > - if (reg & HPD_STATUS) > - return 0; > - } > + if (dp->hpd_gpiod) > + return gpiod_get_value(dp->hpd_gpiod) ? 0 : -EINVAL; > + > + if (dp->hpd_notify_mode) > + return dp->connection_notified ? 0 : -EINVAL; [Severity: Medium] Is this dp->hpd_notify_mode check reachable when analogix_dp_detect_hpd() returns 0 unconditionally at the top of the function? Every caller of analogix_dp_get_plug_in_status() (analogix_dp_detect_hpd(), analogix_dpaux_wait_hpd_asserted(), and analogix_dp_irq_thread()) is bypassed or disabled in hpd_notify_mode, which also causes analogix_dp_set_bridge() to get 0 from analogix_dp_detect_hpd() and proceed with link training in analogix_dp_commit() even when dp->connection_notified is false. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130115152.1797= 928-1-damon.ding@rock-chips.com?part=3D19