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 <[email protected]> Assisted-by: Copilot:claude-sonnet-4-6 Signed-off-by: Kunal Joshi <[email protected]> --- .../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
