summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Long <scottl@nvidia.com>2018-08-31 18:43:24 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-09-04 13:54:24 -0400
commita18f364fd28cf6a19edcb55b22a9b458d29a826d (patch)
tree863e2887e79cce82e6e475c68cb2817c82bd0e05
parentcf394f82d47901a0ea981e9229db5b51bc05a81a (diff)
gpu: nvgpu: fix various MISRA 10.1 bool violations
This patch corrects a handful of MISRA 10.1 violations involving illegal arithmetic operations (e.g. bitwise OR) on boolean values: * fix to status handling in regops validation code * fix to debugger event handling in gr code * fix to entries_left tracking in runlist construct code * fix to verbose channel dumping and reset tracking in fifo code JIRA NVGPU-650 Change-Id: I3c3d9123b5a0e08fc936d0e63d51de99fc310ade Signed-off-by: Scott Long <scottl@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1810957 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c19
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c7
-rw-r--r--drivers/gpu/nvgpu/gk20a/regops_gk20a.c11
3 files changed, 22 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 20fb51e7..e03c5da8 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -1450,7 +1450,9 @@ bool gk20a_fifo_error_tsg(struct gk20a *g,
1450 nvgpu_rwsem_down_read(&tsg->ch_list_lock); 1450 nvgpu_rwsem_down_read(&tsg->ch_list_lock);
1451 nvgpu_list_for_each_entry(ch, &tsg->ch_list, channel_gk20a, ch_entry) { 1451 nvgpu_list_for_each_entry(ch, &tsg->ch_list, channel_gk20a, ch_entry) {
1452 if (gk20a_channel_get(ch)) { 1452 if (gk20a_channel_get(ch)) {
1453 verbose |= gk20a_fifo_error_ch(g, ch); 1453 if (gk20a_fifo_error_ch(g, ch)) {
1454 verbose = true;
1455 }
1454 gk20a_channel_put(ch); 1456 gk20a_channel_put(ch);
1455 } 1457 }
1456 } 1458 }
@@ -2291,7 +2293,9 @@ bool gk20a_fifo_check_tsg_ctxsw_timeout(struct tsg_gk20a *tsg,
2291 if (gk20a_channel_get(ch)) { 2293 if (gk20a_channel_get(ch)) {
2292 ch->g->ops.fifo.set_error_notifier(ch, 2294 ch->g->ops.fifo.set_error_notifier(ch,
2293 NVGPU_ERR_NOTIFIER_FIFO_ERROR_IDLE_TIMEOUT); 2295 NVGPU_ERR_NOTIFIER_FIFO_ERROR_IDLE_TIMEOUT);
2294 *verbose |= ch->timeout_debug_dump; 2296 if (ch->timeout_debug_dump) {
2297 *verbose = true;
2298 }
2295 gk20a_channel_put(ch); 2299 gk20a_channel_put(ch);
2296 } 2300 }
2297 } 2301 }
@@ -2400,9 +2404,9 @@ static u32 fifo_error_isr(struct gk20a *g, u32 fifo_intr)
2400 } 2404 }
2401 2405
2402 if (fifo_intr & fifo_intr_0_mmu_fault_pending_f()) { 2406 if (fifo_intr & fifo_intr_0_mmu_fault_pending_f()) {
2403 print_channel_reset_log |= 2407 if (gk20a_fifo_handle_mmu_fault(g, 0, ~(u32)0, false)) {
2404 gk20a_fifo_handle_mmu_fault(g, 0, 2408 print_channel_reset_log = true;
2405 ~(u32)0, false); 2409 }
2406 handled |= fifo_intr_0_mmu_fault_pending_f(); 2410 handled |= fifo_intr_0_mmu_fault_pending_f();
2407 } 2411 }
2408 2412
@@ -3241,8 +3245,9 @@ u32 *gk20a_runlist_construct_locked(struct fifo_gk20a *f,
3241 skip_next = true; 3245 skip_next = true;
3242 } 3246 }
3243 3247
3244 if (!(*entries_left)) 3248 if (*entries_left == 0U) {
3245 return NULL; 3249 return NULL;
3250 }
3246 3251
3247 /* add TSG entry */ 3252 /* add TSG entry */
3248 nvgpu_log_info(g, "add TSG %d to runlist", tsg->tsgid); 3253 nvgpu_log_info(g, "add TSG %d to runlist", tsg->tsgid);
@@ -3261,7 +3266,7 @@ u32 *gk20a_runlist_construct_locked(struct fifo_gk20a *f,
3261 runlist->active_channels)) 3266 runlist->active_channels))
3262 continue; 3267 continue;
3263 3268
3264 if (!(*entries_left)) { 3269 if (*entries_left == 0U) {
3265 nvgpu_rwsem_up_read(&tsg->ch_list_lock); 3270 nvgpu_rwsem_up_read(&tsg->ch_list_lock);
3266 return NULL; 3271 return NULL;
3267 } 3272 }
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index ead5d34a..39d6879b 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -5583,11 +5583,12 @@ int gr_gk20a_handle_sm_exception(struct gk20a *g, u32 gpc, u32 tpc, u32 sm,
5583 } 5583 }
5584 } 5584 }
5585 5585
5586 if (ignore_debugger) 5586 if (ignore_debugger) {
5587 nvgpu_log(g, gpu_dbg_intr | gpu_dbg_gpu_dbg, 5587 nvgpu_log(g, gpu_dbg_intr | gpu_dbg_gpu_dbg,
5588 "ignore_debugger set, skipping event posting"); 5588 "ignore_debugger set, skipping event posting");
5589 else 5589 } else {
5590 *post_event |= true; 5590 *post_event = true;
5591 }
5591 5592
5592 return ret; 5593 return ret;
5593} 5594}
diff --git a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c
index cd3fe2f7..26ba944a 100644
--- a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c
@@ -404,7 +404,6 @@ static bool validate_reg_ops(struct dbg_session_gk20a *dbg_s,
404 u32 op_count) 404 u32 op_count)
405{ 405{
406 u32 i; 406 u32 i;
407 int err;
408 bool ok = true; 407 bool ok = true;
409 struct gk20a *g = dbg_s->g; 408 struct gk20a *g = dbg_s->g;
410 409
@@ -412,8 +411,9 @@ static bool validate_reg_ops(struct dbg_session_gk20a *dbg_s,
412 * a separate error code if needed */ 411 * a separate error code if needed */
413 for (i = 0; i < op_count; i++) { 412 for (i = 0; i < op_count; i++) {
414 413
415 err = validate_reg_op_info(dbg_s, &ops[i]); 414 if (validate_reg_op_info(dbg_s, &ops[i]) != 0) {
416 ok &= !err; 415 ok = false;
416 }
417 417
418 if (reg_op_is_gr_ctx(ops[i].type)) { 418 if (reg_op_is_gr_ctx(ops[i].type)) {
419 if (reg_op_is_read(ops[i].op)) 419 if (reg_op_is_read(ops[i].op))
@@ -424,8 +424,9 @@ static bool validate_reg_ops(struct dbg_session_gk20a *dbg_s,
424 424
425 /* if "allow_all" flag enabled, dont validate offset */ 425 /* if "allow_all" flag enabled, dont validate offset */
426 if (!g->allow_all) { 426 if (!g->allow_all) {
427 err = validate_reg_op_offset(dbg_s, &ops[i]); 427 if (validate_reg_op_offset(dbg_s, &ops[i]) != 0) {
428 ok &= !err; 428 ok = false;
429 }
429 } 430 }
430 } 431 }
431 432