From bc1b5fdd56fff2a64a78b4a190897e34f9f08845 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 28 Jan 2015 18:37:00 +0530 Subject: 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 Reviewed-on: http://git-master/r/486465 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 60 ++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/debug_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c index 1351304d..9dfab370 100644 --- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c @@ -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); -- cgit v1.2.2