From e54d5109d097ec78fddea88bff69cb8a3a320fbe Mon Sep 17 00:00:00 2001 From: Cole Leavitt Date: Sun, 22 Feb 2026 17:38:07 -0700 Subject: [PATCH 1/3] displayport: remove redundant interlane alignment check in isLinkLost() The interlane alignment status was checked twice in isLinkLost() -- once before the per-lane status checks and once after. Both reads come from the same SW cache (refreshed by hal->refreshLinkStatus() before the first check), so the second check at the end of the function always returns the same result as the first. Remove the duplicate to reduce unnecessary code and eliminate any timing window for spurious false-positives on systems where the HAL cache could be externally invalidated between the two reads. Signed-off-by: Cole Leavitt --- src/common/displayport/src/dp_connectorimpl.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/common/displayport/src/dp_connectorimpl.cpp b/src/common/displayport/src/dp_connectorimpl.cpp index f3267bc57b..2b926dd7b3 100644 --- a/src/common/displayport/src/dp_connectorimpl.cpp +++ b/src/common/displayport/src/dp_connectorimpl.cpp @@ -5030,12 +5030,6 @@ bool ConnectorImpl::isLinkLost() if (!hal->getLaneStatusChannelEqualizationDone(i)) return true; } - - if (!(hal->isDpInTunnelingSupported() && main->isDpTunnelingHwBugWarEnabled())) - { - if (!hal->getInterlaneAlignDone()) - return true; - } } return false; } From 707526faac21c21bd8fd0c858c9995ac03f10b4e Mon Sep 17 00:00:00 2001 From: Cole Leavitt Date: Sun, 22 Feb 2026 17:42:32 -0700 Subject: [PATCH 2/3] displayport: clamp tunnel bandwidth request to prevent NvU8 truncation In allocateDpTunnelBw(), the result of divide_ceil(bandwidth * granularityMultiplier, 1e9) was directly cast to NvU8 without bounds checking. For high-bandwidth links (e.g. >64 Gbps with 0.25 Gbps granularity), the computed DPCD value can exceed 255, causing silent truncation and an incorrect bandwidth request. Compute the result in NvU64 first and clamp to NV_U8_MAX before the cast. --- src/common/displayport/src/dp_connectorimpl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/displayport/src/dp_connectorimpl.cpp b/src/common/displayport/src/dp_connectorimpl.cpp index 2b926dd7b3..714470c9e1 100644 --- a/src/common/displayport/src/dp_connectorimpl.cpp +++ b/src/common/displayport/src/dp_connectorimpl.cpp @@ -4416,7 +4416,11 @@ bool ConnectorImpl::allocateDpTunnelBw(NvU64 bandwidth) // = DPCD Value / granularityMultiplier // DPCD Value = bandwidth * granularityMultiplier // - requestBw = (NvU8) divide_ceil(bandwidth * granularityMultiplier, 1000 * 1000 * 1000); + { + NvU64 rawBw = divide_ceil(bandwidth * (NvU64)granularityMultiplier, + (NvU64)1000 * 1000 * 1000); + requestBw = (rawBw > NV_U8_MAX) ? (NvU8)NV_U8_MAX : (NvU8)rawBw; + } if (requestBw > estimatedBw) { From 27567d7e379acc583e687196ac3351422986604b Mon Sep 17 00:00:00 2001 From: Cole Leavitt Date: Sun, 22 Feb 2026 17:45:38 -0700 Subject: [PATCH 3/3] displayport: detect RM link training fallback in MST optimized path In trainLinkOptimized(), the MST path trains to highestAssessedLC and retries up to DP_LT_MAX_FOR_MST_MAX_RETRIES times if the active config does not match. However, when main->train() internally falls back to a lower lane count or link rate (detected by train() comparing lConfig vs activeLinkConfig), the retries may never restore the desired config. After retries exhaust, the code proceeds with bLinkTrainingSuccessful still set to true from initialization, even though activeLinkConfig is lower than what was used to compute DSC PPS parameters during compoundQuery. This can cause the caller to commit a mode with stale DSC configuration computed for a higher bandwidth link. Add a check after the retry loop: if activeLinkConfig is valid but does not match highestAssessedLC, mark link training as failed. This ensures the caller sees the mismatch and can handle it appropriately (e.g. zombie mode) rather than silently programming incorrect DSC parameters. --- src/common/displayport/src/dp_connectorimpl.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/common/displayport/src/dp_connectorimpl.cpp b/src/common/displayport/src/dp_connectorimpl.cpp index 714470c9e1..430f59af4d 100644 --- a/src/common/displayport/src/dp_connectorimpl.cpp +++ b/src/common/displayport/src/dp_connectorimpl.cpp @@ -5543,6 +5543,23 @@ bool ConnectorImpl::trainLinkOptimized(LinkConfiguration lConfig) }; } + + // + // If RM fell back to a lower link config during training + // (main->train() can internally reduce lanes/rate), the DSC + // PPS parameters computed during compoundQuery for + // highestAssessedLC are now stale. Mark as failed so the + // caller does not proceed with mismatched DSC configuration. + // + if (highestAssessedLC.isValid() && + highestAssessedLC != activeLinkConfig && + activeLinkConfig.isValid()) + { + DP_PRINTF(DP_WARNING, + "DPCONN> MST link trained at lower config than assessed;" + " DSC parameters may be stale."); + bLinkTrainingSuccessful = false; + } lConfig = activeLinkConfig; if (bEnteredFlushMode)