1 // SPDX-License-Identifier: MIT
2 /*
3 * Copyright © 2019 Intel Corporation
4 */
5
6 #include <linux/debugfs.h>
7
8 #include "debugfs_engines.h"
9 #include "debugfs_gt.h"
10 #include "debugfs_gt_pm.h"
11 #include "intel_sseu_debugfs.h"
12 #include "uc/intel_uc_debugfs.h"
13 #include "i915_drv.h"
14
debugfs_gt_register(struct intel_gt * gt)15 void debugfs_gt_register(struct intel_gt *gt)
16 {
17 struct dentry *root;
18
19 if (!gt->i915->drm.primary->debugfs_root)
20 return;
21
22 root = debugfs_create_dir("gt", gt->i915->drm.primary->debugfs_root);
23 if (IS_ERR(root))
24 return;
25
26 debugfs_engines_register(gt, root);
27 debugfs_gt_pm_register(gt, root);
28 intel_sseu_debugfs_register(gt, root);
29
30 intel_uc_debugfs_register(>->uc, root);
31 }
32
intel_gt_debugfs_register_files(struct dentry * root,const struct debugfs_gt_file * files,unsigned long count,void * data)33 void intel_gt_debugfs_register_files(struct dentry *root,
34 const struct debugfs_gt_file *files,
35 unsigned long count, void *data)
36 {
37 while (count--) {
38 umode_t mode = files->fops->write ? 0644 : 0444;
39
40 if (!files->eval || files->eval(data))
41 debugfs_create_file(files->name,
42 mode, root, data,
43 files->fops);
44
45 files++;
46 }
47 }
48