Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "naidu nama" <naidu.nama@oss.qualcomm.com>
Cc: linux-phy@lists.infradead.org, dri-devel@lists.freedesktop.org,
	vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH] drm/msm/dp: Skip IRQ_HPD handling when PHY is off
Date: Fri, 27 Nov 2026 07:35:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-236812@kernel.org> (raw)
In-Reply-To: <20261127072055.2144407-1-naidu.nama@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] drm/msm/dp: msm_dp_bridge_hpd_notify() skips unplug when PHY is
  off
- [Medium] drm/msm/dp: unlocked state check in
  msm_dp_bridge_hpd_notify() races
- [Low] drm/msm/dp: missing Fixes: trailer on HPD handling bug-fix
  commit
--

commit 1a57d42c93a148284843b0d84147167133e520b0
Author: naidu nama <naidu.nama@oss.qualcomm.com>

> drm/msm/dp: Skip IRQ_HPD handling when PHY is off
>
> When DP is plugged, IRQ_HPD is delivered when PHY is in uninitialized
> state, In this case avoid runtime-resuming the controller and
> attempting AUX access for an already-plugged, while the
> PHY is uninitialized state.
>
> Signed-off-by: naidu nama <naidu.nama@oss.qualcomm.com>

[Severity: Low]
This looks like a bug fix for the HPD rework.  Should this include a
Fixes: tag for 5043357e75ba ("drm/msm/dp: rework HPD handling") or
3ea2d1c3d154 ("drm/msm/dp: turn link_ready into plugged")?

> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index c0c150e2c5758..79169c1f95a57 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1607,6 +1607,11 @@ void msm_dp_bridge_hpd_notify(struct drm_bridge *bridge,
>  	struct msm_dp_display_private *dp = container_of(msm_dp_display, struct msm_dp_display_private, msm_dp_display);
>  	u32 hpd_link_status = 0;
>  
> +	if (dp->plugged && !dp->phy_initialized) {
> +		drm_dbg_dp(dp->drm_dev, "skipping IRQ_HPD in an inactive state\n");
> +		return;
> +	}

[Severity: High]
Does this early return also drop unplug events when the display stream is
disabled?

When an external DP output is disabled while a sink is still connected,
msm_dp_display_unprepare() calls msm_dp_display_host_phy_exit(), leaving
dp->plugged set to true and dp->phy_initialized set to false.  If the cable
is unplugged in that state, msm_dp_bridge_hpd_notify() is called with
status == connector_status_disconnected, but this check returns before
msm_dp_hpd_unplug_handle() can run (even though msm_dp_hpd_unplug_handle()
does no AUX transactions).  That leaves dp->plugged stuck at true, skips
audio and subconnector disconnect cleanup, and leaks the runtime PM
reference acquired at plug time.

Should this check be limited to IRQ_HPD (or moved into
msm_dp_irq_hpd_handle()) so disconnect notifications still run
msm_dp_hpd_unplug_handle()?

[Severity: Medium]
Can reading dp->plugged and dp->phy_initialized without dp->plugged_lock
race with concurrent unplug or stream teardown?

CPU0                                  CPU1
msm_dp_hpd_unplug_handle()
  mutex_lock(&dp->plugged_lock)
  msm_dp_display_host_phy_exit(dp)
    dp->phy_initialized = false
                                      msm_dp_bridge_hpd_notify()
                                        if (dp->plugged &&
                                            !dp->phy_initialized)
                                          return;  <-- drops HPD event
  ...
  dp->plugged = false
  mutex_unlock(&dp->plugged_lock)

msm_dp_hpd_unplug_handle() clears dp->phy_initialized under
dp->plugged_lock before performing audio and runtime PM teardown and
clearing dp->plugged.  Conversely, if msm_dp_display_unprepare() calls
msm_dp_display_host_phy_exit() right after msm_dp_bridge_hpd_notify()
passes this unlocked check, msm_dp_irq_hpd_handle() will still proceed with
AUX transactions while the PHY is uninitialized.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127072055.2144407-1-naidu.nama@oss.qualcomm.com?part=1

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

      reply	other threads:[~2026-11-27  7:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  7:20 [PATCH] drm/msm/dp: Skip IRQ_HPD handling when PHY is off naidu nama
2026-11-27  7:35 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-236812@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=naidu.nama@oss.qualcomm.com \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox