From: Kunal Joshi <kunal1.joshi@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: imre.deak@intel.com, jani.nikula@intel.com,
Kunal Joshi <kunal1.joshi@intel.com>
Subject: [RFC 6/7] drm/display/dp_tunnel: Sync SW allocated_bw after enabling BW alloc
Date: Mon, 11 May 2026 11:10:27 +0530 [thread overview]
Message-ID: <20260511054028.1310995-7-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20260511054028.1310995-1-kunal1.joshi@intel.com>
After drm_dp_tunnel_enable_bw_alloc() the read-back DP_ALLOCATED_BW
is not synced back to tunnel->allocated_bw, leaving a stale SW
value. The next drm_dp_tunnel_update_state() call sees a SW vs. HW
mismatch, trips tunnel_info_changes_are_valid(), and returns
-EINVAL causing the driver to tear down and re-detect the tunnel
even though BWA enabled correctly.
Sync tunnel->allocated_bw from the just-read register value after
the post-enable verification, mirroring the initial sync done in
create_tunnel().
Cc: Imre Deak <imre.deak@intel.com>
Assisted-by: Copilot:claude-sonnet-4-6
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
drivers/gpu/drm/display/drm_dp_tunnel.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/display/drm_dp_tunnel.c b/drivers/gpu/drm/display/drm_dp_tunnel.c
index c16b36d3bcf8a..e0474e09f4388 100644
--- a/drivers/gpu/drm/display/drm_dp_tunnel.c
+++ b/drivers/gpu/drm/display/drm_dp_tunnel.c
@@ -1048,6 +1048,22 @@ int drm_dp_tunnel_enable_bw_alloc(struct drm_dp_tunnel *tunnel)
goto out;
}
+ /*
+ * Sync the SW allocated_bw to whatever the HW reports right after
+ * enabling BWA mode. The TBT CM may settle to a different
+ * allocation than the SW state held before BWA was disabled (e.g.
+ * after a disable/enable toggle while streams are active, or after
+ * suspend/resume). Without this sync, the next
+ * drm_dp_tunnel_update_state() call - which does NOT pass
+ * ALLOW_ALLOCATED_BW_CHANGE - would observe the SW/HW mismatch in
+ * tunnel_info_changes_are_valid() and return -EINVAL, triggering
+ * an unnecessary tunnel teardown/re-detect.
+ */
+ tunnel->allocated_bw = tunnel_reg(®s, DP_ALLOCATED_BW) *
+ tunnel->bw_granularity;
+ if (!tunnel->allocated_bw)
+ tunnel->allocated_bw = -1;
+
if (!tunnel->max_dprx_rate)
update_dprx_caps(tunnel, ®s);
--
2.25.1
next prev parent reply other threads:[~2026-05-11 5:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 5:40 [RFC 0/7] drm/display/dp_tunnel: Add debugfs surface for BWA validation Kunal Joshi
2026-05-11 5:40 ` [RFC 1/7] drm/display/dp_tunnel: Add debugfs interface with info file Kunal Joshi
2026-05-11 5:40 ` [RFC 2/7] drm/display/dp_tunnel: Add bw_alloc_enable debugfs knob Kunal Joshi
2026-05-11 5:40 ` [RFC 3/7] drm/display/dp_tunnel: Add bw_limit debugfs cap for BW pressure injection Kunal Joshi
2026-05-11 5:40 ` [RFC 4/7] drm/i915/dp_tunnel: Wire up DP tunnel debugfs from DRM core Kunal Joshi
2026-05-11 5:40 ` [RFC 5/7] drm/i915/display: Expose DP tunnel debugfs under each connector Kunal Joshi
2026-05-11 5:40 ` Kunal Joshi [this message]
2026-05-11 5:40 ` [RFC 7/7] drm/i915/dp_tunnel: Re-attach dp_tunnel debugfs to MST children on re-detect Kunal Joshi
2026-05-11 14:54 ` ✓ i915.CI.BAT: success for drm/display/dp_tunnel: Add debugfs surface for BWA validation Patchwork
2026-05-11 20:10 ` ✗ i915.CI.Full: failure " Patchwork
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=20260511054028.1310995-7-kunal1.joshi@intel.com \
--to=kunal1.joshi@intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.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