Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kory Maincent" <kory.maincent@bootlin.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 7/8] drm/dp: Move eDP sink link rates reading helper out of i915
Date: Wed, 18 Nov 2026 10:53:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-220759@kernel.org> (raw)
In-Reply-To: <20261118-feat_move_i915_helper-v1-7-652177f3107a@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/i915/dp: HBR2 quirk in intel_edp_set_sink_rates() skips
  fallback
--

commit b3bcea937e62f9aba672f8e2782fab0f2b184dbd
Author: Kory Maincent <kory.maincent@bootlin.com>

drm/dp: Move eDP sink link rates reading helper out of i915

This commit moves the eDP DP_SUPPORTED_LINK_RATES reading logic from i915
into a generic drm_dp_read_edp_sink_rates() helper.

> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 8fee2d195c944..225f6ed8c32d8 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -4815,56 +4815,21 @@ static void
>  intel_edp_set_sink_rates(struct intel_dp *intel_dp)
>  {
>  	struct intel_display *display = to_intel_display(intel_dp);
> +	int num_sink_rates;
>  
> -	intel_dp->num_sink_rates = 0;
> -
> -	if (intel_dp->edp_dpcd[0] >= DP_EDP_14) {
> -		__le16 sink_rates[DP_MAX_SUPPORTED_RATES];
> -		int ret;
> -		int i;
> -
> -		ret = drm_dp_dpcd_read_data(&intel_dp->aux,
> -					    DP_SUPPORTED_LINK_RATES,
> -					    sink_rates, sizeof(sink_rates));
> -		if (ret < 0) {
> -			drm_dbg_kms(display->drm,
> -				    "Unable to read eDP supported link rates, using default rates\n");
> -			memset(sink_rates, 0, sizeof(sink_rates));
> -		}
> -
> -		for (i = 0; i < ARRAY_SIZE(sink_rates); i++) {
> -			int rate;
> -
> -			/* Value read multiplied by 200kHz gives the per-lane
> -			 * link rate in kHz. The source rates are, however,
> -			 * stored in terms of LS_Clk kHz. The full conversion
> -			 * back to symbols is
> -			 * (val * 200kHz)*(8/10 ch. encoding)*(1/8 bit to Byte)
> -			 */
> -			rate = le16_to_cpu(sink_rates[i]) * 200 / 10;
> -
> -			if (rate == 0)
> -				break;
> -
> -			/*
> -			 * Some platforms cannot reliably drive HBR3 rates due to PHY limitations,
> -			 * even if the sink advertises support. Reject any sink rates above HBR2 on
> -			 * the known machines for stable output.
> -			 */
> -			if (rate > 540000 &&
> -			    intel_has_quirk(display, QUIRK_EDP_LIMIT_RATE_HBR2))
> -				break;
> +	num_sink_rates = drm_dp_read_edp_sink_rates(&intel_dp->aux,
> +						    intel_dp->edp_dpcd[0],
> +						    intel_dp->sink_rates);
> +	if (num_sink_rates < 0)
> +		num_sink_rates = 0;
>  
> -			intel_dp->sink_rates[i] = rate;
> -		}
> -		intel_dp->num_sink_rates = i;
> -	}
> +	intel_dp->num_sink_rates = num_sink_rates;
>  
>  	/*
>  	 * Use DP_LINK_RATE_SET if DP_SUPPORTED_LINK_RATES are available,
>  	 * default to DP_MAX_LINK_RATE and DP_LINK_BW_SET otherwise.
>  	 */
> -	if (intel_dp->num_sink_rates)
> +	if (num_sink_rates)
>  		intel_dp->use_rate_select = true;
>  	else
>  		intel_dp_set_sink_rates(intel_dp);

[Severity: Medium]
Can this leave intel_dp->num_sink_rates as 0 on platforms with
QUIRK_EDP_LIMIT_RATE_HBR2 if DP_SUPPORTED_LINK_RATES only lists rates
above 540000 kHz?

Previously, rates above 540000 kHz were filtered out before checking
intel_dp->num_sink_rates, so an empty filtered list fell back to
intel_dp_set_sink_rates().  Now num_sink_rates is checked before the
following intel_dp_rate_limit_len() call clamps intel_dp->sink_rates:

drivers/gpu/drm/i915/display/intel_dp.c:intel_edp_set_sink_rates() {
	...
	if (num_sink_rates)
		intel_dp->use_rate_select = true;
	else
		intel_dp_set_sink_rates(intel_dp);
	...
	if (intel_dp->num_sink_rates && intel_has_quirk(display, QUIRK_EDP_LIMIT_RATE_HBR2))
		intel_dp->num_sink_rates = intel_dp_rate_limit_len(intel_dp->sink_rates,
								   intel_dp->num_sink_rates,
								   540000);
}

When all entries in DP_SUPPORTED_LINK_RATES exceed 540000 kHz, this sets
intel_dp->use_rate_select to true, skips intel_dp_set_sink_rates(), and
then reduces intel_dp->num_sink_rates to 0, triggering drm_WARN_ON() in
intel_dp_get_common_rates() and breaking eDP link training.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118-feat_move_i915_helper-v1-0-652177f3107a@bootlin.com?part=7

  reply	other threads:[~2026-11-18 10:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 10:36 [PATCH 0/8] Move DRM helpers out of i915 driver Kory Maincent
2026-11-18 10:36 ` [PATCH 1/8] drm/dp: Move max DPRX link rate helper out of i915 Kory Maincent
2026-11-18 10:36 ` [PATCH 2/8] drm/dp: Move DPRX 128b/132b link rates " Kory Maincent
2026-11-18 10:36 ` [PATCH 3/8] drm/dp: Move DPRX 128b/132b support " Kory Maincent
2026-11-18 10:36 ` [PATCH 4/8] drm/dp: Move supported 128b/132b link rates " Kory Maincent
2026-11-18 10:36 ` [PATCH 5/8] drm/dp: Move DP sink link rates reading " Kory Maincent
2026-11-18 10:36 ` [PATCH 6/8] drm/dp: Make the DPRX link rates helpers static Kory Maincent
2026-11-18 10:36 ` [PATCH 7/8] drm/dp: Move eDP sink link rates reading helper out of i915 Kory Maincent
2026-11-18 10:53   ` sashiko-bot [this message]
2026-11-18 10:36 ` [PATCH 8/8] drm: Move DSC capability " Kory Maincent
2026-11-18 10:45   ` sashiko-bot

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-220759@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kory.maincent@bootlin.com \
    --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