summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/regops_gk20a.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2015-01-12 20:17:16 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-04-04 21:03:00 -0400
commit64039b3ae04229ea0642141bf9299dc1ead7a3aa (patch)
tree04e3cc8924b090371795435ef8869ddbc241b90e /drivers/gpu/nvgpu/gk20a/regops_gk20a.c
parent9e4e1a78747f473711cc6d5eddacf69ae68b401a (diff)
gpu: nvgpu: Do not panic if PMU/regops not supported
Fix panics when using regops when PMU is disabled, or when whitelists have not been defined. Bug 1592505 Change-Id: I316c98147c54be7b1114ad23049ce3a634d4805e Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/671841
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/regops_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/regops_gk20a.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c
index 04659bcf..11ab7bc3 100644
--- a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c
@@ -561,7 +561,8 @@ static bool check_whitelists(struct dbg_session_gk20a *dbg_s,
561 561
562 if (op->type == REGOP(TYPE_GLOBAL)) { 562 if (op->type == REGOP(TYPE_GLOBAL)) {
563 /* search global list */ 563 /* search global list */
564 valid = !!bsearch(&offset, 564 valid = g->ops.regops.get_global_whitelist_ranges &&
565 !!bsearch(&offset,
565 g->ops.regops.get_global_whitelist_ranges(), 566 g->ops.regops.get_global_whitelist_ranges(),
566 g->ops.regops.get_global_whitelist_ranges_count(), 567 g->ops.regops.get_global_whitelist_ranges_count(),
567 sizeof(*g->ops.regops.get_global_whitelist_ranges()), 568 sizeof(*g->ops.regops.get_global_whitelist_ranges()),
@@ -570,7 +571,8 @@ static bool check_whitelists(struct dbg_session_gk20a *dbg_s,
570 /* if debug session and channel is bound search context list */ 571 /* if debug session and channel is bound search context list */
571 if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) { 572 if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) {
572 /* binary search context list */ 573 /* binary search context list */
573 valid = !!bsearch(&offset, 574 valid = g->ops.regops.get_context_whitelist_ranges &&
575 !!bsearch(&offset,
574 g->ops.regops.get_context_whitelist_ranges(), 576 g->ops.regops.get_context_whitelist_ranges(),
575 g->ops.regops.get_context_whitelist_ranges_count(), 577 g->ops.regops.get_context_whitelist_ranges_count(),
576 sizeof(*g->ops.regops.get_context_whitelist_ranges()), 578 sizeof(*g->ops.regops.get_context_whitelist_ranges()),
@@ -579,7 +581,8 @@ static bool check_whitelists(struct dbg_session_gk20a *dbg_s,
579 581
580 /* if debug session and channel is bound search runcontrol list */ 582 /* if debug session and channel is bound search runcontrol list */
581 if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) { 583 if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) {
582 valid = linear_search(offset, 584 valid = g->ops.regops.get_runcontrol_whitelist &&
585 linear_search(offset,
583 g->ops.regops.get_runcontrol_whitelist(), 586 g->ops.regops.get_runcontrol_whitelist(),
584 g->ops.regops.get_runcontrol_whitelist_count()); 587 g->ops.regops.get_runcontrol_whitelist_count());
585 } 588 }
@@ -592,7 +595,8 @@ static bool check_whitelists(struct dbg_session_gk20a *dbg_s,
592 } 595 }
593 596
594 /* binary search context list */ 597 /* binary search context list */
595 valid = !!bsearch(&offset, 598 valid = g->ops.regops.get_context_whitelist_ranges &&
599 !!bsearch(&offset,
596 g->ops.regops.get_context_whitelist_ranges(), 600 g->ops.regops.get_context_whitelist_ranges(),
597 g->ops.regops.get_context_whitelist_ranges_count(), 601 g->ops.regops.get_context_whitelist_ranges_count(),
598 sizeof(*g->ops.regops.get_context_whitelist_ranges()), 602 sizeof(*g->ops.regops.get_context_whitelist_ranges()),
@@ -600,13 +604,15 @@ static bool check_whitelists(struct dbg_session_gk20a *dbg_s,
600 604
601 /* if debug session and channel is bound search runcontrol list */ 605 /* if debug session and channel is bound search runcontrol list */
602 if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) { 606 if ((!valid) && (!dbg_s->is_profiler && dbg_s->ch)) {
603 valid = linear_search(offset, 607 valid = g->ops.regops.get_runcontrol_whitelist &&
608 linear_search(offset,
604 g->ops.regops.get_runcontrol_whitelist(), 609 g->ops.regops.get_runcontrol_whitelist(),
605 g->ops.regops.get_runcontrol_whitelist_count()); 610 g->ops.regops.get_runcontrol_whitelist_count());
606 } 611 }
607 612
608 } else if (op->type == REGOP(TYPE_GR_CTX_QUAD)) { 613 } else if (op->type == REGOP(TYPE_GR_CTX_QUAD)) {
609 valid = linear_search(offset, 614 valid = g->ops.regops.get_qctl_whitelist &&
615 linear_search(offset,
610 g->ops.regops.get_qctl_whitelist(), 616 g->ops.regops.get_qctl_whitelist(),
611 g->ops.regops.get_qctl_whitelist_count()); 617 g->ops.regops.get_qctl_whitelist_count());
612 } 618 }