diff options
author | Kevin Huang <kevinh@nvidia.com> | 2014-05-09 14:41:26 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:11:06 -0400 |
commit | 1d9eba07c58b0a30f479b233371c939180a0e419 (patch) | |
tree | 1b4081a723834d8b295a147e85f6d7b7b205a88c /drivers/gpu/nvgpu/gk20a/regops_gk20a.c | |
parent | 5cd313e20221c93008f1d56ac223d6e08966505e (diff) |
gpu: nvgpu: add HAL for regops
Bug 1500195
Change-Id: I5545d1a95a58e7daa5a74cc20f3fc6828774fc42
Signed-off-by: Kevin Huang <kevinh@nvidia.com>
Reviewed-on: http://git-master/r/488507
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/regops_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/regops_gk20a.c | 146 |
1 files changed, 117 insertions, 29 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c index 4a115fb1..87a95afe 100644 --- a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c | |||
@@ -29,11 +29,6 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | struct regop_offset_range { | ||
33 | u32 base:24; | ||
34 | u32 count:8; | ||
35 | }; | ||
36 | |||
37 | static int regop_bsearch_range_cmp(const void *pkey, const void *pelem) | 32 | static int regop_bsearch_range_cmp(const void *pkey, const void *pelem) |
38 | { | 33 | { |
39 | u32 key = *(u32 *)pkey; | 34 | u32 key = *(u32 *)pkey; |
@@ -551,31 +546,32 @@ static int validate_reg_op_info(struct dbg_session_gk20a *dbg_s, | |||
551 | static bool check_whitelists(struct dbg_session_gk20a *dbg_s, | 546 | static bool check_whitelists(struct dbg_session_gk20a *dbg_s, |
552 | struct nvhost_dbg_gpu_reg_op *op, u32 offset) | 547 | struct nvhost_dbg_gpu_reg_op *op, u32 offset) |
553 | { | 548 | { |
549 | struct gk20a *g = dbg_s->g; | ||
554 | bool valid = false; | 550 | bool valid = false; |
555 | 551 | ||
556 | if (op->type == REGOP(TYPE_GLOBAL)) { | 552 | if (op->type == REGOP(TYPE_GLOBAL)) { |
557 | /* search global list */ | 553 | /* search global list */ |
558 | valid = !!bsearch(&offset, | 554 | valid = !!bsearch(&offset, |
559 | gk20a_global_whitelist_ranges, | 555 | g->ops.regops.get_global_whitelist_ranges(), |
560 | gk20a_global_whitelist_ranges_count, | 556 | g->ops.regops.get_global_whitelist_ranges_count(), |
561 | sizeof(*gk20a_global_whitelist_ranges), | 557 | sizeof(*g->ops.regops.get_global_whitelist_ranges()), |
562 | regop_bsearch_range_cmp); | 558 | regop_bsearch_range_cmp); |
563 | 559 | ||
564 | /* if debug session and channel is bound search context list */ | 560 | /* if debug session and channel is bound search context list */ |
565 | if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) { | 561 | if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) { |
566 | /* binary search context list */ | 562 | /* binary search context list */ |
567 | valid = !!bsearch(&offset, | 563 | valid = !!bsearch(&offset, |
568 | gk20a_context_whitelist_ranges, | 564 | g->ops.regops.get_context_whitelist_ranges(), |
569 | gk20a_context_whitelist_ranges_count, | 565 | g->ops.regops.get_context_whitelist_ranges_count(), |
570 | sizeof(*gk20a_context_whitelist_ranges), | 566 | sizeof(*g->ops.regops.get_context_whitelist_ranges()), |
571 | regop_bsearch_range_cmp); | 567 | regop_bsearch_range_cmp); |
572 | } | 568 | } |
573 | 569 | ||
574 | /* if debug session and channel is bound search runcontrol list */ | 570 | /* if debug session and channel is bound search runcontrol list */ |
575 | if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) { | 571 | if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) { |
576 | valid = linear_search(offset, | 572 | valid = linear_search(offset, |
577 | gk20a_runcontrol_whitelist, | 573 | g->ops.regops.get_runcontrol_whitelist(), |
578 | gk20a_runcontrol_whitelist_count); | 574 | g->ops.regops.get_runcontrol_whitelist_count()); |
579 | } | 575 | } |
580 | } else if (op->type == REGOP(TYPE_GR_CTX)) { | 576 | } else if (op->type == REGOP(TYPE_GR_CTX)) { |
581 | /* it's a context-relative op */ | 577 | /* it's a context-relative op */ |
@@ -587,22 +583,22 @@ static bool check_whitelists(struct dbg_session_gk20a *dbg_s, | |||
587 | 583 | ||
588 | /* binary search context list */ | 584 | /* binary search context list */ |
589 | valid = !!bsearch(&offset, | 585 | valid = !!bsearch(&offset, |
590 | gk20a_context_whitelist_ranges, | 586 | g->ops.regops.get_context_whitelist_ranges(), |
591 | gk20a_context_whitelist_ranges_count, | 587 | g->ops.regops.get_context_whitelist_ranges_count(), |
592 | sizeof(*gk20a_context_whitelist_ranges), | 588 | sizeof(*g->ops.regops.get_context_whitelist_ranges()), |
593 | regop_bsearch_range_cmp); | 589 | regop_bsearch_range_cmp); |
594 | 590 | ||
595 | /* if debug session and channel is bound search runcontrol list */ | 591 | /* if debug session and channel is bound search runcontrol list */ |
596 | if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) { | 592 | if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) { |
597 | valid = linear_search(offset, | 593 | valid = linear_search(offset, |
598 | gk20a_runcontrol_whitelist, | 594 | g->ops.regops.get_runcontrol_whitelist(), |
599 | gk20a_runcontrol_whitelist_count); | 595 | g->ops.regops.get_runcontrol_whitelist_count()); |
600 | } | 596 | } |
601 | 597 | ||
602 | } else if (op->type == REGOP(TYPE_GR_CTX_QUAD)) { | 598 | } else if (op->type == REGOP(TYPE_GR_CTX_QUAD)) { |
603 | valid = linear_search(offset, | 599 | valid = linear_search(offset, |
604 | gk20a_qctl_whitelist, | 600 | g->ops.regops.get_qctl_whitelist(), |
605 | gk20a_qctl_whitelist_count); | 601 | g->ops.regops.get_qctl_whitelist_count()); |
606 | } | 602 | } |
607 | 603 | ||
608 | return valid; | 604 | return valid; |
@@ -692,13 +688,105 @@ static bool validate_reg_ops(struct dbg_session_gk20a *dbg_s, | |||
692 | } | 688 | } |
693 | 689 | ||
694 | /* exported for tools like cyclestats, etc */ | 690 | /* exported for tools like cyclestats, etc */ |
695 | bool is_bar0_global_offset_whitelisted_gk20a(u32 offset) | 691 | bool is_bar0_global_offset_whitelisted_gk20a(struct gk20a *g, u32 offset) |
696 | { | 692 | { |
697 | |||
698 | bool valid = !!bsearch(&offset, | 693 | bool valid = !!bsearch(&offset, |
699 | gk20a_global_whitelist_ranges, | 694 | g->ops.regops.get_global_whitelist_ranges(), |
700 | gk20a_global_whitelist_ranges_count, | 695 | g->ops.regops.get_global_whitelist_ranges_count(), |
701 | sizeof(*gk20a_global_whitelist_ranges), | 696 | sizeof(*g->ops.regops.get_global_whitelist_ranges()), |
702 | regop_bsearch_range_cmp); | 697 | regop_bsearch_range_cmp); |
703 | return valid; | 698 | return valid; |
704 | } | 699 | } |
700 | |||
701 | const struct regop_offset_range *gk20a_get_global_whitelist_ranges(void) | ||
702 | { | ||
703 | return gk20a_global_whitelist_ranges; | ||
704 | } | ||
705 | |||
706 | int gk20a_get_global_whitelist_ranges_count(void) | ||
707 | { | ||
708 | return gk20a_global_whitelist_ranges_count; | ||
709 | } | ||
710 | |||
711 | const struct regop_offset_range *gk20a_get_context_whitelist_ranges(void) | ||
712 | { | ||
713 | return gk20a_context_whitelist_ranges; | ||
714 | } | ||
715 | |||
716 | int gk20a_get_context_whitelist_ranges_count(void) | ||
717 | { | ||
718 | return gk20a_context_whitelist_ranges_count; | ||
719 | } | ||
720 | |||
721 | const u32 *gk20a_get_runcontrol_whitelist(void) | ||
722 | { | ||
723 | return gk20a_runcontrol_whitelist; | ||
724 | } | ||
725 | |||
726 | int gk20a_get_runcontrol_whitelist_count(void) | ||
727 | { | ||
728 | return gk20a_runcontrol_whitelist_count; | ||
729 | } | ||
730 | |||
731 | const struct regop_offset_range *gk20a_get_runcontrol_whitelist_ranges(void) | ||
732 | { | ||
733 | return gk20a_runcontrol_whitelist_ranges; | ||
734 | } | ||
735 | |||
736 | int gk20a_get_runcontrol_whitelist_ranges_count(void) | ||
737 | { | ||
738 | return gk20a_runcontrol_whitelist_ranges_count; | ||
739 | } | ||
740 | |||
741 | const u32 *gk20a_get_qctl_whitelist(void) | ||
742 | { | ||
743 | return gk20a_qctl_whitelist; | ||
744 | } | ||
745 | |||
746 | int gk20a_get_qctl_whitelist_count(void) | ||
747 | { | ||
748 | return gk20a_qctl_whitelist_count; | ||
749 | } | ||
750 | |||
751 | const struct regop_offset_range *gk20a_get_qctl_whitelist_ranges(void) | ||
752 | { | ||
753 | return gk20a_qctl_whitelist_ranges; | ||
754 | } | ||
755 | |||
756 | int gk20a_get_qctl_whitelist_ranges_count(void) | ||
757 | { | ||
758 | return gk20a_qctl_whitelist_ranges_count; | ||
759 | } | ||
760 | |||
761 | void gk20a_init_regops(struct gpu_ops *gops) | ||
762 | { | ||
763 | gops->regops.get_global_whitelist_ranges = | ||
764 | gk20a_get_global_whitelist_ranges; | ||
765 | gops->regops.get_global_whitelist_ranges_count = | ||
766 | gk20a_get_global_whitelist_ranges_count; | ||
767 | |||
768 | gops->regops.get_context_whitelist_ranges = | ||
769 | gk20a_get_context_whitelist_ranges; | ||
770 | gops->regops.get_context_whitelist_ranges_count = | ||
771 | gk20a_get_context_whitelist_ranges_count; | ||
772 | |||
773 | gops->regops.get_runcontrol_whitelist = | ||
774 | gk20a_get_runcontrol_whitelist; | ||
775 | gops->regops.get_runcontrol_whitelist_count = | ||
776 | gk20a_get_runcontrol_whitelist_count; | ||
777 | |||
778 | gops->regops.get_runcontrol_whitelist_ranges = | ||
779 | gk20a_get_runcontrol_whitelist_ranges; | ||
780 | gops->regops.get_runcontrol_whitelist_ranges_count = | ||
781 | gk20a_get_runcontrol_whitelist_ranges_count; | ||
782 | |||
783 | gops->regops.get_qctl_whitelist = | ||
784 | gk20a_get_qctl_whitelist; | ||
785 | gops->regops.get_qctl_whitelist_count = | ||
786 | gk20a_get_qctl_whitelist_count; | ||
787 | |||
788 | gops->regops.get_qctl_whitelist_ranges = | ||
789 | gk20a_get_qctl_whitelist_ranges; | ||
790 | gops->regops.get_qctl_whitelist_ranges_count = | ||
791 | gk20a_get_qctl_whitelist_ranges_count; | ||
792 | } | ||