Linux Audio

Check our new training course

Linux BSP upgrade and security maintenance

Need help to get security updates for your Linux BSP?
Loading...
v6.13.7
 1// SPDX-License-Identifier: MIT
 2/*
 3 * Copyright © 2022 Intel Corporation
 4 */
 5
 6#include "xe_huc_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_huc.h"
14#include "xe_macros.h"
15#include "xe_pm.h"
16
17static struct xe_gt *
18huc_to_gt(struct xe_huc *huc)
19{
20	return container_of(huc, struct xe_gt, uc.huc);
21}
22
23static struct xe_device *
24huc_to_xe(struct xe_huc *huc)
25{
26	return gt_to_xe(huc_to_gt(huc));
27}
28
29static struct xe_huc *node_to_huc(struct drm_info_node *node)
30{
31	return node->info_ent->data;
32}
33
34static int huc_info(struct seq_file *m, void *data)
35{
36	struct xe_huc *huc = node_to_huc(m->private);
37	struct xe_device *xe = huc_to_xe(huc);
38	struct drm_printer p = drm_seq_file_printer(m);
39
40	xe_pm_runtime_get(xe);
41	xe_huc_print_info(huc, &p);
42	xe_pm_runtime_put(xe);
43
44	return 0;
45}
46
47static const struct drm_info_list debugfs_list[] = {
48	{"huc_info", huc_info, 0},
49};
50
51void xe_huc_debugfs_register(struct xe_huc *huc, struct dentry *parent)
52{
53	struct drm_minor *minor = huc_to_xe(huc)->drm.primary;
54	struct drm_info_list *local;
55	int i;
56
57#define DEBUGFS_SIZE	(ARRAY_SIZE(debugfs_list) * sizeof(struct drm_info_list))
58	local = drmm_kmalloc(&huc_to_xe(huc)->drm, DEBUGFS_SIZE, GFP_KERNEL);
59	if (!local)
60		return;
61
62	memcpy(local, debugfs_list, DEBUGFS_SIZE);
63#undef DEBUGFS_SIZE
64
65	for (i = 0; i < ARRAY_SIZE(debugfs_list); ++i)
66		local[i].data = huc;
67
68	drm_debugfs_create_files(local,
69				 ARRAY_SIZE(debugfs_list),
70				 parent, minor);
71}
v6.8
 1// SPDX-License-Identifier: MIT
 2/*
 3 * Copyright © 2022 Intel Corporation
 4 */
 5
 6#include "xe_huc_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_huc.h"
14#include "xe_macros.h"
 
15
16static struct xe_gt *
17huc_to_gt(struct xe_huc *huc)
18{
19	return container_of(huc, struct xe_gt, uc.huc);
20}
21
22static struct xe_device *
23huc_to_xe(struct xe_huc *huc)
24{
25	return gt_to_xe(huc_to_gt(huc));
26}
27
28static struct xe_huc *node_to_huc(struct drm_info_node *node)
29{
30	return node->info_ent->data;
31}
32
33static int huc_info(struct seq_file *m, void *data)
34{
35	struct xe_huc *huc = node_to_huc(m->private);
36	struct xe_device *xe = huc_to_xe(huc);
37	struct drm_printer p = drm_seq_file_printer(m);
38
39	xe_device_mem_access_get(xe);
40	xe_huc_print_info(huc, &p);
41	xe_device_mem_access_put(xe);
42
43	return 0;
44}
45
46static const struct drm_info_list debugfs_list[] = {
47	{"huc_info", huc_info, 0},
48};
49
50void xe_huc_debugfs_register(struct xe_huc *huc, struct dentry *parent)
51{
52	struct drm_minor *minor = huc_to_xe(huc)->drm.primary;
53	struct drm_info_list *local;
54	int i;
55
56#define DEBUGFS_SIZE	(ARRAY_SIZE(debugfs_list) * sizeof(struct drm_info_list))
57	local = drmm_kmalloc(&huc_to_xe(huc)->drm, DEBUGFS_SIZE, GFP_KERNEL);
58	if (!local)
59		return;
60
61	memcpy(local, debugfs_list, DEBUGFS_SIZE);
62#undef DEBUGFS_SIZE
63
64	for (i = 0; i < ARRAY_SIZE(debugfs_list); ++i)
65		local[i].data = huc;
66
67	drm_debugfs_create_files(local,
68				 ARRAY_SIZE(debugfs_list),
69				 parent, minor);
70}