diff options
author | Seema Khowala <seemaj@nvidia.com> | 2017-02-28 14:03:09 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-09 15:23:29 -0500 |
commit | 4deb494ad114088f5253d02d9ec31f9aaeb2778a (patch) | |
tree | 7f13dee2f64dd4ebe121aaf820d16ec0aae529ff /drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |
parent | 2caea7576a42c5f6593c58229d51f74517e0c60c (diff) |
gpu: nvgpu: debug dump enablement for t19x
Fifo ops added for dumping channel & ramfc status
and pbdma & engine status.
Change-Id: Icc739f4f05f0864721954489517fefdfa2fa608a
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/1302369
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 35d56ce4..b2efc1fa 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |||
@@ -3554,6 +3554,191 @@ void gk20a_fifo_debugfs_init(struct device *dev) | |||
3554 | } | 3554 | } |
3555 | #endif /* CONFIG_DEBUG_FS */ | 3555 | #endif /* CONFIG_DEBUG_FS */ |
3556 | 3556 | ||
3557 | static const char * const ccsr_chan_status_str[] = { | ||
3558 | "idle", | ||
3559 | "pending", | ||
3560 | "pending_ctx_reload", | ||
3561 | "pending_acquire", | ||
3562 | "pending_acq_ctx_reload", | ||
3563 | "on_pbdma", | ||
3564 | "on_pbdma_and_eng", | ||
3565 | "on_eng", | ||
3566 | "on_eng_pending_acquire", | ||
3567 | "on_eng_pending", | ||
3568 | "on_pbdma_ctx_reload", | ||
3569 | "on_pbdma_and_eng_ctx_reload", | ||
3570 | "on_eng_ctx_reload", | ||
3571 | "on_eng_pending_ctx_reload", | ||
3572 | "on_eng_pending_acq_ctx_reload", | ||
3573 | }; | ||
3574 | |||
3575 | const char * const pbdma_chan_eng_ctx_status_str[] = { | ||
3576 | "invalid", | ||
3577 | "valid", | ||
3578 | "NA", | ||
3579 | "NA", | ||
3580 | "NA", | ||
3581 | "load", | ||
3582 | "save", | ||
3583 | "switch", | ||
3584 | }; | ||
3585 | |||
3586 | static const char * const not_found_str[] = { | ||
3587 | "NOT FOUND" | ||
3588 | }; | ||
3589 | |||
3590 | const char *gk20a_decode_ccsr_chan_status(u32 index) | ||
3591 | { | ||
3592 | if (index >= ARRAY_SIZE(ccsr_chan_status_str)) | ||
3593 | return not_found_str[0]; | ||
3594 | else | ||
3595 | return ccsr_chan_status_str[index]; | ||
3596 | } | ||
3597 | |||
3598 | const char *gk20a_decode_pbdma_chan_eng_ctx_status(u32 index) | ||
3599 | { | ||
3600 | if (index >= ARRAY_SIZE(pbdma_chan_eng_ctx_status_str)) | ||
3601 | return not_found_str[0]; | ||
3602 | else | ||
3603 | return pbdma_chan_eng_ctx_status_str[index]; | ||
3604 | } | ||
3605 | |||
3606 | void gk20a_dump_channel_status_ramfc(struct gk20a *g, | ||
3607 | struct gk20a_debug_output *o, | ||
3608 | u32 hw_chid, | ||
3609 | struct ch_state *ch_state) | ||
3610 | { | ||
3611 | u32 channel = gk20a_readl(g, ccsr_channel_r(hw_chid)); | ||
3612 | u32 status = ccsr_channel_status_v(channel); | ||
3613 | u32 syncpointa, syncpointb; | ||
3614 | u32 *inst_mem; | ||
3615 | struct channel_gk20a *c = g->fifo.channel + hw_chid; | ||
3616 | struct nvgpu_semaphore_int *hw_sema = NULL; | ||
3617 | |||
3618 | if (c->hw_sema) | ||
3619 | hw_sema = c->hw_sema; | ||
3620 | |||
3621 | if (!ch_state) | ||
3622 | return; | ||
3623 | |||
3624 | inst_mem = &ch_state->inst_block[0]; | ||
3625 | |||
3626 | syncpointa = inst_mem[ram_fc_syncpointa_w()]; | ||
3627 | syncpointb = inst_mem[ram_fc_syncpointb_w()]; | ||
3628 | |||
3629 | gk20a_debug_output(o, "%d-%s, pid %d, refs: %d: ", hw_chid, | ||
3630 | dev_name(g->dev), | ||
3631 | ch_state->pid, | ||
3632 | ch_state->refs); | ||
3633 | gk20a_debug_output(o, "channel status: %s in use %s %s\n", | ||
3634 | ccsr_channel_enable_v(channel) ? "" : "not", | ||
3635 | gk20a_decode_ccsr_chan_status(status), | ||
3636 | ccsr_channel_busy_v(channel) ? "busy" : "not busy"); | ||
3637 | gk20a_debug_output(o, "RAMFC : TOP: %016llx PUT: %016llx GET: %016llx " | ||
3638 | "FETCH: %016llx\nHEADER: %08x COUNT: %08x\n" | ||
3639 | "SYNCPOINT %08x %08x SEMAPHORE %08x %08x %08x %08x\n", | ||
3640 | (u64)inst_mem[ram_fc_pb_top_level_get_w()] + | ||
3641 | ((u64)inst_mem[ram_fc_pb_top_level_get_hi_w()] << 32ULL), | ||
3642 | (u64)inst_mem[ram_fc_pb_put_w()] + | ||
3643 | ((u64)inst_mem[ram_fc_pb_put_hi_w()] << 32ULL), | ||
3644 | (u64)inst_mem[ram_fc_pb_get_w()] + | ||
3645 | ((u64)inst_mem[ram_fc_pb_get_hi_w()] << 32ULL), | ||
3646 | (u64)inst_mem[ram_fc_pb_fetch_w()] + | ||
3647 | ((u64)inst_mem[ram_fc_pb_fetch_hi_w()] << 32ULL), | ||
3648 | inst_mem[ram_fc_pb_header_w()], | ||
3649 | inst_mem[ram_fc_pb_count_w()], | ||
3650 | syncpointa, | ||
3651 | syncpointb, | ||
3652 | inst_mem[ram_fc_semaphorea_w()], | ||
3653 | inst_mem[ram_fc_semaphoreb_w()], | ||
3654 | inst_mem[ram_fc_semaphorec_w()], | ||
3655 | inst_mem[ram_fc_semaphored_w()]); | ||
3656 | if (hw_sema) | ||
3657 | gk20a_debug_output(o, "SEMA STATE: value: 0x%08x " | ||
3658 | "next_val: 0x%08x addr: 0x%010llx\n", | ||
3659 | readl(hw_sema->value), | ||
3660 | atomic_read(&hw_sema->next_value), | ||
3661 | nvgpu_hw_sema_addr(hw_sema)); | ||
3662 | |||
3663 | #ifdef CONFIG_TEGRA_GK20A | ||
3664 | if ((pbdma_syncpointb_op_v(syncpointb) == pbdma_syncpointb_op_wait_v()) | ||
3665 | && (pbdma_syncpointb_wait_switch_v(syncpointb) == | ||
3666 | pbdma_syncpointb_wait_switch_en_v())) | ||
3667 | gk20a_debug_output(o, "%s on syncpt %u (%s) val %u\n", | ||
3668 | (status == 3 || status == 8) ? "Waiting" : "Waited", | ||
3669 | pbdma_syncpointb_syncpt_index_v(syncpointb), | ||
3670 | nvhost_syncpt_get_name(g->host1x_dev, | ||
3671 | pbdma_syncpointb_syncpt_index_v(syncpointb)), | ||
3672 | pbdma_syncpointa_payload_v(syncpointa)); | ||
3673 | #endif | ||
3674 | |||
3675 | gk20a_debug_output(o, "\n"); | ||
3676 | } | ||
3677 | |||
3678 | void gk20a_dump_pbdma_status(struct gk20a *g, | ||
3679 | struct gk20a_debug_output *o) | ||
3680 | { | ||
3681 | u32 i, host_num_pbdma; | ||
3682 | |||
3683 | host_num_pbdma = nvgpu_get_litter_value(g, GPU_LIT_HOST_NUM_PBDMA); | ||
3684 | |||
3685 | for (i = 0; i < host_num_pbdma; i++) { | ||
3686 | u32 status = gk20a_readl(g, fifo_pbdma_status_r(i)); | ||
3687 | u32 chan_status = fifo_pbdma_status_chan_status_v(status); | ||
3688 | |||
3689 | gk20a_debug_output(o, "%s pbdma %d: ", dev_name(g->dev), i); | ||
3690 | gk20a_debug_output(o, | ||
3691 | "id: %d (%s), next_id: %d (%s) chan status: %s\n", | ||
3692 | fifo_pbdma_status_id_v(status), | ||
3693 | fifo_pbdma_status_id_type_v(status) ? | ||
3694 | "tsg" : "channel", | ||
3695 | fifo_pbdma_status_next_id_v(status), | ||
3696 | fifo_pbdma_status_next_id_type_v(status) ? | ||
3697 | "tsg" : "channel", | ||
3698 | gk20a_decode_pbdma_chan_eng_ctx_status(chan_status)); | ||
3699 | gk20a_debug_output(o, "PUT: %016llx GET: %016llx " | ||
3700 | "FETCH: %08x HEADER: %08x\n", | ||
3701 | (u64)gk20a_readl(g, pbdma_put_r(i)) + | ||
3702 | ((u64)gk20a_readl(g, pbdma_put_hi_r(i)) << 32ULL), | ||
3703 | (u64)gk20a_readl(g, pbdma_get_r(i)) + | ||
3704 | ((u64)gk20a_readl(g, pbdma_get_hi_r(i)) << 32ULL), | ||
3705 | gk20a_readl(g, pbdma_gp_fetch_r(i)), | ||
3706 | gk20a_readl(g, pbdma_pb_header_r(i))); | ||
3707 | } | ||
3708 | gk20a_debug_output(o, "\n"); | ||
3709 | } | ||
3710 | |||
3711 | void gk20a_dump_eng_status(struct gk20a *g, | ||
3712 | struct gk20a_debug_output *o) | ||
3713 | { | ||
3714 | u32 i, host_num_engines; | ||
3715 | |||
3716 | host_num_engines = nvgpu_get_litter_value(g, GPU_LIT_HOST_NUM_ENGINES); | ||
3717 | |||
3718 | for (i = 0; i < host_num_engines; i++) { | ||
3719 | u32 status = gk20a_readl(g, fifo_engine_status_r(i)); | ||
3720 | u32 ctx_status = fifo_engine_status_ctx_status_v(status); | ||
3721 | |||
3722 | gk20a_debug_output(o, "%s eng %d: ", dev_name(g->dev), i); | ||
3723 | gk20a_debug_output(o, | ||
3724 | "id: %d (%s), next_id: %d (%s), ctx status: %s ", | ||
3725 | fifo_engine_status_id_v(status), | ||
3726 | fifo_engine_status_id_type_v(status) ? | ||
3727 | "tsg" : "channel", | ||
3728 | fifo_engine_status_next_id_v(status), | ||
3729 | fifo_engine_status_next_id_type_v(status) ? | ||
3730 | "tsg" : "channel", | ||
3731 | gk20a_decode_pbdma_chan_eng_ctx_status(ctx_status)); | ||
3732 | |||
3733 | if (fifo_engine_status_faulted_v(status)) | ||
3734 | gk20a_debug_output(o, "faulted "); | ||
3735 | if (fifo_engine_status_engine_v(status)) | ||
3736 | gk20a_debug_output(o, "busy "); | ||
3737 | gk20a_debug_output(o, "\n"); | ||
3738 | } | ||
3739 | gk20a_debug_output(o, "\n"); | ||
3740 | } | ||
3741 | |||
3557 | void gk20a_init_fifo(struct gpu_ops *gops) | 3742 | void gk20a_init_fifo(struct gpu_ops *gops) |
3558 | { | 3743 | { |
3559 | gk20a_init_channel(gops); | 3744 | gk20a_init_channel(gops); |
@@ -3578,4 +3763,7 @@ void gk20a_init_fifo(struct gpu_ops *gops) | |||
3578 | gops->fifo.get_tsg_runlist_entry = gk20a_get_tsg_runlist_entry; | 3763 | gops->fifo.get_tsg_runlist_entry = gk20a_get_tsg_runlist_entry; |
3579 | gops->fifo.get_ch_runlist_entry = gk20a_get_ch_runlist_entry; | 3764 | gops->fifo.get_ch_runlist_entry = gk20a_get_ch_runlist_entry; |
3580 | gops->fifo.is_fault_engine_subid_gpc = gk20a_is_fault_engine_subid_gpc; | 3765 | gops->fifo.is_fault_engine_subid_gpc = gk20a_is_fault_engine_subid_gpc; |
3766 | gops->fifo.dump_pbdma_status = gk20a_dump_pbdma_status; | ||
3767 | gops->fifo.dump_eng_status = gk20a_dump_eng_status; | ||
3768 | gops->fifo.dump_channel_status_ramfc = gk20a_dump_channel_status_ramfc; | ||
3581 | } | 3769 | } |