mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: APIs to dump GR status
Add below APIs to dump various GR status registers 1. debugfs : /d/gpu.0/gr_status Read this debugfs at runtime to get status registers 2. API gk20a_gr_debug_dump() Add this API in code to dump registers at any point Bug 200062436 Change-Id: Ic1115b5a2fc16362954b5ed8a9e70afb872a8d91 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/486465 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
Dan Willemsen
parent
aa96b6bd1e
commit
bc1b5fdd56
@@ -83,7 +83,7 @@ static inline void gk20a_debug_write_to_seqfile(void *ctx, const char *str,
|
||||
seq_write((struct seq_file *)ctx, str, len);
|
||||
}
|
||||
|
||||
static void gk20a_debug_output(struct gk20a_debug_output *o,
|
||||
void gk20a_debug_output(struct gk20a_debug_output *o,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
@@ -223,6 +223,50 @@ void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o)
|
||||
gk20a_idle(g->dev);
|
||||
}
|
||||
|
||||
static int gk20a_gr_dump_regs(struct platform_device *pdev,
|
||||
struct gk20a_debug_output *o)
|
||||
{
|
||||
struct gk20a_platform *platform = gk20a_get_platform(pdev);
|
||||
struct gk20a *g = platform->g;
|
||||
int err;
|
||||
|
||||
err = gk20a_busy(g->dev);
|
||||
if (err) {
|
||||
gk20a_err(&pdev->dev, "failed to power on gpu: %d\n", err);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
gr_gk20a_elpg_protected_call(g, g->ops.gr.dump_gr_regs(g, o));
|
||||
|
||||
gk20a_idle(g->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gk20a_gr_debug_dump(struct platform_device *pdev)
|
||||
{
|
||||
struct gk20a_debug_output o = {
|
||||
.fn = gk20a_debug_write_printk
|
||||
};
|
||||
|
||||
gk20a_gr_dump_regs(pdev, &o);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gk20a_gr_debug_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
struct platform_device *pdev = s->private;
|
||||
struct gk20a_debug_output o = {
|
||||
.fn = gk20a_debug_write_to_seqfile,
|
||||
.ctx = s,
|
||||
};
|
||||
|
||||
gk20a_gr_dump_regs(pdev, &o);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gk20a_debug_dump(struct platform_device *pdev)
|
||||
{
|
||||
struct gk20a_platform *platform = gk20a_get_platform(pdev);
|
||||
@@ -277,11 +321,23 @@ static int gk20a_debug_show(struct seq_file *s, void *unused)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gk20a_gr_debug_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, gk20a_gr_debug_show, inode->i_private);
|
||||
}
|
||||
|
||||
static int gk20a_debug_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, gk20a_debug_show, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations gk20a_gr_debug_fops = {
|
||||
.open = gk20a_gr_debug_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static const struct file_operations gk20a_debug_fops = {
|
||||
.open = gk20a_debug_open,
|
||||
.read = seq_read,
|
||||
@@ -306,6 +362,8 @@ void gk20a_debug_init(struct platform_device *pdev)
|
||||
|
||||
debugfs_create_file("status", S_IRUGO, platform->debugfs,
|
||||
pdev, &gk20a_debug_fops);
|
||||
debugfs_create_file("gr_status", S_IRUGO, platform->debugfs,
|
||||
pdev, &gk20a_gr_debug_fops);
|
||||
debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR, platform->debugfs,
|
||||
&gk20a_debug_trace_cmdbuf);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user