diff options
Diffstat (limited to 'drivers/video/tegra')
-rw-r--r-- | drivers/video/tegra/host/debug.c | 3 | ||||
-rw-r--r-- | drivers/video/tegra/host/debug.h | 1 | ||||
-rw-r--r-- | drivers/video/tegra/host/dev.c | 45 |
3 files changed, 46 insertions, 3 deletions
diff --git a/drivers/video/tegra/host/debug.c b/drivers/video/tegra/host/debug.c index 4659a97ac110..aa4b41d96574 100644 --- a/drivers/video/tegra/host/debug.c +++ b/drivers/video/tegra/host/debug.c @@ -26,6 +26,7 @@ #include "debug.h" pid_t nvhost_debug_null_kickoff_pid; +unsigned int nvhost_debug_trace_cmdbuf; pid_t nvhost_debug_force_timeout_pid; u32 nvhost_debug_force_timeout_val; @@ -130,6 +131,8 @@ void nvhost_debug_init(struct nvhost_master *master) debugfs_create_u32("null_kickoff_pid", S_IRUGO|S_IWUSR, de, &nvhost_debug_null_kickoff_pid); + debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR, de, + &nvhost_debug_trace_cmdbuf); if (master->op.debug.debug_init) master->op.debug.debug_init(de); diff --git a/drivers/video/tegra/host/debug.h b/drivers/video/tegra/host/debug.h index 0e9e51e5f955..9dd3a1995478 100644 --- a/drivers/video/tegra/host/debug.h +++ b/drivers/video/tegra/host/debug.h @@ -46,5 +46,6 @@ void nvhost_debug_output(struct output *o, const char* fmt, ...); extern pid_t nvhost_debug_force_timeout_pid; extern u32 nvhost_debug_force_timeout_val; extern u32 nvhost_debug_force_timeout_channel; +extern unsigned int nvhost_debug_trace_cmdbuf; #endif /*__NVHOST_DEBUG_H */ diff --git a/drivers/video/tegra/host/dev.c b/drivers/video/tegra/host/dev.c index b552d5c52606..1767e53ca884 100644 --- a/drivers/video/tegra/host/dev.c +++ b/drivers/video/tegra/host/dev.c @@ -47,6 +47,7 @@ #define DRIVER_NAME "tegra_grhost" #define IFACE_NAME "nvhost" +#define TRACE_MAX_LENGTH 128U static int nvhost_major = NVHOST_MAJOR; static int nvhost_minor; @@ -74,6 +75,40 @@ struct nvhost_ctrl_userctx { u32 *mod_locks; }; +/* + * Write cmdbuf to ftrace output. Checks if cmdbuf contents should be output + * and mmaps the cmdbuf contents if required. + */ +static void trace_write_cmdbuf(const char *name, u32 mem_id, + u32 words, u32 offset) +{ + struct nvmap_handle_ref handle; + void *mem = NULL; + + if (nvhost_debug_trace_cmdbuf) { + handle.handle = nvmap_id_to_handle(mem_id); + mem = nvmap_mmap(&handle); + if (IS_ERR_OR_NULL(mem)) + mem = NULL; + }; + + trace_nvhost_channel_write_cmdbuf(name, mem_id, words, offset); + 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_channel_write_cmdbuf_data(name, mem_id, + min(words - i, TRACE_MAX_LENGTH), + 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; @@ -218,7 +253,8 @@ static ssize_t nvhost_channelwrite(struct file *filp, const char __user *buf, if (err) break; trace_nvhost_channel_write_submit(priv->ch->desc->name, - count, priv->hdr.num_cmdbufs, priv->hdr.num_relocs); + count, priv->hdr.num_cmdbufs, priv->hdr.num_relocs, + priv->hdr.syncpt_id, priv->hdr.syncpt_incrs); } else if (priv->hdr.num_cmdbufs) { struct nvhost_cmdbuf cmdbuf; consumed = sizeof(cmdbuf); @@ -228,7 +264,7 @@ static ssize_t nvhost_channelwrite(struct file *filp, const char __user *buf, err = -EFAULT; break; } - trace_nvhost_channel_write_cmdbuf(priv->ch->desc->name, + trace_write_cmdbuf(priv->ch->desc->name, cmdbuf.mem, cmdbuf.words, cmdbuf.offset); add_gather(priv, cmdbuf.mem, cmdbuf.words, cmdbuf.offset); @@ -407,7 +443,8 @@ static long nvhost_channelctl(struct file *filp, trace_nvhost_ioctl_channel_submit(priv->ch->desc->name, priv->hdr.submit_version, priv->hdr.num_cmdbufs, priv->hdr.num_relocs, - priv->hdr.num_waitchks); + priv->hdr.num_waitchks, + priv->hdr.syncpt_id, priv->hdr.syncpt_incrs); break; } case NVHOST_IOCTL_CHANNEL_GET_SYNCPOINTS: @@ -616,6 +653,8 @@ static int nvhost_ioctl_ctrl_module_regrdwr( void *values = args->values; u32 vals[64]; + trace_nvhost_ioctl_ctrl_module_regrdwr(args->id, + args->num_offsets, args->write); if (!(args->id < ctx->dev->nb_modules) || (num_offsets == 0)) return -EINVAL; |