diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2018-07-03 17:00:40 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-07-11 04:43:26 -0400 |
commit | a801c897df1e5e7ac498e1531ce4bbdabdca1c3d (patch) | |
tree | c461329d88878803636a268844a7a05acc2ae1d5 /drivers/gpu/nvgpu/gv11b/fb_gv11b.c | |
parent | 572fba2c52a6d63dbc785b48ad845e55f0b7eac0 (diff) |
gpu: nvgpu: Simplify FB hub intr enable
Hard code flags for enabling and disabling FB hub interrupts.
JIRA NVGPU-714
Change-Id: I806ef443cb9e27e221d407d633ca91d8fb40d075
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1769853
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b/fb_gv11b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/fb_gv11b.c | 143 |
1 files changed, 26 insertions, 117 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/fb_gv11b.c b/drivers/gpu/nvgpu/gv11b/fb_gv11b.c index d6e621eb..2c2c4898 100644 --- a/drivers/gpu/nvgpu/gv11b/fb_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/fb_gv11b.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include "gk20a/gk20a.h" | 33 | #include "gk20a/gk20a.h" |
34 | #include "gk20a/mm_gk20a.h" | 34 | #include "gk20a/mm_gk20a.h" |
35 | #include "gk20a/fb_gk20a.h" | ||
35 | 36 | ||
36 | #include "gp10b/fb_gp10b.h" | 37 | #include "gp10b/fb_gp10b.h" |
37 | 38 | ||
@@ -58,6 +59,13 @@ static void gv11b_init_nvlink_soc_credits(struct gk20a *g) | |||
58 | } | 59 | } |
59 | } | 60 | } |
60 | 61 | ||
62 | void gv11b_fb_init_hw(struct gk20a *g) | ||
63 | { | ||
64 | gk20a_fb_init_hw(g); | ||
65 | |||
66 | g->ops.fb.enable_hub_intr(g); | ||
67 | } | ||
68 | |||
61 | void gv11b_fb_init_fs_state(struct gk20a *g) | 69 | void gv11b_fb_init_fs_state(struct gk20a *g) |
62 | { | 70 | { |
63 | nvgpu_log(g, gpu_dbg_fn, "initialize gv11b fb"); | 71 | nvgpu_log(g, gpu_dbg_fn, "initialize gv11b fb"); |
@@ -374,118 +382,34 @@ void gv11b_fb_fault_buf_configure_hw(struct gk20a *g, unsigned int index) | |||
374 | gv11b_fb_fault_buf_set_state_hw(g, index, FAULT_BUF_ENABLED); | 382 | gv11b_fb_fault_buf_set_state_hw(g, index, FAULT_BUF_ENABLED); |
375 | } | 383 | } |
376 | 384 | ||
377 | static void gv11b_fb_intr_en_set(struct gk20a *g, | 385 | void gv11b_fb_enable_hub_intr(struct gk20a *g) |
378 | unsigned int index, u32 mask) | ||
379 | { | ||
380 | u32 reg_val; | ||
381 | |||
382 | reg_val = gk20a_readl(g, fb_niso_intr_en_set_r(index)); | ||
383 | reg_val |= mask; | ||
384 | gk20a_writel(g, fb_niso_intr_en_set_r(index), reg_val); | ||
385 | } | ||
386 | |||
387 | static void gv11b_fb_intr_en_clr(struct gk20a *g, | ||
388 | unsigned int index, u32 mask) | ||
389 | { | ||
390 | u32 reg_val; | ||
391 | |||
392 | reg_val = gk20a_readl(g, fb_niso_intr_en_clr_r(index)); | ||
393 | reg_val |= mask; | ||
394 | gk20a_writel(g, fb_niso_intr_en_clr_r(index), reg_val); | ||
395 | } | ||
396 | |||
397 | static u32 gv11b_fb_get_hub_intr_clr_mask(struct gk20a *g, | ||
398 | unsigned int intr_type) | ||
399 | { | 386 | { |
400 | u32 mask = 0; | 387 | u32 mask = 0; |
401 | 388 | ||
402 | if (intr_type & HUB_INTR_TYPE_OTHER) { | 389 | mask = fb_niso_intr_en_set_mmu_other_fault_notify_m() | |
403 | mask |= | 390 | fb_niso_intr_en_set_mmu_nonreplayable_fault_notify_m() | |
404 | fb_niso_intr_en_clr_mmu_other_fault_notify_m(); | 391 | fb_niso_intr_en_set_mmu_nonreplayable_fault_overflow_m() | |
405 | } | 392 | fb_niso_intr_en_set_mmu_replayable_fault_notify_m() | |
406 | 393 | fb_niso_intr_en_set_mmu_replayable_fault_overflow_m() | | |
407 | if (intr_type & HUB_INTR_TYPE_NONREPLAY) { | 394 | fb_niso_intr_en_set_mmu_ecc_uncorrected_error_notify_m(); |
408 | mask |= | ||
409 | fb_niso_intr_en_clr_mmu_nonreplayable_fault_notify_m() | | ||
410 | fb_niso_intr_en_clr_mmu_nonreplayable_fault_overflow_m(); | ||
411 | } | ||
412 | |||
413 | if (intr_type & HUB_INTR_TYPE_REPLAY) { | ||
414 | mask |= | ||
415 | fb_niso_intr_en_clr_mmu_replayable_fault_notify_m() | | ||
416 | fb_niso_intr_en_clr_mmu_replayable_fault_overflow_m(); | ||
417 | } | ||
418 | |||
419 | if (intr_type & HUB_INTR_TYPE_ECC_UNCORRECTED) { | ||
420 | mask |= | ||
421 | fb_niso_intr_en_clr_mmu_ecc_uncorrected_error_notify_m(); | ||
422 | } | ||
423 | |||
424 | if (intr_type & HUB_INTR_TYPE_ACCESS_COUNTER) { | ||
425 | mask |= | ||
426 | fb_niso_intr_en_clr_hub_access_counter_notify_m() | | ||
427 | fb_niso_intr_en_clr_hub_access_counter_error_m(); | ||
428 | } | ||
429 | 395 | ||
430 | return mask; | 396 | gk20a_writel(g, fb_niso_intr_en_set_r(0), |
397 | mask); | ||
431 | } | 398 | } |
432 | 399 | ||
433 | static u32 gv11b_fb_get_hub_intr_en_mask(struct gk20a *g, | 400 | void gv11b_fb_disable_hub_intr(struct gk20a *g) |
434 | unsigned int intr_type) | ||
435 | { | 401 | { |
436 | u32 mask = 0; | 402 | u32 mask = 0; |
437 | 403 | ||
438 | if (intr_type & HUB_INTR_TYPE_OTHER) { | 404 | mask = fb_niso_intr_en_set_mmu_other_fault_notify_m() | |
439 | mask |= | 405 | fb_niso_intr_en_set_mmu_nonreplayable_fault_notify_m() | |
440 | fb_niso_intr_en_set_mmu_other_fault_notify_m(); | 406 | fb_niso_intr_en_set_mmu_nonreplayable_fault_overflow_m() | |
441 | } | 407 | fb_niso_intr_en_set_mmu_replayable_fault_notify_m() | |
408 | fb_niso_intr_en_set_mmu_replayable_fault_overflow_m() | | ||
409 | fb_niso_intr_en_set_mmu_ecc_uncorrected_error_notify_m(); | ||
442 | 410 | ||
443 | if (intr_type & HUB_INTR_TYPE_NONREPLAY) { | 411 | gk20a_writel(g, fb_niso_intr_en_clr_r(0), |
444 | mask |= | 412 | mask); |
445 | fb_niso_intr_en_set_mmu_nonreplayable_fault_notify_m() | | ||
446 | fb_niso_intr_en_set_mmu_nonreplayable_fault_overflow_m(); | ||
447 | } | ||
448 | |||
449 | if (intr_type & HUB_INTR_TYPE_REPLAY) { | ||
450 | mask |= | ||
451 | fb_niso_intr_en_set_mmu_replayable_fault_notify_m() | | ||
452 | fb_niso_intr_en_set_mmu_replayable_fault_overflow_m(); | ||
453 | } | ||
454 | |||
455 | if (intr_type & HUB_INTR_TYPE_ECC_UNCORRECTED) { | ||
456 | mask |= | ||
457 | fb_niso_intr_en_set_mmu_ecc_uncorrected_error_notify_m(); | ||
458 | } | ||
459 | |||
460 | if (intr_type & HUB_INTR_TYPE_ACCESS_COUNTER) { | ||
461 | mask |= | ||
462 | fb_niso_intr_en_set_hub_access_counter_notify_m() | | ||
463 | fb_niso_intr_en_set_hub_access_counter_error_m(); | ||
464 | } | ||
465 | |||
466 | return mask; | ||
467 | } | ||
468 | |||
469 | void gv11b_fb_enable_hub_intr(struct gk20a *g, | ||
470 | unsigned int index, unsigned int intr_type) | ||
471 | { | ||
472 | u32 mask = 0; | ||
473 | |||
474 | mask = gv11b_fb_get_hub_intr_en_mask(g, intr_type); | ||
475 | |||
476 | if (mask) | ||
477 | gv11b_fb_intr_en_set(g, index, mask); | ||
478 | } | ||
479 | |||
480 | void gv11b_fb_disable_hub_intr(struct gk20a *g, | ||
481 | unsigned int index, unsigned int intr_type) | ||
482 | { | ||
483 | u32 mask = 0; | ||
484 | |||
485 | mask = gv11b_fb_get_hub_intr_clr_mask(g, intr_type); | ||
486 | |||
487 | if (mask) | ||
488 | gv11b_fb_intr_en_clr(g, index, mask); | ||
489 | } | 413 | } |
490 | 414 | ||
491 | void gv11b_handle_l2tlb_ecc_isr(struct gk20a *g, u32 ecc_status) | 415 | void gv11b_handle_l2tlb_ecc_isr(struct gk20a *g, u32 ecc_status) |
@@ -1226,10 +1150,6 @@ void gv11b_fb_handle_nonreplay_fault_overflow(struct gk20a *g, | |||
1226 | static void gv11b_fb_handle_bar2_fault(struct gk20a *g, | 1150 | static void gv11b_fb_handle_bar2_fault(struct gk20a *g, |
1227 | struct mmu_fault_info *mmfault, u32 fault_status) | 1151 | struct mmu_fault_info *mmfault, u32 fault_status) |
1228 | { | 1152 | { |
1229 | g->ops.fb.disable_hub_intr(g, STALL_REG_INDEX, | ||
1230 | HUB_INTR_TYPE_NONREPLAY | HUB_INTR_TYPE_REPLAY); | ||
1231 | |||
1232 | |||
1233 | if (fault_status & fb_mmu_fault_status_non_replayable_error_m()) { | 1153 | if (fault_status & fb_mmu_fault_status_non_replayable_error_m()) { |
1234 | if (gv11b_fb_is_fault_buf_enabled(g, NONREPLAY_REG_INDEX)) | 1154 | if (gv11b_fb_is_fault_buf_enabled(g, NONREPLAY_REG_INDEX)) |
1235 | gv11b_fb_fault_buf_configure_hw(g, NONREPLAY_REG_INDEX); | 1155 | gv11b_fb_fault_buf_configure_hw(g, NONREPLAY_REG_INDEX); |
@@ -1247,8 +1167,6 @@ static void gv11b_fb_handle_bar2_fault(struct gk20a *g, | |||
1247 | gk20a_channel_put(mmfault->refch); | 1167 | gk20a_channel_put(mmfault->refch); |
1248 | mmfault->refch = NULL; | 1168 | mmfault->refch = NULL; |
1249 | } | 1169 | } |
1250 | g->ops.fb.enable_hub_intr(g, STALL_REG_INDEX, | ||
1251 | HUB_INTR_TYPE_NONREPLAY | HUB_INTR_TYPE_REPLAY); | ||
1252 | } | 1170 | } |
1253 | 1171 | ||
1254 | void gv11b_fb_handle_other_fault_notify(struct gk20a *g, | 1172 | void gv11b_fb_handle_other_fault_notify(struct gk20a *g, |
@@ -1395,10 +1313,6 @@ void gv11b_fb_hub_isr(struct gk20a *g) | |||
1395 | 1313 | ||
1396 | nvgpu_info(g, "ecc uncorrected error notify"); | 1314 | nvgpu_info(g, "ecc uncorrected error notify"); |
1397 | 1315 | ||
1398 | /* disable interrupts during handling */ | ||
1399 | g->ops.fb.disable_hub_intr(g, STALL_REG_INDEX, | ||
1400 | HUB_INTR_TYPE_ECC_UNCORRECTED); | ||
1401 | |||
1402 | status = gk20a_readl(g, fb_mmu_l2tlb_ecc_status_r()); | 1316 | status = gk20a_readl(g, fb_mmu_l2tlb_ecc_status_r()); |
1403 | if (status) | 1317 | if (status) |
1404 | gv11b_handle_l2tlb_ecc_isr(g, status); | 1318 | gv11b_handle_l2tlb_ecc_isr(g, status); |
@@ -1410,11 +1324,6 @@ void gv11b_fb_hub_isr(struct gk20a *g) | |||
1410 | status = gk20a_readl(g, fb_mmu_fillunit_ecc_status_r()); | 1324 | status = gk20a_readl(g, fb_mmu_fillunit_ecc_status_r()); |
1411 | if (status) | 1325 | if (status) |
1412 | gv11b_handle_fillunit_ecc_isr(g, status); | 1326 | gv11b_handle_fillunit_ecc_isr(g, status); |
1413 | |||
1414 | /* re-enable interrupts after handling */ | ||
1415 | g->ops.fb.enable_hub_intr(g, STALL_REG_INDEX, | ||
1416 | HUB_INTR_TYPE_ECC_UNCORRECTED); | ||
1417 | |||
1418 | } | 1327 | } |
1419 | if (niso_intr & | 1328 | if (niso_intr & |
1420 | (fb_niso_intr_mmu_other_fault_notify_m() | | 1329 | (fb_niso_intr_mmu_other_fault_notify_m() | |