Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: linux-amlogic@lists.infradead.org,
	dri-devel@lists.freedesktop.org, neil.armstrong@linaro.org
Subject: Re: [PATCH v4 6/8] drm/msm: dp: handle the IRQ_HPD events reported by USB-C
Date: Sun, 07 Jun 2026 21:48:29 +0000	[thread overview]
Message-ID: <20260607214829.B05091F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260608-hpd-irq-events-v4-6-30b62b335487@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] Initial connection and replug events are incorrectly bypassed if accompanied by an IRQ_HPD status, leaving the display disconnected.

Pre-existing issues:
- [High] `msm_dp_irq_hpd_handle` modifies shared state without acquiring `dp->plugged_lock`, leading to unprotected concurrent modification of DPCD and link state.
--

commit 48a78358ae98020ff3993aab3250dd8c32cc6835
Author: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

drm/msm: dp: handle the IRQ_HPD events reported by USB-C

This patch adds support for tracking and handling IRQ_HPD events
delivered over out-of-band events (such as USB-C AltMode handlers)
in the MSM DisplayPort driver.

> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index c0f6a8ff9b99d..743d8fa40dc68 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1533,11 +1533,12 @@ void msm_dp_bridge_hpd_notify(struct drm_bridge *bridge,
>  		   msm_dp_display->connector_type, hpd_link_status, status);
>  
>  	if (status == connector_status_connected) {
> -		if (hpd_link_status == ISR_HPD_REPLUG_COUNT) {
> +		if (hpd_link_status == ISR_IRQ_HPD_PULSE_COUNT ||
> +		    extra_status == DRM_CONNECTOR_DP_IRQ_HPD) {
> +			msm_dp_irq_hpd_handle(dp);

[Severity: High]
This is a pre-existing issue, but does msm_dp_irq_hpd_handle() need to
acquire the dp->plugged_lock?

Since msm_dp_irq_hpd_handle() can call msm_dp_display_process_hpd_high(),
which reads from DPCD and modifies shared driver state (like
dp->link->lttpr_count, dp->panel->dpcd, and dp->audio_supported), it seems
like it could race. Other HPD handlers like msm_dp_hpd_plug_handle() use
guard(mutex)(&dp->plugged_lock) to safely synchronize access.

With out-of-band events processed via workqueues, can this function
run concurrently with other HPD handlers or msm_dp_bridge_detect() and
corrupt the internal representation of the hardware configuration?

[Severity: High]
If an out-of-band handler reports an initial connection with both hpd_state=1
and hpd_irq=1 simultaneously, does this new ordering bypass the required plug
sequence?

By placing the IRQ_HPD check at the top of the if/else chain, if
extra_status == DRM_CONNECTOR_DP_IRQ_HPD, the code will execute
msm_dp_irq_hpd_handle() and skip msm_dp_hpd_plug_handle().

If msm_dp_hpd_plug_handle() is skipped, dp->plugged remains false, PHY
initialization (msm_dp_display_host_phy_init) never occurs, and
msm_dp_aux_enable_xfers() is never called. Won't the subsequent AUX reads
within msm_dp_irq_hpd_handle() fail with -ENXIO, aborting the initialization
and leaving the display disconnected?

> +		} else if (hpd_link_status == ISR_HPD_REPLUG_COUNT) {
>  			msm_dp_hpd_unplug_handle(dp);
>  			msm_dp_hpd_plug_handle(dp);
> -		} else if (hpd_link_status == ISR_IRQ_HPD_PULSE_COUNT) {
> -			msm_dp_irq_hpd_handle(dp);
>  		} else {
>  			msm_dp_hpd_plug_handle(dp);
>  		}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260608-hpd-irq-events-v4-0-30b62b335487@oss.qualcomm.com?part=6

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-06-07 21:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07 21:33 [PATCH v4 0/8] drm: handle IRQ_HPD events correctly Dmitry Baryshkov
2026-06-07 21:33 ` [PATCH v4 1/8] drm/connector: report out-of-band IRQ_HPD events Dmitry Baryshkov
2026-06-07 21:46   ` sashiko-bot
2026-06-09 13:20   ` Maxime Ripard
2026-06-07 21:33 ` [PATCH v4 2/8] drm/connector: pass down IRQ_HPD to the drivers Dmitry Baryshkov
2026-06-07 21:33 ` [PATCH v4 3/8] drm/bridge: aux-hpd: let drivers pass IRQ_HPD events Dmitry Baryshkov
2026-06-07 21:33 ` [PATCH v4 4/8] drm/bridge: pass extra events to the HPD callback Dmitry Baryshkov
2026-06-08  8:39   ` Francesco Dolcini
2026-06-07 21:33 ` [PATCH v4 5/8] drm/bridge: pass down IRQ_HPD to the drivers Dmitry Baryshkov
2026-06-07 21:49   ` sashiko-bot
2026-06-07 21:33 ` [PATCH v4 6/8] drm/msm: dp: handle the IRQ_HPD events reported by USB-C Dmitry Baryshkov
2026-06-07 21:48   ` sashiko-bot [this message]
2026-06-08  6:12     ` Dmitry Baryshkov
2026-06-07 21:33 ` [PATCH v4 7/8] soc: qcom: pmic-glink-altmode: pass down HPD_IRQ events Dmitry Baryshkov
2026-06-07 21:46   ` sashiko-bot
2026-06-07 21:33 ` [PATCH v4 8/8] usb: typec: ucsi: huawei-gaokun: " Dmitry Baryshkov
2026-06-07 21:46   ` sashiko-bot
2026-06-07 21:55     ` Dmitry Baryshkov

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=20260607214829.B05091F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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