dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: tarund18303@gmail.com
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/dp_link_caps: Validate max link rate
Date: Thu, 27 Aug 2026 02:33:04 +0000	[thread overview]
Message-ID: <20260827023304.D8F7D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827022035.3442-1-tarund18303@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly added validation check in `max_link_limits_valid()` breaks existing KUnit tests in `intel_dp_link_test.c` because the mock `intel_dp` environment does not initialize `source_rates`.
--

commit 449b7e18bca4c6d9716f634b5437a3f267bbd539
Author: tarun-tarun143 <tarund18303@gmail.com>

drm/i915/dp_link_caps: Validate max link rate

This commit validates the maximum link rate against the source-supported rates
before using the limits to calculate allowed configurations. This prevents
unsupported link rates from being accepted as a maximum link limit.

> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> index 7b6cc6055da82..0934488153bbc 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> @@ -710,7 +710,10 @@ static bool max_link_limits_valid(struct intel_dp_link_caps *link_caps,
>  	    !is_power_of_2(max_link_limits->lane_count))
>  		return false;
>  
> -	/* TODO: Validate max_link_limits->rate against the source supported rates. */
> +	if (intel_dp_rate_index(link_caps->dp->source_rates,
> +				link_caps->dp->num_source_rates,
> +				max_link_limits->rate) < 0)
> +		return false;

[Severity: Medium]
Does this change cause the KUnit tests in intel_dp_link_test.c to fail?

Looking at the mock environment initialization in intel_dp_link_test_init():

drivers/gpu/drm/i915/display/tests/intel_dp_link_test.c:intel_dp_link_test_init() {
	/* Reset the dev state for each test. */
	memset(&test_ctx.dev, 0, sizeof(test_ctx.dev));
	...
	intel_dp->link.caps = test_ctx.link_caps_ops->init(intel_dp);
}

The mock initialization zeroes the memory but does not populate source_rates 
or num_source_rates, leaving them at 0 or NULL. As a result, 
intel_dp_rate_index() will evaluate to -1 during the tests.

This causes unconditional test failures when setting max limits, for example
in verify_link_caps_for_order():

drivers/gpu/drm/i915/display/tests/intel_dp_link_test.c:verify_link_caps_for_order() {
	...
	KUNIT_ASSERT_TRUE(test, ops->set_max_limits(link_caps, &old_max_limits));
}

Could the mock environment be updated to provide valid source_rates so the
tests can successfully pass this new validation check?

>  
>  	intel_dp_link_caps_get_forced_params(link_caps, &forced_params);
>  	allowed_configs = calc_allowed_config_filter(link_caps, link_caps->enabled_configs,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827022035.3442-1-tarund18303@gmail.com?part=1

      reply	other threads:[~2026-08-27  2:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  2:20 [PATCH] drm/i915/dp_link_caps: Validate max link rate tarund18303
2026-08-27  2:33 ` 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=20260827023304.D8F7D1F000E9@smtp.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=sashiko-reviews@lists.linux.dev \
    --cc=tarund18303@gmail.com \
    /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