Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 5/7] drm/i915/display: Expose DP tunnel debugfs under each connector
Date: Mon, 11 May 2026 11:10:26 +0530	[thread overview]
Message-ID: <20260511054028.1310995-6-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20260511054028.1310995-1-kunal1.joshi@intel.com>

The dp_tunnel/ subdir is only registered for the primary connector.
MST child connectors that share the same backing tunnel need their
own dp_tunnel/ entry so IGT can read per-connector tunnel state.

Register dp_tunnel/ from intel_connector_debugfs_add() for every
DP/eDP connector that owns a tunnel, resolving intel_dp via
connector->mst.dp for MST children. Add
drm_dp_tunnel_debugfs_remove() from both SST/eDP and MST
->early_unregister hooks to prevent stale dentry pointers when
connectors are torn down before the tunnel.

Cc: Imre Deak <imre.deak@intel.com>
Assisted-by: Copilot:claude-sonnet-4-6
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 .../drm/i915/display/intel_display_debugfs.c  | 22 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp.c       | 11 ++++++++++
 drivers/gpu/drm/i915/display/intel_dp_mst.c   | 11 ++++++++++
 3 files changed, 44 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index 81bef000a4e3e..b77e320348a83 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -13,6 +13,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_print.h>
+#include <drm/display/drm_dp_tunnel.h>
 #include <drm/intel/intel_gmd_misc_regs.h>
 
 #include "hsw_ips.h"
@@ -1338,6 +1339,27 @@ void intel_connector_debugfs_add(struct intel_connector *connector)
 	intel_dp_link_training_debugfs_add(connector);
 	intel_link_bw_connector_debugfs_add(connector);
 
+	if (connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
+	    connector_type == DRM_MODE_CONNECTOR_eDP) {
+		struct intel_dp *intel_dp;
+
+		/*
+		 * For MST child connectors the relevant intel_dp is
+		 * pointed to by connector->mst.dp; intel_attached_dp()
+		 * follows the SST/eDP encoder path. Pick the right one
+		 * so MST children also get a dp_tunnel/ subdir under
+		 * their own connector debugfs root.
+		 */
+		if (connector_type == DRM_MODE_CONNECTOR_DisplayPort &&
+		    connector->mst.dp)
+			intel_dp = connector->mst.dp;
+		else
+			intel_dp = intel_attached_dp(connector);
+
+		if (intel_dp && intel_dp->tunnel)
+			drm_dp_tunnel_debugfs_add(intel_dp->tunnel, root);
+	}
+
 	if (DISPLAY_VER(display) >= 11 &&
 	    ((connector_type == DRM_MODE_CONNECTOR_DisplayPort && !connector->mst.dp) ||
 	     connector_type == DRM_MODE_CONNECTOR_eDP)) {
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 86123614b7bae..540cd03a7a40d 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -6644,6 +6644,17 @@ intel_dp_connector_unregister(struct drm_connector *_connector)
 	struct intel_connector *connector = to_intel_connector(_connector);
 	struct intel_dp *intel_dp = intel_attached_dp(connector);
 
+	/*
+	 * Drop any DP tunnel debugfs entries registered under this
+	 * connector before drm_connector core tears down the connector
+	 * debugfs root. The SST tunnel object itself outlives the
+	 * connector (destroyed in intel_dp_encoder_flush_work()), so
+	 * stale dentries would otherwise be left on tunnel->debugfs_dirs.
+	 */
+	if (intel_dp->tunnel)
+		drm_dp_tunnel_debugfs_remove(intel_dp->tunnel,
+					     connector->base.debugfs_entry);
+
 	drm_dp_cec_unregister_connector(&intel_dp->aux);
 	drm_dp_aux_unregister(&intel_dp->aux);
 	intel_connector_unregister(&connector->base);
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 8f73e01db17c9..7ed6722fb7f79 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -32,6 +32,7 @@
 #include <drm/drm_fixed.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/display/drm_dp_tunnel.h>
 #include <drm/intel/step.h>
 
 #include "intel_atomic.h"
@@ -1435,6 +1436,16 @@ static void
 mst_connector_early_unregister(struct drm_connector *_connector)
 {
 	struct intel_connector *connector = to_intel_connector(_connector);
+	struct intel_dp *intel_dp = connector->mst.dp;
+
+	/*
+	 * Drop the per-connector dp_tunnel/ debugfs entry before the
+	 * connector's debugfs root is recursively removed, so the
+	 * tunnel does not retain a stale dentry pointer.
+	 */
+	if (intel_dp && intel_dp->tunnel)
+		drm_dp_tunnel_debugfs_remove(intel_dp->tunnel,
+					     connector->base.debugfs_entry);
 
 	intel_connector_unregister(&connector->base);
 	drm_dp_mst_connector_early_unregister(&connector->base, connector->mst.port);
-- 
2.25.1


  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 ` Kunal Joshi [this message]
2026-05-11  5:40 ` [RFC 6/7] drm/display/dp_tunnel: Sync SW allocated_bw after enabling BW alloc Kunal Joshi
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-6-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