brintos

brintos / linux-shallow public Read only

0
0
Text · 1.7 KiB · 6d541c8 Raw
66 lines · c
1// SPDX-License-Identifier: MIT2/*3 * Copyright © 2020 Intel Corporation4 */5 6#include <linux/debugfs.h>7#include <linux/string_helpers.h>8 9#include <drm/drm_print.h>10 11#include "gt/intel_gt_debugfs.h"12#include "intel_guc_debugfs.h"13#include "intel_gsc_uc_debugfs.h"14#include "intel_huc_debugfs.h"15#include "intel_uc.h"16#include "intel_uc_debugfs.h"17 18static int uc_usage_show(struct seq_file *m, void *data)19{20	struct intel_uc *uc = m->private;21	struct drm_printer p = drm_seq_file_printer(m);22 23	drm_printf(&p, "[guc] supported:%s wanted:%s used:%s\n",24		   str_yes_no(intel_uc_supports_guc(uc)),25		   str_yes_no(intel_uc_wants_guc(uc)),26		   str_yes_no(intel_uc_uses_guc(uc)));27	drm_printf(&p, "[huc] supported:%s wanted:%s used:%s\n",28		   str_yes_no(intel_uc_supports_huc(uc)),29		   str_yes_no(intel_uc_wants_huc(uc)),30		   str_yes_no(intel_uc_uses_huc(uc)));31	drm_printf(&p, "[submission] supported:%s wanted:%s used:%s\n",32		   str_yes_no(intel_uc_supports_guc_submission(uc)),33		   str_yes_no(intel_uc_wants_guc_submission(uc)),34		   str_yes_no(intel_uc_uses_guc_submission(uc)));35 36	return 0;37}38DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(uc_usage);39 40void intel_uc_debugfs_register(struct intel_uc *uc, struct dentry *gt_root)41{42	static const struct intel_gt_debugfs_file files[] = {43		{ "usage", &uc_usage_fops, NULL },44	};45	struct dentry *root;46 47	if (!gt_root)48		return;49 50	/* GuC and HuC go always in pair, no need to check both */51	if (!intel_uc_supports_guc(uc))52		return;53 54	root = debugfs_create_dir("uc", gt_root);55	if (IS_ERR(root))56		return;57 58	uc->guc.dbgfs_node = root;59 60	intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), uc);61 62	intel_gsc_uc_debugfs_register(&uc->gsc, root);63	intel_guc_debugfs_register(&uc->guc, root);64	intel_huc_debugfs_register(&uc->huc, root);65}66