[PATCH 085/108] drm/i915/dp_link_caps: Add mask for disabled link configurations

Imre Deak
2026-04-28T12:55:30Z

Add a disabled configuration mask to the link capability state.

This allows fallback code to disable only the configuration that failed
link training, instead of constraining later modesets via maximum link
rate or lane count. The code only needs to exclude the failed
configuration from the allowed set; all other supported configurations
remain available.

Use the mask when computing the allowed configuration set and when
validating maximum link limits, so disabled configurations are filtered
consistently.

Follow-up changes will preserve the mask across merge updates, clear it
on reset updates, and switch the fallback code to disable individual
configurations through this mask.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
.../gpu/drm/i915/display/intel_dp_link_caps.c | 45 ++++++++++++++++---
1 file changed, 40 insertions(+), 5 deletions(-)

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 9c0ad5cf87259..7a4a8ec8fdf40 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
@@ -131,8 +131,41 @@ struct intel_dp_link_caps {
* described above.
*/
u8 bw_order_map[INTEL_DP_MAX_LINK_CONFIGS];
+
+ /*
+ * Mask of configurations disabled for the current sink
+ * connection.
+ *
+ * Each bit corresponds to a configuration index in the
+ * virtual configuration space. The same index space is used
+ * by bw_order_map[] and all configuration masks, including
+ * the allowed-configuration mask.
+ *
+ * Users disable configurations by setting bits in this mask.
+ * Bits are cleared only internally in the following cases:
+ * - sink disconnect
+ * - forcing a link rate or lane count
+ * - recovery from invalid cases after a sink capability
+ * change or internal inconsistencies that would otherwise
+ * leave no allowed configuration
+ * - after intel_dp_link_caps_update(UPDATE_RESET) or
+ * intel_dp_link_caps_reset() is called
+ *
+ * In all these cases, all configurations are re-enabled.
+ */
+ u32 disabled_config_mask;
} config_table;

+ /*
+ * Allowed configurations are the supported configurations defined by
+ * config_table.rates and config_table.max_lane_count, constrained by
+ * config_table.disabled_config_mask and the forced_params and
+ * max_limits values below.
+ *
+ * See intel_dp_link_caps_allowed_config_mask() for the mask of these
+ * configurations.
+ */
+
/*
* Forced parameters requested via debugfs. Remains set across sink
* disconnects.
@@ -160,15 +193,15 @@ struct intel_dp_link_caps {
* max_limits.lane_count) tuple itself may not be an allowed
* configuration.
*
- * TODO: List the events that reset max_limits, after the
- * introduction of disabled_config_mask.
- *
* TODO: Make max_limits reflect the maximum of the allowed
* configurations at all times and stop making it settable via the
* API, removing it as a constraint on the allowed configurations.
*/
struct intel_dp_link_config max_limits;
};
+/* Assert that config masks have enough bits. */
+static_assert(BITS_PER_TYPE(u32) >=
+ ARRAY_SIZE(((struct intel_dp_link_caps *)NULL)->config_table.bw_order_map));

static enum intel_dp_link_caps_config_order_key
order_key_for_connector(struct intel_connector *connector)
@@ -511,7 +544,8 @@ static u32 calc_allowed_config_mask(struct intel_dp_link_caps *link_caps,
u32 intel_dp_link_caps_get_allowed_config_mask(struct intel_dp_link_caps *link_caps)
{
struct intel_dp_link_config forced_params;
- u32 disabled_mask = 0; /* get the mask from link_caps. */
+ u32 disabled_mask =
+ link_caps->config_table.disabled_config_mask;

intel_dp_link_caps_get_forced_params(link_caps, &forced_params);

@@ -777,7 +811,8 @@ static bool max_link_limits_valid(struct intel_dp_link_caps *link_caps,
const struct intel_dp_link_config *max_link_limits)
{
struct intel_dp_link_config forced_params;
- u32 disabled_mask = 0; /* get the mask from link_caps. */
+ u32 disabled_mask =
+ link_caps->config_table.disabled_config_mask;
u32 allowed_mask;

intel_dp_link_caps_get_forced_params(link_caps, &forced_params);
--
2.49.1