drm/i915/gt: Create per-gt debugfs files
authorAndi Shyti <andi.shyti@linux.intel.com>
Sat, 18 Mar 2023 20:36:14 +0000 (21:36 +0100)
committerAndi Shyti <andi.shyti@linux.intel.com>
Tue, 21 Mar 2023 09:09:31 +0000 (10:09 +0100)
To support multi-GT configurations, we need to generate
independent debug files for each GT.

To achieve this create a separate directory for each GT under the
debugfs directory. For instance, in a system with two GTs, the
debugfs structure would look like this:

/sys/kernel/debug/dri
                  └── 0
                      ├── gt0
                      │   ├── drpc
                      │   ├── engines
                      │   ├── forcewake
                      │   ├── frequency
                      │   └── rps_boost
                      └── gt1
                      :   ├── drpc
                      :   ├── engines
                      :   ├── forcewake
                          ├── frequency
                          └── rps_boost

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230318203616.183765-2-andi.shyti@linux.intel.com
drivers/gpu/drm/i915/gt/intel_gt_debugfs.c
drivers/gpu/drm/i915/gt/uc/intel_guc.h
drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
drivers/gpu/drm/i915/gt/uc/intel_uc_debugfs.c

index 5fc2df01aa0df2c34f0c036d6f13aab2840adda0..4dc23b8d3aa2daf17d396c67b6f548c220ff474d 100644 (file)
@@ -83,11 +83,13 @@ static void gt_debugfs_register(struct intel_gt *gt, struct dentry *root)
 void intel_gt_debugfs_register(struct intel_gt *gt)
 {
        struct dentry *root;
+       char gtname[4];
 
        if (!gt->i915->drm.primary->debugfs_root)
                return;
 
-       root = debugfs_create_dir("gt", gt->i915->drm.primary->debugfs_root);
+       snprintf(gtname, sizeof(gtname), "gt%u", gt->info.id);
+       root = debugfs_create_dir(gtname, gt->i915->drm.primary->debugfs_root);
        if (IS_ERR(root))
                return;
 
index bb4dfe707a7d09a89825368e9ef5b322512a0aff..e46aac1a41e6d3de51c0ff6ac8708beec31ca705 100644 (file)
@@ -42,6 +42,8 @@ struct intel_guc {
        /** @capture: the error-state-capture module's data and objects */
        struct intel_guc_state_capture *capture;
 
+       struct dentry *dbgfs_node;
+
        /** @sched_engine: Global engine used to submit requests to GuC */
        struct i915_sched_engine *sched_engine;
        /**
index 195db8c9d420067b4aacb43aeaf163d5f6dabc09..55bc8b55fbc05accab43ef3a505abcf42c481df0 100644 (file)
@@ -542,8 +542,11 @@ static int guc_log_relay_create(struct intel_guc_log *log)
         */
        n_subbufs = 8;
 
+       if (!guc->dbgfs_node)
+               return -ENOENT;
+
        guc_log_relay_chan = relay_open("guc_log",
-                                       i915->drm.primary->debugfs_root,
+                                       guc->dbgfs_node,
                                        subbuf_size, n_subbufs,
                                        &relay_callbacks, i915);
        if (!guc_log_relay_chan) {
index 284d6fbc2d08c76f97bbe13fb6ad25acd738b824..2f93cc4e408a87a1807324cf435c779a5ffc0ca9 100644 (file)
@@ -54,6 +54,8 @@ void intel_uc_debugfs_register(struct intel_uc *uc, struct dentry *gt_root)
        if (IS_ERR(root))
                return;
 
+       uc->guc.dbgfs_node = root;
+
        intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), uc);
 
        intel_guc_debugfs_register(&uc->guc, root);