intel_gt_debugfs.c 1.0 KB
Newer Older
1 2 3 4 5 6 7 8
// SPDX-License-Identifier: MIT
/*
 * Copyright © 2019 Intel Corporation
 */

#include <linux/debugfs.h>

#include "debugfs_gt_pm.h"
9 10
#include "i915_drv.h"
#include "intel_gt_debugfs.h"
11
#include "intel_gt_engines_debugfs.h"
12
#include "intel_sseu_debugfs.h"
13
#include "uc/intel_uc_debugfs.h"
14

15
void intel_gt_debugfs_register(struct intel_gt *gt)
16 17 18 19 20 21 22 23 24 25
{
	struct dentry *root;

	if (!gt->i915->drm.primary->debugfs_root)
		return;

	root = debugfs_create_dir("gt", gt->i915->drm.primary->debugfs_root);
	if (IS_ERR(root))
		return;

26
	intel_gt_engines_debugfs_register(gt, root);
27
	debugfs_gt_pm_register(gt, root);
28
	intel_sseu_debugfs_register(gt, root);
29 30

	intel_uc_debugfs_register(&gt->uc, root);
31 32
}

33
void intel_gt_debugfs_register_files(struct dentry *root,
34
				     const struct intel_gt_debugfs_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 44 45 46 47
					    files->fops);

		files++;
	}
}