1 // SPDX-License-Identifier: MIT
3 * Copyright © 2022 Intel Corporation
6 #include "xe_huc_debugfs.h"
8 #include <drm/drm_debugfs.h>
9 #include <drm/drm_managed.h>
11 #include "xe_device.h"
14 #include "xe_macros.h"
18 huc_to_gt(struct xe_huc *huc)
20 return container_of(huc, struct xe_gt, uc.huc);
23 static struct xe_device *
24 huc_to_xe(struct xe_huc *huc)
26 return gt_to_xe(huc_to_gt(huc));
29 static struct xe_huc *node_to_huc(struct drm_info_node *node)
31 return node->info_ent->data;
34 static int huc_info(struct seq_file *m, void *data)
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);
40 xe_pm_runtime_get(xe);
41 xe_huc_print_info(huc, &p);
42 xe_pm_runtime_put(xe);
47 static const struct drm_info_list debugfs_list[] = {
48 {"huc_info", huc_info, 0},
51 void xe_huc_debugfs_register(struct xe_huc *huc, struct dentry *parent)
53 struct drm_minor *minor = huc_to_xe(huc)->drm.primary;
54 struct drm_info_list *local;
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);
62 memcpy(local, debugfs_list, DEBUGFS_SIZE);
65 for (i = 0; i < ARRAY_SIZE(debugfs_list); ++i)
68 drm_debugfs_create_files(local,
69 ARRAY_SIZE(debugfs_list),