diff options
author | Arto Merilainen <amerilainen@nvidia.com> | 2014-07-03 12:28:25 +0300 |
---|---|---|
committer | Emad Mir <emir@nvidia.com> | 2014-07-07 13:13:08 -0700 |
commit | 14e6571944ce245854aafe08d5208af2c0d083e4 (patch) | |
tree | 7900d1ae1c642c633d3db32594eb72acbf369e1c /drivers/gpu | |
parent | c8715e4a23bbe7cc53e8d8352a0bc6c5a21574bb (diff) |
Revert "gpu: nvgpu: Dump offending push buffer fragment"
Channel and gpfifo allocations are entirely separated from each
other, however, the code here assumes that active channel means
that the channel also has a gpfifo.
This reverts commit a24602f094380539788696d1b1567a4f4d914b17 which
added gpfifo dump. Changing debug dumping to be safe requires
refactoring the channel release code to use proper locking.
Bug 200017498
Bug 1530226
Change-Id: I2fb02542a17dd56a0a9ce732b327e34b85ade8b9
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
(cherry picked from commit 3d37815d7660affeb9a4f23b0d17f870ed12dd33)
Reviewed-on: http://git-master/r/434053
Reviewed-by: Emad Mir <emir@nvidia.com>
Tested-by: Emad Mir <emir@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 15 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 132 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 6 |
4 files changed, 23 insertions, 132 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index cf6f119092af..f145b661241b 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -906,21 +906,6 @@ static void channel_gk20a_free_priv_cmdbuf(struct channel_gk20a *c) memset(q, 0, sizeof(struct priv_cmd_queue)); } -int gk20a_find_from_priv_cmdbuf(struct channel_gk20a *c, - u64 gpu_va, u32 **cpu_va) -{ - struct priv_cmd_queue *q = &c->priv_cmd_q; - int ret; - - if (gpu_va >= q->base_gpuva && gpu_va < (q->base_gpuva + q->size)) { - *cpu_va = gpu_va - q->base_gpuva + q->mem.base_cpuva; - ret = 0; - } else - ret = -EINVAL; - - return ret; -} - /* allocate a cmd buffer with given size. size is number of u32 entries */ int gk20a_channel_alloc_priv_cmdbuf(struct channel_gk20a *c, u32 orig_size, struct priv_cmd_entry **entry) diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index 8e7f17e7a443..320ada62a965 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h @@ -154,8 +154,6 @@ void gk20a_set_error_notifier(struct channel_gk20a *ch, __u32 error); void gk20a_channel_semaphore_wakeup(struct gk20a *g); int gk20a_channel_alloc_priv_cmdbuf(struct channel_gk20a *c, u32 size, struct priv_cmd_entry **entry); -int gk20a_find_from_priv_cmdbuf(struct channel_gk20a *c, - u64 addr, u32 **cpu_va); int gk20a_channel_suspend(struct gk20a *g); int gk20a_channel_resume(struct gk20a *g); diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c index 7e3f613a267b..3f1f4f0a8e61 100644 --- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c @@ -19,7 +19,6 @@ #include <linux/seq_file.h> #include <linux/io.h> -#include <linux/dma-buf.h> #include "gk20a.h" #include "debug_gk20a.h" @@ -34,7 +33,6 @@ struct platform_device *gk20a_device; struct gk20a_debug_output { void (*fn)(void *ctx, const char *str, size_t len); - void (*cont)(void *ctx, const char *str, size_t len); void *ctx; char buf[256]; }; @@ -82,12 +80,6 @@ static inline void gk20a_debug_write_printk(void *ctx, const char *str, pr_info("%s", str); } -static inline void gk20a_debug_cont_printk(void *ctx, const char *str, - size_t len) -{ - pr_cont("%s", str); -} - static inline void gk20a_debug_write_to_seqfile(void *ctx, const char *str, size_t len) { @@ -105,17 +97,6 @@ void gk20a_debug_output(struct gk20a_debug_output *o, const char *fmt, ...) o->fn(o->ctx, o->buf, len); } -void gk20a_debug_output_cont(struct gk20a_debug_output *o, const char *fmt, ...) -{ - va_list args; - int len; - - va_start(args, fmt); - len = vsnprintf(o->buf, sizeof(o->buf), fmt, args); - va_end(args); - o->cont(o->ctx, o->buf, len); -} - static void gk20a_debug_show_channel(struct gk20a *g, struct gk20a_debug_output *o, struct channel_gk20a *ch) @@ -132,14 +113,14 @@ static void gk20a_debug_show_channel(struct gk20a *g, syncpointa = gk20a_mem_rd32(inst_ptr, ram_fc_syncpointa_w()); syncpointb = gk20a_mem_rd32(inst_ptr, ram_fc_syncpointb_w()); - gk20a_debug_output_cont(o, "%d-%s, pid %d: ", ch->hw_chid, + gk20a_debug_output(o, "%d-%s, pid %d: ", ch->hw_chid, ch->g->dev->name, ch->pid); - gk20a_debug_output_cont(o, "%s in use %s %s\n", + gk20a_debug_output(o, "%s in use %s %s\n", ccsr_channel_enable_v(channel) ? "" : "not", ccsr_chan_status_str[status], ccsr_channel_busy_v(channel) ? "busy" : "not busy"); - gk20a_debug_output_cont(o, "TOP: %016llx PUT: %016llx GET: %016llx " + gk20a_debug_output(o, "TOP: %016llx PUT: %016llx GET: %016llx " "FETCH: %016llx\nHEADER: %08x COUNT: %08x\n" "SYNCPOINT %08x %08x SEMAPHORE %08x %08x %08x %08x\n", (u64)gk20a_mem_rd32(inst_ptr, ram_fc_pb_top_level_get_w()) + @@ -163,7 +144,7 @@ static void gk20a_debug_show_channel(struct gk20a *g, if ((pbdma_syncpointb_op_v(syncpointb) == pbdma_syncpointb_op_wait_v()) && (pbdma_syncpointb_wait_switch_v(syncpointb) == pbdma_syncpointb_wait_switch_en_v())) - gk20a_debug_output_cont(o, "%s on syncpt %u (%s) val %u\n", + gk20a_debug_output(o, "%s on syncpt %u (%s) val %u\n", (status == 3 || status == 8) ? "Waiting" : "Waited", pbdma_syncpointb_syncpt_index_v(syncpointb), nvhost_syncpt_get_name( @@ -171,74 +152,7 @@ static void gk20a_debug_show_channel(struct gk20a *g, pbdma_syncpointb_syncpt_index_v(syncpointb)), pbdma_syncpointa_payload_v(syncpointa)); - gk20a_debug_output_cont(o, "\n"); -} - -static void gk20a_dump_gpfifo(struct channel_gk20a *ch, - struct gpfifo *g, struct gk20a_debug_output *o) -{ - struct dma_buf *pb = NULL; - u32 *pb_cpu_va = NULL; - u64 pb_offset = 0; - int i, err = 0; - - u64 gpu_va = (u64)g->entry0 - | (u64)pbdma_gp_entry1_get_hi_v(g->entry1) << 32ULL; - u32 length = pbdma_gp_entry1_length_v(g->entry1); - - if (gk20a_find_from_priv_cmdbuf(ch, gpu_va, &pb_cpu_va)) { - gk20a_debug_output_cont(o, "U: "); - err = gk20a_vm_find_buffer(ch->vm, gpu_va, &pb, &pb_offset); - } - if (err) { - gk20a_debug_output_cont(o, "Couldn't find push buffer\n"); - return; - } - - if (pb) - pb_cpu_va = dma_buf_vmap(pb); - for (i = 0; i < length; i++) { - if (i && i % 8 == 0) - gk20a_debug_output_cont(o, "\n"); - gk20a_debug_output_cont(o, "%08x ", *(pb_cpu_va + (pb_offset/4) + i)); - } - - if (pb) - dma_buf_vunmap(pb, pb_cpu_va); - - gk20a_debug_output_cont(o, "\n"); -} - -static void gk20a_dump_pb(struct gk20a *g, - u32 pbdma_id, struct gk20a_debug_output *o) -{ - u32 gp_get = gk20a_readl(g, pbdma_gp_get_r(pbdma_id)); - u32 status = gk20a_readl(g, fifo_pbdma_status_r(pbdma_id)); - u32 chan_status = fifo_pbdma_status_chan_status_v(status); - u32 hw_chid = fifo_pbdma_status_id_v(status); - struct channel_gk20a *ch = g->fifo.channel+ hw_chid; - - gk20a_debug_output_cont(o, "%s pbdma %d: ", g->dev->name, pbdma_id); - gk20a_debug_output_cont(o, - "id: %d (%s), next_id: %d (%s) status: %s\n", - fifo_pbdma_status_id_v(status), - fifo_pbdma_status_id_type_v(status) ? - "tsg" : "channel", - fifo_pbdma_status_next_id_v(status), - fifo_pbdma_status_next_id_type_v(status) ? - "tsg" : "channel", - chan_status_str[chan_status]); - gk20a_debug_output_cont(o, "PUT: %08x GET: %08x " - "FETCH: %08x HEADER: %08x\n", - gk20a_readl(g, pbdma_gp_put_r(pbdma_id)), - gk20a_readl(g, pbdma_gp_get_r(pbdma_id)), - gk20a_readl(g, pbdma_gp_fetch_r(pbdma_id)), - gk20a_readl(g, pbdma_pb_header_r(pbdma_id))); - - if (ch->in_use) { - gk20a_dump_gpfifo(ch, &ch->gpfifo.cpu_va[(gp_get-2) % ch->gpfifo.entry_num], o); - gk20a_dump_gpfifo(ch, &ch->gpfifo.cpu_va[(gp_get-1) % ch->gpfifo.entry_num], o); - } + gk20a_debug_output(o, "\n"); } void gk20a_debug_show_dump(struct platform_device *pdev, @@ -251,13 +165,12 @@ void gk20a_debug_show_dump(struct platform_device *pdev, int i; gk20a_busy(g->dev); - gk20a_debug_output(o, ""); for (i = 0; i < fifo_pbdma_status__size_1_v(); i++) { u32 status = gk20a_readl(g, fifo_pbdma_status_r(i)); u32 chan_status = fifo_pbdma_status_chan_status_v(status); - gk20a_debug_output_cont(o, "%s pbdma %d: ", g->dev->name, i); - gk20a_debug_output_cont(o, + gk20a_debug_output(o, "%s pbdma %d: ", g->dev->name, i); + gk20a_debug_output(o, "id: %d (%s), next_id: %d (%s) status: %s\n", fifo_pbdma_status_id_v(status), fifo_pbdma_status_id_type_v(status) ? @@ -266,23 +179,23 @@ void gk20a_debug_show_dump(struct platform_device *pdev, fifo_pbdma_status_next_id_type_v(status) ? "tsg" : "channel", chan_status_str[chan_status]); - gk20a_debug_output_cont(o, "PUT: %08x GET: %08x " + gk20a_debug_output(o, "PUT: %016llx GET: %016llx " "FETCH: %08x HEADER: %08x\n", - gk20a_readl(g, pbdma_gp_put_r(i)), - gk20a_readl(g, pbdma_gp_get_r(i)), + (u64)gk20a_readl(g, pbdma_put_r(i)) + + ((u64)gk20a_readl(g, pbdma_put_hi_r(i)) << 32ULL), + (u64)gk20a_readl(g, pbdma_get_r(i)) + + ((u64)gk20a_readl(g, pbdma_get_hi_r(i)) << 32ULL), gk20a_readl(g, pbdma_gp_fetch_r(i)), gk20a_readl(g, pbdma_pb_header_r(i))); - - gk20a_dump_pb(g, i, o); } - gk20a_debug_output_cont(o, "\n"); + gk20a_debug_output(o, "\n"); for (i = 0; i < fifo_engine_status__size_1_v(); i++) { u32 status = gk20a_readl(g, fifo_engine_status_r(i)); u32 ctx_status = fifo_engine_status_ctx_status_v(status); - gk20a_debug_output_cont(o, "%s eng %d: ", g->dev->name, i); - gk20a_debug_output_cont(o, + gk20a_debug_output(o, "%s eng %d: ", g->dev->name, i); + gk20a_debug_output(o, "id: %d (%s), next_id: %d (%s), ctx: %s ", fifo_engine_status_id_v(status), fifo_engine_status_id_type_v(status) ? @@ -293,12 +206,12 @@ void gk20a_debug_show_dump(struct platform_device *pdev, ctx_status_str[ctx_status]); if (fifo_engine_status_faulted_v(status)) - gk20a_debug_output_cont(o, "faulted "); + gk20a_debug_output(o, "faulted "); if (fifo_engine_status_engine_v(status)) - gk20a_debug_output_cont(o, "busy "); - gk20a_debug_output_cont(o, "\n"); + gk20a_debug_output(o, "busy "); + gk20a_debug_output(o, "\n"); } - gk20a_debug_output_cont(o, "\n"); + gk20a_debug_output(o, "\n"); for (chid = 0; chid < f->num_channels; chid++) { if (f->channel[chid].in_use) { @@ -313,8 +226,7 @@ void gk20a_debug_dump(struct platform_device *pdev) { struct gk20a_platform *platform = gk20a_get_platform(pdev); struct gk20a_debug_output o = { - .fn = gk20a_debug_write_printk, - .cont = gk20a_debug_cont_printk + .fn = gk20a_debug_write_printk }; if (platform->dump_platform_dependencies) @@ -326,8 +238,7 @@ void gk20a_debug_dump(struct platform_device *pdev) void gk20a_debug_dump_device(struct platform_device *pdev) { struct gk20a_debug_output o = { - .fn = gk20a_debug_write_printk, - .cont = gk20a_debug_cont_printk + .fn = gk20a_debug_write_printk }; /* Dump the first device if no info is provided */ @@ -343,7 +254,6 @@ static int gk20a_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, - .cont = gk20a_debug_write_to_seqfile, .ctx = s, }; gk20a_debug_show_dump(pdev, &o); diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 3fdf90c070b7..0f4ad8866de9 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -1180,15 +1180,13 @@ void gk20a_fifo_recover_ch(struct gk20a *g, u32 hw_chid, bool verbose) struct channel_gk20a *ch = g->fifo.channel + hw_chid; - if (verbose) - gk20a_debug_dump(g->dev); - gk20a_disable_channel_no_update(ch); for (i = 0; i < g->fifo.max_runlists; i++) gk20a_fifo_update_runlist(g, i, hw_chid, false, false); - gk20a_fifo_set_ctx_mmu_error(g, ch); + if (gk20a_fifo_set_ctx_mmu_error(g, ch)) + gk20a_debug_dump(g->dev); } } |