drm/i915/debugfs: Enable upper layer interfaces to act on all gt's
authorAndi Shyti <andi.shyti@linux.intel.com>
Sat, 18 Mar 2023 20:36:16 +0000 (21:36 +0100)
committerAndi Shyti <andi.shyti@linux.intel.com>
Tue, 21 Mar 2023 09:10:49 +0000 (10:10 +0100)
The commit 82a149a62b6b ("drm/i915/gt: move remaining debugfs
interfaces into gt") moved gt-related debugfs files in the gtX/
directories to operate on individual gt's.

However, the original files were only functioning on the root
GT (GT 0) and have been left in the same location to maintain
compatibility with userspace users.

Add multiplexing functionality to the higher directories' files.
This enables the operations to be performed on all the GTs with
a single write. In the case of reads, the files provide an or'ed
value across all the tiles.

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Maciej Patelczyk <maciej.patelczyk@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230318203616.183765-4-andi.shyti@linux.intel.com
drivers/gpu/drm/i915/i915_debugfs.c

index a356ca490159e3e8250330c48ecf73464c6559bf..fa9c0a387c4253c2191cf80180de73aeb20201bb 100644 (file)
@@ -575,14 +575,34 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
 static int i915_wedged_get(void *data, u64 *val)
 {
        struct drm_i915_private *i915 = data;
+       struct intel_gt *gt;
+       unsigned int i;
 
-       return intel_gt_debugfs_reset_show(to_gt(i915), val);
+       *val = 0;
+
+       for_each_gt(gt, i915, i) {
+               int ret;
+
+               ret = intel_gt_debugfs_reset_show(gt, val);
+               if (ret)
+                       return ret;
+
+               /* at least one tile should be wedged */
+               if (*val)
+                       break;
+       }
+
+       return 0;
 }
 
 static int i915_wedged_set(void *data, u64 val)
 {
        struct drm_i915_private *i915 = data;
-       intel_gt_debugfs_reset_store(to_gt(i915), val);
+       struct intel_gt *gt;
+       unsigned int i;
+
+       for_each_gt(gt, i915, i)
+               intel_gt_debugfs_reset_store(gt, val);
 
        return 0;
 }
@@ -732,7 +752,11 @@ static int i915_sseu_status(struct seq_file *m, void *unused)
 static int i915_forcewake_open(struct inode *inode, struct file *file)
 {
        struct drm_i915_private *i915 = inode->i_private;
-       intel_gt_pm_debugfs_forcewake_user_open(to_gt(i915));
+       struct intel_gt *gt;
+       unsigned int i;
+
+       for_each_gt(gt, i915, i)
+               intel_gt_pm_debugfs_forcewake_user_open(gt);
 
        return 0;
 }
@@ -740,7 +764,11 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
 static int i915_forcewake_release(struct inode *inode, struct file *file)
 {
        struct drm_i915_private *i915 = inode->i_private;
-       intel_gt_pm_debugfs_forcewake_user_release(to_gt(i915));
+       struct intel_gt *gt;
+       unsigned int i;
+
+       for_each_gt(gt, i915, i)
+               intel_gt_pm_debugfs_forcewake_user_release(gt);
 
        return 0;
 }