diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2016-03-15 22:06:43 -0400 |
---|---|---|
committer | Ken Adams <kadams@nvidia.com> | 2016-05-05 12:25:02 -0400 |
commit | 93678f571c323861458992de16d552ea7313e831 (patch) | |
tree | 7a1faae97be3a9be5f180b011d66075ab8a1541c /drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |
parent | 8beea96fad15724bc1fb7302668077617c9dbcee (diff) |
gpu: nvgpu: Add trace and debugfs for sched params
JIRA EVLR-244
JIRA EVLR-318
Change-Id: Ie95f42212dadcf2d0c1737eeb28812afb03b712f
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: http://git-master/r/1120603
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Ken Adams <kadams@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 66dfa48a..fa8ab5b1 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |||
@@ -2550,6 +2550,138 @@ struct channel_gk20a *gk20a_fifo_channel_from_hw_chid(struct gk20a *g, | |||
2550 | return g->fifo.channel + hw_chid; | 2550 | return g->fifo.channel + hw_chid; |
2551 | } | 2551 | } |
2552 | 2552 | ||
2553 | #ifdef CONFIG_DEBUG_FS | ||
2554 | static void *gk20a_fifo_sched_debugfs_seq_start( | ||
2555 | struct seq_file *s, loff_t *pos) | ||
2556 | { | ||
2557 | struct gk20a *g = s->private; | ||
2558 | struct fifo_gk20a *f = &g->fifo; | ||
2559 | |||
2560 | if (*pos >= f->num_channels) | ||
2561 | return NULL; | ||
2562 | |||
2563 | return &f->channel[*pos]; | ||
2564 | } | ||
2565 | |||
2566 | static void *gk20a_fifo_sched_debugfs_seq_next( | ||
2567 | struct seq_file *s, void *v, loff_t *pos) | ||
2568 | { | ||
2569 | struct gk20a *g = s->private; | ||
2570 | struct fifo_gk20a *f = &g->fifo; | ||
2571 | |||
2572 | ++(*pos); | ||
2573 | if (*pos >= f->num_channels) | ||
2574 | return NULL; | ||
2575 | |||
2576 | return &f->channel[*pos]; | ||
2577 | } | ||
2578 | |||
2579 | static void gk20a_fifo_sched_debugfs_seq_stop( | ||
2580 | struct seq_file *s, void *v) | ||
2581 | { | ||
2582 | } | ||
2583 | |||
2584 | static int gk20a_fifo_sched_debugfs_seq_show( | ||
2585 | struct seq_file *s, void *v) | ||
2586 | { | ||
2587 | struct gk20a *g = s->private; | ||
2588 | struct fifo_gk20a *f = &g->fifo; | ||
2589 | struct channel_gk20a *ch = v; | ||
2590 | struct tsg_gk20a *tsg = NULL; | ||
2591 | |||
2592 | struct fifo_engine_info_gk20a *engine_info; | ||
2593 | struct fifo_runlist_info_gk20a *runlist; | ||
2594 | u32 runlist_id; | ||
2595 | int ret = SEQ_SKIP; | ||
2596 | |||
2597 | engine_info = f->engine_info + ENGINE_GR_GK20A; | ||
2598 | runlist_id = engine_info->runlist_id; | ||
2599 | runlist = &f->runlist_info[runlist_id]; | ||
2600 | |||
2601 | if (ch == f->channel) { | ||
2602 | seq_puts(s, "chid tsgid pid timeslice timeout interleave preempt\n"); | ||
2603 | seq_puts(s, " (usecs) (msecs)\n"); | ||
2604 | ret = 0; | ||
2605 | } | ||
2606 | |||
2607 | if (!test_bit(ch->hw_chid, runlist->active_channels)) | ||
2608 | return ret; | ||
2609 | |||
2610 | if (gk20a_channel_get(ch)) { | ||
2611 | if (gk20a_is_channel_marked_as_tsg(ch)) | ||
2612 | tsg = &f->tsg[ch->tsgid]; | ||
2613 | |||
2614 | seq_printf(s, "%-8d %-8d %-8d %-9d %-8d %-10d %-8d\n", | ||
2615 | ch->hw_chid, | ||
2616 | ch->tsgid, | ||
2617 | ch->pid, | ||
2618 | tsg ? tsg->timeslice_us : ch->timeslice_us, | ||
2619 | ch->timeout_ms_max, | ||
2620 | ch->interleave_level, | ||
2621 | ch->ch_ctx.gr_ctx ? | ||
2622 | ch->ch_ctx.gr_ctx->preempt_mode : -1); | ||
2623 | gk20a_channel_put(ch); | ||
2624 | } | ||
2625 | return 0; | ||
2626 | } | ||
2627 | |||
2628 | const struct seq_operations gk20a_fifo_sched_debugfs_seq_ops = { | ||
2629 | .start = gk20a_fifo_sched_debugfs_seq_start, | ||
2630 | .next = gk20a_fifo_sched_debugfs_seq_next, | ||
2631 | .stop = gk20a_fifo_sched_debugfs_seq_stop, | ||
2632 | .show = gk20a_fifo_sched_debugfs_seq_show | ||
2633 | }; | ||
2634 | |||
2635 | static int gk20a_fifo_sched_debugfs_open(struct inode *inode, | ||
2636 | struct file *file) | ||
2637 | { | ||
2638 | int err; | ||
2639 | |||
2640 | if (!capable(CAP_SYS_ADMIN)) | ||
2641 | return -EPERM; | ||
2642 | |||
2643 | err = seq_open(file, &gk20a_fifo_sched_debugfs_seq_ops); | ||
2644 | if (err) | ||
2645 | return err; | ||
2646 | |||
2647 | gk20a_dbg(gpu_dbg_info, "i_private=%p", inode->i_private); | ||
2648 | |||
2649 | ((struct seq_file *)file->private_data)->private = inode->i_private; | ||
2650 | return 0; | ||
2651 | }; | ||
2652 | |||
2653 | /* | ||
2654 | * The file operations structure contains our open function along with | ||
2655 | * set of the canned seq_ ops. | ||
2656 | */ | ||
2657 | const struct file_operations gk20a_fifo_sched_debugfs_fops = { | ||
2658 | .owner = THIS_MODULE, | ||
2659 | .open = gk20a_fifo_sched_debugfs_open, | ||
2660 | .read = seq_read, | ||
2661 | .llseek = seq_lseek, | ||
2662 | .release = seq_release | ||
2663 | }; | ||
2664 | |||
2665 | void gk20a_fifo_debugfs_init(struct device *dev) | ||
2666 | { | ||
2667 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
2668 | struct gk20a *g = get_gk20a(dev); | ||
2669 | |||
2670 | struct dentry *gpu_root = platform->debugfs; | ||
2671 | struct dentry *fifo_root; | ||
2672 | |||
2673 | fifo_root = debugfs_create_dir("fifo", gpu_root); | ||
2674 | if (IS_ERR_OR_NULL(fifo_root)) | ||
2675 | return; | ||
2676 | |||
2677 | gk20a_dbg(gpu_dbg_info, "g=%p", g); | ||
2678 | |||
2679 | debugfs_create_file("sched", 0600, fifo_root, g, | ||
2680 | &gk20a_fifo_sched_debugfs_fops); | ||
2681 | |||
2682 | } | ||
2683 | #endif /* CONFIG_DEBUG_FS */ | ||
2684 | |||
2553 | void gk20a_init_fifo(struct gpu_ops *gops) | 2685 | void gk20a_init_fifo(struct gpu_ops *gops) |
2554 | { | 2686 | { |
2555 | gk20a_init_channel(gops); | 2687 | gk20a_init_channel(gops); |