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 <[email protected]> > 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 <[email protected]> [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/[email protected]?part=1
