Linux Audio

Check our new training course

Loading...
v6.13.7
 1// SPDX-License-Identifier: MIT
 2/*
 3 * Copyright © 2022 Intel Corporation
 4 */
 5
 6#include "xe_guc_debugfs.h"
 7
 8#include <drm/drm_debugfs.h>
 9#include <drm/drm_managed.h>
10
11#include "xe_device.h"
12#include "xe_gt.h"
13#include "xe_guc.h"
14#include "xe_guc_ct.h"
15#include "xe_guc_log.h"
16#include "xe_macros.h"
17#include "xe_pm.h"
18
19static struct xe_guc *node_to_guc(struct drm_info_node *node)
20{
21	return node->info_ent->data;
22}
23
24static int guc_info(struct seq_file *m, void *data)
25{
26	struct xe_guc *guc = node_to_guc(m->private);
27	struct xe_device *xe = guc_to_xe(guc);
28	struct drm_printer p = drm_seq_file_printer(m);
29
30	xe_pm_runtime_get(xe);
31	xe_guc_print_info(guc, &p);
32	xe_pm_runtime_put(xe);
33
34	return 0;
35}
36
37static int guc_log(struct seq_file *m, void *data)
38{
39	struct xe_guc *guc = node_to_guc(m->private);
40	struct xe_device *xe = guc_to_xe(guc);
41	struct drm_printer p = drm_seq_file_printer(m);
42
43	xe_pm_runtime_get(xe);
44	xe_guc_log_print(&guc->log, &p);
45	xe_pm_runtime_put(xe);
46
47	return 0;
48}
49
50static int guc_ctb(struct seq_file *m, void *data)
51{
52	struct xe_guc *guc = node_to_guc(m->private);
53	struct xe_device *xe = guc_to_xe(guc);
54	struct drm_printer p = drm_seq_file_printer(m);
55
56	xe_pm_runtime_get(xe);
57	xe_guc_ct_print(&guc->ct, &p, true);
58	xe_pm_runtime_put(xe);
59
60	return 0;
61}
62
63static const struct drm_info_list debugfs_list[] = {
64	{"guc_info", guc_info, 0},
65	{"guc_log", guc_log, 0},
66	{"guc_ctb", guc_ctb, 0},
67};
68
69void xe_guc_debugfs_register(struct xe_guc *guc, struct dentry *parent)
70{
71	struct drm_minor *minor = guc_to_xe(guc)->drm.primary;
72	struct drm_info_list *local;
73	int i;
74
75#define DEBUGFS_SIZE	(ARRAY_SIZE(debugfs_list) * sizeof(struct drm_info_list))
76	local = drmm_kmalloc(&guc_to_xe(guc)->drm, DEBUGFS_SIZE, GFP_KERNEL);
77	if (!local)
78		return;
79
80	memcpy(local, debugfs_list, DEBUGFS_SIZE);
81#undef DEBUGFS_SIZE
82
83	for (i = 0; i < ARRAY_SIZE(debugfs_list); ++i)
84		local[i].data = guc;
85
86	drm_debugfs_create_files(local,
87				 ARRAY_SIZE(debugfs_list),
88				 parent, minor);
89}
v6.9.4
 1// SPDX-License-Identifier: MIT
 2/*
 3 * Copyright © 2022 Intel Corporation
 4 */
 5
 6#include "xe_guc_debugfs.h"
 7
 8#include <drm/drm_debugfs.h>
 9#include <drm/drm_managed.h>
10
11#include "xe_device.h"
12#include "xe_gt.h"
13#include "xe_guc.h"
14#include "xe_guc_ct.h"
15#include "xe_guc_log.h"
16#include "xe_macros.h"
 
17
18static struct xe_guc *node_to_guc(struct drm_info_node *node)
19{
20	return node->info_ent->data;
21}
22
23static int guc_info(struct seq_file *m, void *data)
24{
25	struct xe_guc *guc = node_to_guc(m->private);
26	struct xe_device *xe = guc_to_xe(guc);
27	struct drm_printer p = drm_seq_file_printer(m);
28
29	xe_device_mem_access_get(xe);
30	xe_guc_print_info(guc, &p);
31	xe_device_mem_access_put(xe);
32
33	return 0;
34}
35
36static int guc_log(struct seq_file *m, void *data)
37{
38	struct xe_guc *guc = node_to_guc(m->private);
39	struct xe_device *xe = guc_to_xe(guc);
40	struct drm_printer p = drm_seq_file_printer(m);
41
42	xe_device_mem_access_get(xe);
43	xe_guc_log_print(&guc->log, &p);
44	xe_device_mem_access_put(xe);
 
 
 
 
 
 
 
 
 
 
 
 
 
45
46	return 0;
47}
48
49static const struct drm_info_list debugfs_list[] = {
50	{"guc_info", guc_info, 0},
51	{"guc_log", guc_log, 0},
 
52};
53
54void xe_guc_debugfs_register(struct xe_guc *guc, struct dentry *parent)
55{
56	struct drm_minor *minor = guc_to_xe(guc)->drm.primary;
57	struct drm_info_list *local;
58	int i;
59
60#define DEBUGFS_SIZE	(ARRAY_SIZE(debugfs_list) * sizeof(struct drm_info_list))
61	local = drmm_kmalloc(&guc_to_xe(guc)->drm, DEBUGFS_SIZE, GFP_KERNEL);
62	if (!local)
63		return;
64
65	memcpy(local, debugfs_list, DEBUGFS_SIZE);
66#undef DEBUGFS_SIZE
67
68	for (i = 0; i < ARRAY_SIZE(debugfs_list); ++i)
69		local[i].data = guc;
70
71	drm_debugfs_create_files(local,
72				 ARRAY_SIZE(debugfs_list),
73				 parent, minor);
74}