mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 23:03:57 -04:00
Currently xe_guc_log_print_dmesg() is unused, as it's expected developers to add those calls when needed. However it makes it hard to guarantee it's working as nothing is testing it. Add a node in debugfs so it can be tested. This is purely for testing purposes since with the device probed and working, the guc log can be obtained by the regular debugfs file. Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250131171716.3998432-1-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
118 lines
2.5 KiB
C
118 lines
2.5 KiB
C
// SPDX-License-Identifier: MIT
|
|
/*
|
|
* Copyright © 2022 Intel Corporation
|
|
*/
|
|
|
|
#include "xe_guc_debugfs.h"
|
|
|
|
#include <drm/drm_debugfs.h>
|
|
#include <drm/drm_managed.h>
|
|
|
|
#include "xe_device.h"
|
|
#include "xe_gt.h"
|
|
#include "xe_guc.h"
|
|
#include "xe_guc_ct.h"
|
|
#include "xe_guc_log.h"
|
|
#include "xe_guc_pc.h"
|
|
#include "xe_macros.h"
|
|
#include "xe_pm.h"
|
|
|
|
static struct xe_guc *node_to_guc(struct drm_info_node *node)
|
|
{
|
|
return node->info_ent->data;
|
|
}
|
|
|
|
static int guc_info(struct seq_file *m, void *data)
|
|
{
|
|
struct xe_guc *guc = node_to_guc(m->private);
|
|
struct xe_device *xe = guc_to_xe(guc);
|
|
struct drm_printer p = drm_seq_file_printer(m);
|
|
|
|
xe_pm_runtime_get(xe);
|
|
xe_guc_print_info(guc, &p);
|
|
xe_pm_runtime_put(xe);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int guc_log(struct seq_file *m, void *data)
|
|
{
|
|
struct xe_guc *guc = node_to_guc(m->private);
|
|
struct xe_device *xe = guc_to_xe(guc);
|
|
struct drm_printer p = drm_seq_file_printer(m);
|
|
|
|
xe_pm_runtime_get(xe);
|
|
xe_guc_log_print(&guc->log, &p);
|
|
xe_pm_runtime_put(xe);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int guc_log_dmesg(struct seq_file *m, void *data)
|
|
{
|
|
struct xe_guc *guc = node_to_guc(m->private);
|
|
struct xe_device *xe = guc_to_xe(guc);
|
|
|
|
xe_pm_runtime_get(xe);
|
|
xe_guc_log_print_dmesg(&guc->log);
|
|
xe_pm_runtime_put(xe);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int guc_ctb(struct seq_file *m, void *data)
|
|
{
|
|
struct xe_guc *guc = node_to_guc(m->private);
|
|
struct xe_device *xe = guc_to_xe(guc);
|
|
struct drm_printer p = drm_seq_file_printer(m);
|
|
|
|
xe_pm_runtime_get(xe);
|
|
xe_guc_ct_print(&guc->ct, &p, true);
|
|
xe_pm_runtime_put(xe);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int guc_pc(struct seq_file *m, void *data)
|
|
{
|
|
struct xe_guc *guc = node_to_guc(m->private);
|
|
struct xe_device *xe = guc_to_xe(guc);
|
|
struct drm_printer p = drm_seq_file_printer(m);
|
|
|
|
xe_pm_runtime_get(xe);
|
|
xe_guc_pc_print(&guc->pc, &p);
|
|
xe_pm_runtime_put(xe);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct drm_info_list debugfs_list[] = {
|
|
{"guc_info", guc_info, 0},
|
|
{"guc_log", guc_log, 0},
|
|
{"guc_log_dmesg", guc_log_dmesg, 0},
|
|
{"guc_ctb", guc_ctb, 0},
|
|
{"guc_pc", guc_pc, 0},
|
|
};
|
|
|
|
void xe_guc_debugfs_register(struct xe_guc *guc, struct dentry *parent)
|
|
{
|
|
struct drm_minor *minor = guc_to_xe(guc)->drm.primary;
|
|
struct drm_info_list *local;
|
|
int i;
|
|
|
|
#define DEBUGFS_SIZE (ARRAY_SIZE(debugfs_list) * sizeof(struct drm_info_list))
|
|
local = drmm_kmalloc(&guc_to_xe(guc)->drm, DEBUGFS_SIZE, GFP_KERNEL);
|
|
if (!local)
|
|
return;
|
|
|
|
memcpy(local, debugfs_list, DEBUGFS_SIZE);
|
|
#undef DEBUGFS_SIZE
|
|
|
|
for (i = 0; i < ARRAY_SIZE(debugfs_list); ++i)
|
|
local[i].data = guc;
|
|
|
|
drm_debugfs_create_files(local,
|
|
ARRAY_SIZE(debugfs_list),
|
|
parent, minor);
|
|
}
|