drm/i915/dp_link_caps: Validate max link rate
Subsystems (3)
PATCH 1/1 drm/i915/dp_link_caps: Validate max link rate
From: tarun-tarun143 <[email protected]>
Validate the maximum link rate against the source-supported rates before using the maximum link limits to calculate allowed configurations.
This prevents an unsupported link rate from being accepted as a maximum link limit.
--- drivers/gpu/drm/i915/display/intel_dp_link_caps.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dp_link_caps.c +4 -1
@@ -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;intel_dp_link_caps_get_forced_params (link_caps, &forced_params); allowed_configs = calc_allowed_config_filter(link_caps, link_caps->enabled_configs,
base-commit: 73e3f0710014fe6d4ed98cfc02292f6121db7558
Signature · 1 line
2.43.0
[email protected]
AI reviewThank 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…
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 <[email protected]>
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.
drivers/gpu/drm/i915/display/intel_dp_link_caps.c static bool max_link_limits_valid(struct intel_dp_link_caps *link_caps, · line 716
Quoted 13 lines
drivers/gpu/drm/i915/display/intel_dp_link_caps.c +4
-1@@ -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?
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_dp_link_caps.c +0
-0intel_dp_link_caps_get_forced_params (link_caps, &forced_params); allowed_configs = calc_allowed_config_filter(link_caps, link_caps->enabled_configs,
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Patchwork
CI✗ LGCI.VerificationFailed: failure for drm/i915/dp_link_caps: Validate max link rate
In reply to [email protected]== Series Details ==
== Series Details ==
Series: drm/i915/dp_link_caps: Validate max link rate
URL : https://patchwork.freedesktop.org/series/172865/
State : failure
== Summary ==
Series author address '[email protected]' is not on the allowlist, which prevents CI from being automatically triggered. If you want CI to run for this series, ask Patchwork project owners to click 'retest' on the series in Patchwork. Exception occurred during validation, bailing out!
Build URL: http://intel-gfx-ci-public.igk.intel.com:8080/job/xe_pw_trigger/1262912/ (on master)
Patchwork
CI✗ LGCI.VerificationFailed: failure for drm/i915/dp_link_caps: Validate max link rate
In reply to [email protected]== Series Details ==
== Series Details ==
Series: drm/i915/dp_link_caps: Validate max link rate
URL : https://patchwork.freedesktop.org/series/172866/
State : failure
== Summary ==
Series author address '[email protected]' is not on the allowlist, which prevents CI from being automatically triggered. If you want CI to run for this series, ask Patchwork project owners to click 'retest' on the series in Patchwork. Exception occurred during validation, bailing out!
Build URL: http://gfx-ci.igk.intel.com:8080/job/CI_PW_kernel/185676/ (on built-in)
Jani Nikula
maintainerQuoted 8 lines · On Thu, 27 Aug 2026, [email protected] wrote:
From: tarun-tarun143 <[email protected]>
Validate the maximum link rate against the source-supported rates before using the maximum link limits to calculate allowed configurations.
This prevents an unsupported link rate from being accepted as a maximum link limit.
Are you seeing this issue being hit, or are you just going through TODO comments and trying to come up with fixes?
BR,
Jani.
Quoted 24 lines
Signed-off-by tarun-tarun143 <[email protected]>--- drivers/gpu/drm/i915/display/intel_dp_link_caps.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/display/intel_dp_link_caps.c +4
-1@@ -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;intel_dp_link_caps_get_forced_params (link_caps, &forced_params); allowed_configs = calc_allowed_config_filter(link_caps, link_caps->enabled_configs,base-commit:
73e3f0710014fe6d4ed98cfc02292f6121db7558
Signature · 1 line
Jani Nikula, Intel