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