summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2012-05-09 14:55:28 +0300
committerSimone Willett <swillett@nvidia.com>2012-05-10 17:20:09 -0700
commitc74aee528eb8c0bb018f732d3d1e1c7e692149ad (patch)
tree6921d2bb2703dd6010fd4eae3c09517b0524fcc1 /drivers
parent67795d8df0e87e67d4da4fa81874911fc7b9d5bd (diff)
video: tegra: host: Add context switch to trace dump
Add context switch to the ftrace dump. Change-Id: I5df032273982b919fb94263cff38d8b8b6b6be45 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/101523 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/tegra/host/bus_client.c41
-rw-r--r--drivers/video/tegra/host/gr3d/gr3d_t20.c5
-rw-r--r--drivers/video/tegra/host/gr3d/gr3d_t30.c5
-rw-r--r--drivers/video/tegra/host/host1x/host1x_channel.c9
-rw-r--r--drivers/video/tegra/host/host1x/host1x_debug.c5
-rw-r--r--drivers/video/tegra/host/mpe/mpe.c5
-rw-r--r--drivers/video/tegra/host/nvhost_cdma.c46
-rw-r--r--drivers/video/tegra/host/nvhost_cdma.h3
8 files changed, 61 insertions, 58 deletions
diff --git a/drivers/video/tegra/host/bus_client.c b/drivers/video/tegra/host/bus_client.c
index 272e0c9f2efb..c6160d6db36e 100644
--- a/drivers/video/tegra/host/bus_client.c
+++ b/drivers/video/tegra/host/bus_client.c
@@ -90,45 +90,6 @@ struct nvhost_channel_userctx {
int clientid;
};
-/*
- * Write cmdbuf to ftrace output. Checks if cmdbuf contents should be output
- * and mmaps the cmdbuf contents if required.
- */
-static void trace_write_cmdbufs(struct nvhost_job *job)
-{
- struct nvmap_handle_ref handle;
- void *mem = NULL;
- int i = 0;
-
- for (i = 0; i < job->num_gathers; i++) {
- struct nvhost_channel_gather *gather = &job->gathers[i];
- if (nvhost_debug_trace_cmdbuf) {
- handle.handle = nvmap_id_to_handle(gather->mem_id);
- mem = nvmap_mmap(&handle);
- if (IS_ERR_OR_NULL(mem))
- mem = NULL;
- };
-
- if (mem) {
- u32 i;
- /*
- * Write in batches of 128 as there seems to be a limit
- * of how much you can output to ftrace at once.
- */
- for (i = 0; i < gather->words; i += TRACE_MAX_LENGTH) {
- trace_nvhost_channel_write_cmdbuf_data(
- job->ch->dev->name,
- gather->mem_id,
- min(gather->words - i,
- TRACE_MAX_LENGTH),
- gather->offset + i * sizeof(u32),
- mem);
- }
- nvmap_munmap(&handle, mem);
- }
- }
-}
-
static int nvhost_channelrelease(struct inode *inode, struct file *filp)
{
struct nvhost_channel_userctx *priv = filp->private_data;
@@ -369,8 +330,6 @@ static int nvhost_ioctl_channel_flush(
ctx->timeout = nvhost_debug_force_timeout_val;
}
- trace_write_cmdbufs(ctx->job);
-
/* context switch if needed, and submit user's gathers to the channel */
err = nvhost_channel_submit(ctx->job);
args->value = ctx->job->syncpt_end;
diff --git a/drivers/video/tegra/host/gr3d/gr3d_t20.c b/drivers/video/tegra/host/gr3d/gr3d_t20.c
index e3a887d34b96..c0efac03b882 100644
--- a/drivers/video/tegra/host/gr3d/gr3d_t20.c
+++ b/drivers/video/tegra/host/gr3d/gr3d_t20.c
@@ -137,8 +137,9 @@ static void save_push_v0(struct nvhost_hwctx *nctx, struct nvhost_cdma *cdma)
struct host1x_hwctx_handler *p = host1x_hwctx_handler(ctx);
nvhost_cdma_push_gather(cdma,
- (void *)NVHOST_CDMA_PUSH_GATHER_CTXSAVE,
- (void *)NVHOST_CDMA_PUSH_GATHER_CTXSAVE,
+ nvhost_get_host(nctx->channel->dev)->nvmap,
+ p->save_buf->handle,
+ 0,
nvhost_opcode_gather(p->save_size),
p->save_phys);
}
diff --git a/drivers/video/tegra/host/gr3d/gr3d_t30.c b/drivers/video/tegra/host/gr3d/gr3d_t30.c
index 01eac53d0608..93d98dfa645c 100644
--- a/drivers/video/tegra/host/gr3d/gr3d_t30.c
+++ b/drivers/video/tegra/host/gr3d/gr3d_t30.c
@@ -144,8 +144,9 @@ static void save_push_v1(struct nvhost_hwctx *nctx, struct nvhost_cdma *cdma)
ctx->restore_phys);
/* gather the save buffer */
nvhost_cdma_push_gather(cdma,
- (void *)NVHOST_CDMA_PUSH_GATHER_CTXSAVE,
- (void *)NVHOST_CDMA_PUSH_GATHER_CTXSAVE,
+ nvhost_get_host(nctx->channel->dev)->nvmap,
+ p->save_buf->handle,
+ 0,
nvhost_opcode_gather(p->save_size),
p->save_phys);
}
diff --git a/drivers/video/tegra/host/host1x/host1x_channel.c b/drivers/video/tegra/host/host1x/host1x_channel.c
index 04c5d0629ec2..3ebf956b4399 100644
--- a/drivers/video/tegra/host/host1x/host1x_channel.c
+++ b/drivers/video/tegra/host/host1x/host1x_channel.c
@@ -144,6 +144,7 @@ static void submit_ctxrestore(struct nvhost_job *job)
nvhost_cdma_push_gather(&ch->cdma,
host->nvmap,
nvmap_ref_to_handle(ctx->restore),
+ 0,
nvhost_opcode_gather(ctx->restore_size),
ctx->restore_phys);
@@ -181,12 +182,14 @@ void submit_nullkickoff(struct nvhost_job *job, int user_syncpt_incrs)
void submit_gathers(struct nvhost_job *job)
{
/* push user gathers */
- int i = 0;
- for ( ; i < job->num_gathers; i++) {
+ int i;
+ for (i = 0 ; i < job->num_gathers; i++) {
u32 op1 = nvhost_opcode_gather(job->gathers[i].words);
u32 op2 = job->gathers[i].mem;
nvhost_cdma_push_gather(&job->ch->cdma,
- job->nvmap, job->unpins[i/2],
+ job->nvmap,
+ nvmap_id_to_handle(job->gathers[i].mem_id),
+ job->gathers[i].offset,
op1, op2);
}
}
diff --git a/drivers/video/tegra/host/host1x/host1x_debug.c b/drivers/video/tegra/host/host1x/host1x_debug.c
index 46ae9c1db019..39565bc96465 100644
--- a/drivers/video/tegra/host/host1x/host1x_debug.c
+++ b/drivers/video/tegra/host/host1x/host1x_debug.c
@@ -174,11 +174,6 @@ 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");
diff --git a/drivers/video/tegra/host/mpe/mpe.c b/drivers/video/tegra/host/mpe/mpe.c
index 8d599a44adc3..2b0001058406 100644
--- a/drivers/video/tegra/host/mpe/mpe.c
+++ b/drivers/video/tegra/host/mpe/mpe.c
@@ -498,7 +498,10 @@ static void ctxmpe_save_push(struct nvhost_hwctx *nctx,
{
struct host1x_hwctx *ctx = to_host1x_hwctx(nctx);
struct host1x_hwctx_handler *h = host1x_hwctx_handler(ctx);
- nvhost_cdma_push(cdma,
+ nvhost_cdma_push_gather(cdma,
+ nvhost_get_host(nctx->channel->dev)->nvmap,
+ h->save_buf->handle,
+ 0,
nvhost_opcode_gather(h->save_size),
h->save_phys);
}
diff --git a/drivers/video/tegra/host/nvhost_cdma.c b/drivers/video/tegra/host/nvhost_cdma.c
index f1f4405d0745..57dc781d7af6 100644
--- a/drivers/video/tegra/host/nvhost_cdma.c
+++ b/drivers/video/tegra/host/nvhost_cdma.c
@@ -23,6 +23,7 @@
#include "nvhost_job.h"
#include "nvhost_hwctx.h"
#include "dev.h"
+#include "debug.h"
#include <asm/cacheflush.h>
#include <linux/slab.h>
@@ -399,13 +400,49 @@ int nvhost_cdma_begin(struct nvhost_cdma *cdma, struct nvhost_job *job)
return 0;
}
+static void trace_write_gather(struct nvhost_cdma *cdma,
+ struct nvmap_handle *handle,
+ u32 offset, u32 words)
+{
+ struct nvmap_handle_ref ref;
+ void *mem = NULL;
+
+ if (nvhost_debug_trace_cmdbuf) {
+ ref.handle = handle;
+ mem = nvmap_mmap(&ref);
+ if (IS_ERR_OR_NULL(mem))
+ mem = NULL;
+ };
+
+ if (mem) {
+ u32 i;
+ /*
+ * Write in batches of 128 as there seems to be a limit
+ * of how much you can output to ftrace at once.
+ */
+ for (i = 0; i < words; i += TRACE_MAX_LENGTH) {
+ trace_nvhost_cdma_push_gather(
+ cdma_to_channel(cdma)->dev->name,
+ (u32)handle,
+ min(words - i, TRACE_MAX_LENGTH),
+ offset + i * sizeof(u32),
+ mem);
+ }
+ nvmap_munmap(&ref, mem);
+ }
+}
+
/**
* Push two words into a push buffer slot
* Blocks as necessary if the push buffer is full.
*/
void nvhost_cdma_push(struct nvhost_cdma *cdma, u32 op1, u32 op2)
{
- nvhost_cdma_push_gather(cdma, NULL, NULL, op1, op2);
+ if (nvhost_debug_trace_cmdbuf)
+ trace_nvhost_cdma_push(cdma_to_channel(cdma)->dev->name,
+ op1, op2);
+
+ nvhost_cdma_push_gather(cdma, NULL, NULL, 0, op1, op2);
}
/**
@@ -414,12 +451,17 @@ void nvhost_cdma_push(struct nvhost_cdma *cdma, u32 op1, u32 op2)
*/
void nvhost_cdma_push_gather(struct nvhost_cdma *cdma,
struct nvmap_client *client,
- struct nvmap_handle *handle, u32 op1, u32 op2)
+ struct nvmap_handle *handle,
+ u32 offset, u32 op1, u32 op2)
{
u32 slots_free = cdma->slots_free;
struct push_buffer *pb = &cdma->push_buffer;
BUG_ON(!cdma_pb_op(cdma).push_to);
BUG_ON(!cdma_op(cdma).kick);
+
+ if (handle)
+ trace_write_gather(cdma, handle, offset, op1 & 0xffff);
+
if (slots_free == 0) {
cdma_op(cdma).kick(cdma);
slots_free = nvhost_cdma_wait_locked(cdma,
diff --git a/drivers/video/tegra/host/nvhost_cdma.h b/drivers/video/tegra/host/nvhost_cdma.h
index 9583fbbe5b16..d9dd25a195cd 100644
--- a/drivers/video/tegra/host/nvhost_cdma.h
+++ b/drivers/video/tegra/host/nvhost_cdma.h
@@ -114,10 +114,9 @@ void nvhost_cdma_deinit(struct nvhost_cdma *cdma);
void nvhost_cdma_stop(struct nvhost_cdma *cdma);
int nvhost_cdma_begin(struct nvhost_cdma *cdma, struct nvhost_job *job);
void nvhost_cdma_push(struct nvhost_cdma *cdma, u32 op1, u32 op2);
-#define NVHOST_CDMA_PUSH_GATHER_CTXSAVE 0xffffffff
void nvhost_cdma_push_gather(struct nvhost_cdma *cdma,
struct nvmap_client *client,
- struct nvmap_handle *handle, u32 op1, u32 op2);
+ struct nvmap_handle *handle, u32 offset, u32 op1, u32 op2);
void nvhost_cdma_end(struct nvhost_cdma *cdma,
struct nvhost_job *job);
void nvhost_cdma_update(struct nvhost_cdma *cdma);