Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ankit Nautiyal" <ankit.k.nautiyal@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 01/15] drm/i915/dp: Forget the PCON FRL training state on a long HPD
Date: Fri, 04 Dec 2026 09:45:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-249538@kernel.org> (raw)
In-Reply-To: <20261204085746.391918-2-ankit.k.nautiyal@intel.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] drm/i915/dp: long HPD without modeset breaks HDMI FRL link
  recovery
- [Medium] drm/i915/dp: unlocked intel_dp->frl.is_trained write races
  with enable
- [Medium] drm/i915/dp: unlocked race on frl.is_trained in
  intel_dp_hpd_pulse()
- [Low] drm/i915/dp: missing Fixes tag for PCON FRL state reset on long
  HPD
--

commit f7ef6c5b005b15275af0bf3883f1f982970ce603
Author: Ankit Nautiyal <ankit.k.nautiyal@intel.com>

> drm/i915/dp: Forget the PCON FRL training state on a long HPD
>
> Currently, the intel_dp->frl.is_trained is cleared only when the HDMI link
> status IRQ reports the link down. A sink disconnect, or a PCON that resets
> itself and drops the HPD, doesn't clear it. As a result, the FRL training
> is skipped at the next enable although the HDMI link is gone.
>
> Clear the flag on a long HPD. The next enable then reads the state of
> the PCON, and trains the link if it is not already in FRL mode.
>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>

[Severity: Low]
This looks like a bug fix for PCON FRL training state tracking.  Should
this include:

  Fixes: ced42f2df5fd ("drm/i915: Add support for starting FRL training for HDMI2.1 via PCON")

> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 0c7c57d9f3abf..179e0d8b89c2c 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -7140,6 +7140,13 @@ intel_dp_hpd_pulse(struct intel_digital_port *dig_port, bool long_hpd)
>  		intel_dp->reset_link_params = true;
>  		intel_dp_invalidate_source_oui(intel_dp);
>  
> +		/*
> +		 * The HDMI link of a PCON is lost with the sink, forget its
> +		 * trained state, so that the FRL training is checked again at
> +		 * the next enable.
> +		 */
> +		intel_dp->frl.is_trained = false;

[Severity: Medium]
Can clearing intel_dp->frl.is_trained on a long HPD break FRL link
recovery when no modeset follows?

If a transient long HPD occurs while the upstream DP link stays up and
the sink EDID is unchanged (such as a Type-C HPD deassert/reassert
without unplugging), intel_dp_detect() reports the connector connected
and intel_dp_check_link_state() -> intel_dp_needs_link_retrain() only
checks the upstream DP link via intel_dp_link_ok(), so no encoder enable
runs.

intel_dp->frl.is_trained then stays false while the stream remains
active, causing intel_dp_handle_hdmi_link_status_change() (which gates
recovery on intel_dp->frl.is_trained && !is_active) to silently ignore
later HDMI link drops until a full modeset occurs.

[Severity: Medium]
Can this unlocked write to intel_dp->frl.is_trained race with modeset
enable and lose the long HPD invalidation?

intel_dp_hpd_pulse() runs from i915_digport_work_func() with no modeset
locks held, while mtl_ddi_pre_enable_dp() (and tgl_ddi_pre_enable_dp() /
intel_enable_dp()) calls intel_dp_check_frl_training() before
intel_dp_start_link_train() calls intel_hpd_block():

CPU0 (modeset enable)             CPU1 (dig_port_work)
mtl_ddi_pre_enable_dp()
  intel_dp_check_frl_training()
    intel_dp_pcon_start_frl_training()
      poll intel_dp_pcon_is_frl_trained()
                                  i915_digport_work_func()
                                    intel_dp_hpd_pulse(..., true)
                                      intel_dp->frl.is_trained = false
      intel_dp->frl.is_trained = true  <-- overwrites long HPD reset

Because intel_dp_pcon_start_frl_training() polls DPCD for up to 1.5s
without blocking HPD, a sink disconnect or PCON reset in that window is
overwritten back to true, so the next enable skips FRL training even
though the HDMI link is gone.  The concurrent plain read/write is also a
data race (contrast intel_dp_invalidate_source_oui() above using
WRITE_ONCE()).

[Severity: Medium]
Can a delayed long HPD in i915_digport_work_func() also clobber a
freshly trained intel_dp->frl.is_trained state back to false?

CPU0 (modeset enable)             CPU1 (dig_port_work)
                                  i915_digport_work_func()
                                    intel_dp_hpd_pulse(..., true)
                                      intel_dp_read_dprx_caps()
mtl_ddi_pre_enable_dp()
  intel_dp_check_frl_training()
    intel_dp_pcon_start_frl_training()
      intel_dp->frl.is_trained = true
                                      intel_dp->frl.is_trained = false
                                        <-- clobbers trained state

If intel_dp_hpd_pulse() is delayed behind another port or inside
intel_dp_read_dprx_caps(), it can clear intel_dp->frl.is_trained right
after FRL training finishes, disabling later HDMI_LINK_STATUS_CHANGED
recovery.  Later in this series, commit "drm/i915/dp: Store the PCON FRL
rate in the crtc state" adds an unlocked write to
intel_dp->frl.trained_rate_gbps beside this one, which can also leave
torn state with is_trained true and trained_rate_gbps zero.

Serializing FRL state updates with modeset enable, or blocking HPD
across FRL training, would prevent both races.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204085746.391918-1-ankit.k.nautiyal@intel.com?part=1

  reply	other threads:[~2026-12-04  9:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  8:57 [PATCH v5 00/15] DP-HDMI PCON DSC fixes Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 01/15] drm/i915/dp: Forget the PCON FRL training state on a long HPD Ankit Nautiyal
2026-12-04  9:45   ` sashiko-bot [this message]
2026-12-04  8:57 ` [PATCH v5 02/15] drm/i915/dp: Account for FRL 16b/18b encoding overhead Ankit Nautiyal
2026-12-04  9:36   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 03/15] drm/i915/hdmi: Clamp the target_bpp only when it equals the link bpp Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 04/15] drm/i915/dp: Add PCON DSC state to crtc_state Ankit Nautiyal
2026-12-04  9:43   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 05/15] drm/dp: Add a helper to disable the PCON DSC encoder Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 06/15] drm/i915/dp: Compute the PCON DSC operation Ankit Nautiyal
2026-12-04  9:38   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 07/15] drm/i915/dp: Disable the PCON DSC encoder unless it is needed Ankit Nautiyal
2026-12-04  9:38   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 08/15] drm/i915/dp: Clamp PCON DSC bpp to the FRL link bandwidth Ankit Nautiyal
2026-12-04  9:33   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 09/15] drm/i915/dp: Add a helper for the FRL payload bandwidth Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 10/15] drm/i915/dp: Compute the PCON DSC encoder parameters Ankit Nautiyal
2026-12-04  9:52   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 11/15] drm/i915/dp: Retrain the PCON FRL link from the link check work Ankit Nautiyal
2026-12-04  9:52   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 12/15] drm/i915/dp: Store the PCON FRL rate in the crtc state Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 13/15] drm/i915/dp: Use the FRL rate of the stream on the HDMI link Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 14/15] drm/i915/dp: Pick the bpc for a PCON DSC stream Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 15/15] drm/i915/dp: Allow PCON DSC modes through the FRL bw check Ankit Nautiyal
2026-12-04  9:31 ` ✓ CI.KUnit: success for DP-HDMI PCON DSC fixes (rev5) Patchwork

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-249538@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.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