1 // SPDX-License-Identifier: MIT
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5 
6 #include <drm/drm_print.h>
7 
8 #include "gt/intel_gt_debugfs.h"
9 #include "gt/uc/intel_guc_ads.h"
10 #include "gt/uc/intel_guc_ct.h"
11 #include "gt/uc/intel_guc_slpc.h"
12 #include "gt/uc/intel_guc_submission.h"
13 #include "intel_guc.h"
14 #include "intel_guc_debugfs.h"
15 #include "intel_guc_log_debugfs.h"
16 
17 #ifdef notyet
18 
19 static int guc_info_show(struct seq_file *m, void *data)
20 {
21 	struct intel_guc *guc = m->private;
22 	struct drm_printer p = drm_seq_file_printer(m);
23 
24 	if (!intel_guc_is_supported(guc))
25 		return -ENODEV;
26 
27 	intel_guc_load_status(guc, &p);
28 	drm_puts(&p, "\n");
29 	intel_guc_log_info(&guc->log, &p);
30 
31 	if (!intel_guc_submission_is_used(guc))
32 		return 0;
33 
34 	intel_guc_ct_print_info(&guc->ct, &p);
35 	intel_guc_submission_print_info(guc, &p);
36 	intel_guc_ads_print_policy_info(guc, &p);
37 
38 	return 0;
39 }
40 DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(guc_info);
41 
42 static int guc_registered_contexts_show(struct seq_file *m, void *data)
43 {
44 	struct intel_guc *guc = m->private;
45 	struct drm_printer p = drm_seq_file_printer(m);
46 
47 	if (!intel_guc_submission_is_used(guc))
48 		return -ENODEV;
49 
50 	intel_guc_submission_print_context_info(guc, &p);
51 
52 	return 0;
53 }
54 DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(guc_registered_contexts);
55 
56 static int guc_slpc_info_show(struct seq_file *m, void *unused)
57 {
58 	struct intel_guc *guc = m->private;
59 	struct intel_guc_slpc *slpc = &guc->slpc;
60 	struct drm_printer p = drm_seq_file_printer(m);
61 
62 	if (!intel_guc_slpc_is_used(guc))
63 		return -ENODEV;
64 
65 	return intel_guc_slpc_print_info(slpc, &p);
66 }
67 DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(guc_slpc_info);
68 
69 static bool intel_eval_slpc_support(void *data)
70 {
71 	struct intel_guc *guc = (struct intel_guc *)data;
72 
73 	return intel_guc_slpc_is_used(guc);
74 }
75 
76 #endif
77 
78 void intel_guc_debugfs_register(struct intel_guc *guc, struct dentry *root)
79 {
80 	STUB();
81 #ifdef notyet
82 	static const struct intel_gt_debugfs_file files[] = {
83 		{ "guc_info", &guc_info_fops, NULL },
84 		{ "guc_registered_contexts", &guc_registered_contexts_fops, NULL },
85 		{ "guc_slpc_info", &guc_slpc_info_fops, &intel_eval_slpc_support},
86 	};
87 
88 	if (!intel_guc_is_supported(guc))
89 		return;
90 
91 	intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), guc);
92 	intel_guc_log_debugfs_register(&guc->log, root);
93 #endif
94 }
95