From 2385bc45ef8fb58def46c116673cb11f3ba38c91 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 4 Nov 2011 14:00:13 +0200 Subject: video: tegra: host: Enhance FIFO/GATHER debug_dump Enhance nvhost_debug_dump() output, as follows: - Swap FIFO and GATHER dump so that even if GATHER dump blows out seq_printf 1k buffer, we still have FIFO information; - Write FIFO signature pattern (0xd???d???) to indirect save input data to help pinpoint FIFO position within debug dumps; - Prevent long data sequences from blowing out the seq_printf 1k buffer, by limiting such sequences to 64 words. Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/62424 (cherry picked from commit cb37e4212b78546411b33b32044f30feb0579b86) Change-Id: Ia2695c502fa0c7b755ef2ae51260650c7d67bf86 Reviewed-on: http://git-master/r/64061 Reviewed-by: Yu-Huan Hsu --- drivers/video/tegra/host/t20/debug_t20.c | 43 ++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'drivers/video/tegra/host/t20/debug_t20.c') diff --git a/drivers/video/tegra/host/t20/debug_t20.c b/drivers/video/tegra/host/t20/debug_t20.c index 5acad0d43132..84267c9a9018 100644 --- a/drivers/video/tegra/host/t20/debug_t20.c +++ b/drivers/video/tegra/host/t20/debug_t20.c @@ -104,10 +104,6 @@ static int show_channel_command(struct output *o, u32 addr, u32 val, int *count) } } -/* - * TODO: This uses ioremap_xxx on memory which is deprecated. - * Also, it won't work properly with SMMU. - */ static void show_channel_gather(struct output *o, u32 addr, phys_addr_t phys_addr, u32 words, struct nvhost_cdma *cdma); @@ -115,6 +111,8 @@ static void show_channel_gather(struct output *o, u32 addr, static void show_channel_word(struct output *o, int *state, int *count, u32 addr, u32 val, struct nvhost_cdma *cdma) { + static int start_count, dont_print; + switch (*state) { case NVHOST_DBG_STATE_CMD: if (addr) @@ -123,6 +121,8 @@ static void show_channel_word(struct output *o, int *state, int *count, nvhost_debug_output(o, "%08x:", val); *state = show_channel_command(o, addr, val, count); + dont_print = 0; + start_count = *count; if (*state == NVHOST_DBG_STATE_DATA && *count == 0) { *state = NVHOST_DBG_STATE_CMD; nvhost_debug_output(o, "])\n"); @@ -131,7 +131,14 @@ static void show_channel_word(struct output *o, int *state, int *count, case NVHOST_DBG_STATE_DATA: (*count)--; - nvhost_debug_output(o, "%08x%s", val, *count > 0 ? ", " : "])\n"); + if (start_count - *count < 64) + nvhost_debug_output(o, "%08x%s", + val, *count > 0 ? ", " : "])\n"); + else if (!dont_print && (*count > 0)) { + nvhost_debug_output(o, "[truncated; %d more words]\n", + *count); + dont_print = 1; + } if (*count == 0) *state = NVHOST_DBG_STATE_CMD; break; @@ -139,8 +146,10 @@ static void show_channel_word(struct output *o, int *state, int *count, case NVHOST_DBG_STATE_GATHER: *state = NVHOST_DBG_STATE_CMD; nvhost_debug_output(o, "%08x]):\n", val); - if (cdma) - show_channel_gather(o, addr, val, *count, cdma); + if (cdma) { + show_channel_gather(o, addr, val, + *count, cdma); + } break; } } @@ -158,6 +167,11 @@ static void show_channel_gather(struct output *o, u32 addr, phys_addr_t pin_addr; int state, count, i; + if ((u32)nvmap->handle == NVHOST_CDMA_PUSH_GATHER_CTXSAVE) { + nvhost_debug_output(o, "[context save]\n"); + return; + } + if (!nvmap->handle || !nvmap->client || atomic_read(&nvmap->handle->ref) < 1) { nvhost_debug_output(o, "[already deallocated]\n"); @@ -285,6 +299,10 @@ static void t20_debug_show_channel_cdma(struct nvhost_master *m, break; } + nvhost_debug_output(o, "DMAPUT %08x, DMAGET %08x, DMACTL %08x\n", + dmaput, dmaget, dmactrl); + nvhost_debug_output(o, "CBREAD %08x, CBSTAT %08x\n", cbread, cbstat); + cdma_peek(cdma, dmaget, -1, pbw); show_channel_pair(o, previous_oppair(cdma, dmaget), pbw[0], pbw[1], &channel->cdma); nvhost_debug_output(o, "\n"); @@ -294,11 +312,17 @@ void t20_debug_show_channel_fifo(struct nvhost_master *m, struct output *o, int chid) { u32 val, rd_ptr, wr_ptr, start, end; + struct nvhost_channel *channel = m->channels + chid; int state, count; - val = readl(m->aperture + HOST1X_CHANNEL_FIFOSTAT); - if (val & (1 << 10)) + nvhost_debug_output(o, "%d: fifo:\n", chid); + + val = readl(channel->aperture + HOST1X_CHANNEL_FIFOSTAT); + nvhost_debug_output(o, "FIFOSTAT %08x\n", val); + if (val & (1 << 10)) { + nvhost_debug_output(o, "[empty]\n"); return; + } writel(0x0, m->aperture + HOST1X_SYNC_CFPEEK_CTRL); writel((1 << 31) | (chid << 16), @@ -313,7 +337,6 @@ void t20_debug_show_channel_fifo(struct nvhost_master *m, end = (val >> 16) & 0x1ff; state = NVHOST_DBG_STATE_CMD; - nvhost_debug_output(o, "%d: fifo:\n", chid); do { writel(0x0, m->aperture + HOST1X_SYNC_CFPEEK_CTRL); -- cgit v1.2.3