summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2018-06-26 20:37:40 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-19 19:43:58 -0400
commit7f14aafc2c02eb0fab458324d0ba91a7fdea3086 (patch)
treecda9f48839fbde3444fde521a9b0069eb06cd81a /drivers/gpu/nvgpu/gv11b/gr_gv11b.c
parent5ff1b3fe5a30c926e59a55ad25dd4daf430c8579 (diff)
gpu: nvgpu: rework ecc structure and sysfs
- create common file common/ecc.c which include common functions for add ecc counters and remove counters. - common code will create a list of all counter which make it easier to iterate all counters. - Add chip specific file for adding ecc counters. - add linux specific file os/linux/ecc_sysfs.c to export counters to sysfs. - remove obsolete code - MISRA violation for using snprintf is not solved, tracking with jira NVGPU-859 Jira NVGPUT-115 Change-Id: I1905c43c5c9b2b131199807533dee8e63ddc12f4 Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1763536 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b/gr_gv11b.c')
-rw-r--r--drivers/gpu/nvgpu/gv11b/gr_gv11b.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
index d3fe5f65..c2f47a20 100644
--- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
@@ -198,7 +198,7 @@ static int gr_gv11b_handle_l1_tag_exception(struct gk20a *g, u32 gpc, u32 tpc,
198 l1_tag_corrected_err_count_delta += 198 l1_tag_corrected_err_count_delta +=
199 (is_l1_tag_ecc_corrected_total_err_overflow << 199 (is_l1_tag_ecc_corrected_total_err_overflow <<
200 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_corrected_err_count_total_s()); 200 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_corrected_err_count_total_s());
201 g->ecc.gr.sm_l1_tag_corrected_err_count.counters[tpc] += 201 g->ecc.gr.sm_l1_tag_ecc_corrected_err_count[gpc][tpc].counter +=
202 l1_tag_corrected_err_count_delta; 202 l1_tag_corrected_err_count_delta;
203 gk20a_writel(g, 203 gk20a_writel(g,
204 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_corrected_err_count_r() + offset, 204 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_corrected_err_count_r() + offset,
@@ -213,7 +213,7 @@ static int gr_gv11b_handle_l1_tag_exception(struct gk20a *g, u32 gpc, u32 tpc,
213 l1_tag_uncorrected_err_count_delta += 213 l1_tag_uncorrected_err_count_delta +=
214 (is_l1_tag_ecc_uncorrected_total_err_overflow << 214 (is_l1_tag_ecc_uncorrected_total_err_overflow <<
215 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_uncorrected_err_count_total_s()); 215 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_uncorrected_err_count_total_s());
216 g->ecc.gr.sm_l1_tag_uncorrected_err_count.counters[tpc] += 216 g->ecc.gr.sm_l1_tag_ecc_uncorrected_err_count[gpc][tpc].counter +=
217 l1_tag_uncorrected_err_count_delta; 217 l1_tag_uncorrected_err_count_delta;
218 gk20a_writel(g, 218 gk20a_writel(g,
219 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_uncorrected_err_count_r() + offset, 219 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_uncorrected_err_count_r() + offset,
@@ -290,7 +290,7 @@ static int gr_gv11b_handle_lrf_exception(struct gk20a *g, u32 gpc, u32 tpc,
290 lrf_corrected_err_count_delta += 290 lrf_corrected_err_count_delta +=
291 (is_lrf_ecc_corrected_total_err_overflow << 291 (is_lrf_ecc_corrected_total_err_overflow <<
292 gr_pri_gpc0_tpc0_sm_lrf_ecc_corrected_err_count_total_s()); 292 gr_pri_gpc0_tpc0_sm_lrf_ecc_corrected_err_count_total_s());
293 g->ecc.gr.sm_lrf_single_err_count.counters[tpc] += 293 g->ecc.gr.sm_lrf_ecc_single_err_count[gpc][tpc].counter +=
294 lrf_corrected_err_count_delta; 294 lrf_corrected_err_count_delta;
295 gk20a_writel(g, 295 gk20a_writel(g,
296 gr_pri_gpc0_tpc0_sm_lrf_ecc_corrected_err_count_r() + offset, 296 gr_pri_gpc0_tpc0_sm_lrf_ecc_corrected_err_count_r() + offset,
@@ -305,7 +305,7 @@ static int gr_gv11b_handle_lrf_exception(struct gk20a *g, u32 gpc, u32 tpc,
305 lrf_uncorrected_err_count_delta += 305 lrf_uncorrected_err_count_delta +=
306 (is_lrf_ecc_uncorrected_total_err_overflow << 306 (is_lrf_ecc_uncorrected_total_err_overflow <<
307 gr_pri_gpc0_tpc0_sm_lrf_ecc_uncorrected_err_count_total_s()); 307 gr_pri_gpc0_tpc0_sm_lrf_ecc_uncorrected_err_count_total_s());
308 g->ecc.gr.sm_lrf_double_err_count.counters[tpc] += 308 g->ecc.gr.sm_lrf_ecc_double_err_count[gpc][tpc].counter +=
309 lrf_uncorrected_err_count_delta; 309 lrf_uncorrected_err_count_delta;
310 gk20a_writel(g, 310 gk20a_writel(g,
311 gr_pri_gpc0_tpc0_sm_lrf_ecc_uncorrected_err_count_r() + offset, 311 gr_pri_gpc0_tpc0_sm_lrf_ecc_uncorrected_err_count_r() + offset,
@@ -449,7 +449,7 @@ static int gr_gv11b_handle_cbu_exception(struct gk20a *g, u32 gpc, u32 tpc,
449 cbu_corrected_err_count_delta += 449 cbu_corrected_err_count_delta +=
450 (is_cbu_ecc_corrected_total_err_overflow << 450 (is_cbu_ecc_corrected_total_err_overflow <<
451 gr_pri_gpc0_tpc0_sm_cbu_ecc_corrected_err_count_total_s()); 451 gr_pri_gpc0_tpc0_sm_cbu_ecc_corrected_err_count_total_s());
452 g->ecc.gr.sm_cbu_corrected_err_count.counters[tpc] += 452 g->ecc.gr.sm_cbu_ecc_corrected_err_count[gpc][tpc].counter +=
453 cbu_corrected_err_count_delta; 453 cbu_corrected_err_count_delta;
454 gk20a_writel(g, 454 gk20a_writel(g,
455 gr_pri_gpc0_tpc0_sm_cbu_ecc_corrected_err_count_r() + offset, 455 gr_pri_gpc0_tpc0_sm_cbu_ecc_corrected_err_count_r() + offset,
@@ -464,7 +464,7 @@ static int gr_gv11b_handle_cbu_exception(struct gk20a *g, u32 gpc, u32 tpc,
464 cbu_uncorrected_err_count_delta += 464 cbu_uncorrected_err_count_delta +=
465 (is_cbu_ecc_uncorrected_total_err_overflow << 465 (is_cbu_ecc_uncorrected_total_err_overflow <<
466 gr_pri_gpc0_tpc0_sm_cbu_ecc_uncorrected_err_count_total_s()); 466 gr_pri_gpc0_tpc0_sm_cbu_ecc_uncorrected_err_count_total_s());
467 g->ecc.gr.sm_cbu_uncorrected_err_count.counters[tpc] += 467 g->ecc.gr.sm_cbu_ecc_uncorrected_err_count[gpc][tpc].counter +=
468 cbu_uncorrected_err_count_delta; 468 cbu_uncorrected_err_count_delta;
469 gk20a_writel(g, 469 gk20a_writel(g,
470 gr_pri_gpc0_tpc0_sm_cbu_ecc_uncorrected_err_count_r() + offset, 470 gr_pri_gpc0_tpc0_sm_cbu_ecc_uncorrected_err_count_r() + offset,
@@ -529,7 +529,7 @@ static int gr_gv11b_handle_l1_data_exception(struct gk20a *g, u32 gpc, u32 tpc,
529 l1_data_corrected_err_count_delta += 529 l1_data_corrected_err_count_delta +=
530 (is_l1_data_ecc_corrected_total_err_overflow << 530 (is_l1_data_ecc_corrected_total_err_overflow <<
531 gr_pri_gpc0_tpc0_sm_l1_data_ecc_corrected_err_count_total_s()); 531 gr_pri_gpc0_tpc0_sm_l1_data_ecc_corrected_err_count_total_s());
532 g->ecc.gr.sm_l1_data_corrected_err_count.counters[tpc] += 532 g->ecc.gr.sm_l1_data_ecc_corrected_err_count[gpc][tpc].counter +=
533 l1_data_corrected_err_count_delta; 533 l1_data_corrected_err_count_delta;
534 gk20a_writel(g, 534 gk20a_writel(g,
535 gr_pri_gpc0_tpc0_sm_l1_data_ecc_corrected_err_count_r() + offset, 535 gr_pri_gpc0_tpc0_sm_l1_data_ecc_corrected_err_count_r() + offset,
@@ -544,7 +544,7 @@ static int gr_gv11b_handle_l1_data_exception(struct gk20a *g, u32 gpc, u32 tpc,
544 l1_data_uncorrected_err_count_delta += 544 l1_data_uncorrected_err_count_delta +=
545 (is_l1_data_ecc_uncorrected_total_err_overflow << 545 (is_l1_data_ecc_uncorrected_total_err_overflow <<
546 gr_pri_gpc0_tpc0_sm_l1_data_ecc_uncorrected_err_count_total_s()); 546 gr_pri_gpc0_tpc0_sm_l1_data_ecc_uncorrected_err_count_total_s());
547 g->ecc.gr.sm_l1_data_uncorrected_err_count.counters[tpc] += 547 g->ecc.gr.sm_l1_data_ecc_uncorrected_err_count[gpc][tpc].counter +=
548 l1_data_uncorrected_err_count_delta; 548 l1_data_uncorrected_err_count_delta;
549 gk20a_writel(g, 549 gk20a_writel(g,
550 gr_pri_gpc0_tpc0_sm_l1_data_ecc_uncorrected_err_count_r() + offset, 550 gr_pri_gpc0_tpc0_sm_l1_data_ecc_uncorrected_err_count_r() + offset,
@@ -613,7 +613,7 @@ static int gr_gv11b_handle_icache_exception(struct gk20a *g, u32 gpc, u32 tpc,
613 icache_corrected_err_count_delta += 613 icache_corrected_err_count_delta +=
614 (is_icache_ecc_corrected_total_err_overflow << 614 (is_icache_ecc_corrected_total_err_overflow <<
615 gr_pri_gpc0_tpc0_sm_icache_ecc_corrected_err_count_total_s()); 615 gr_pri_gpc0_tpc0_sm_icache_ecc_corrected_err_count_total_s());
616 g->ecc.gr.sm_icache_corrected_err_count.counters[tpc] += 616 g->ecc.gr.sm_icache_ecc_corrected_err_count[gpc][tpc].counter +=
617 icache_corrected_err_count_delta; 617 icache_corrected_err_count_delta;
618 gk20a_writel(g, 618 gk20a_writel(g,
619 gr_pri_gpc0_tpc0_sm_icache_ecc_corrected_err_count_r() + offset, 619 gr_pri_gpc0_tpc0_sm_icache_ecc_corrected_err_count_r() + offset,
@@ -628,7 +628,7 @@ static int gr_gv11b_handle_icache_exception(struct gk20a *g, u32 gpc, u32 tpc,
628 icache_uncorrected_err_count_delta += 628 icache_uncorrected_err_count_delta +=
629 (is_icache_ecc_uncorrected_total_err_overflow << 629 (is_icache_ecc_uncorrected_total_err_overflow <<
630 gr_pri_gpc0_tpc0_sm_icache_ecc_uncorrected_err_count_total_s()); 630 gr_pri_gpc0_tpc0_sm_icache_ecc_uncorrected_err_count_total_s());
631 g->ecc.gr.sm_icache_uncorrected_err_count.counters[tpc] += 631 g->ecc.gr.sm_icache_ecc_uncorrected_err_count[gpc][tpc].counter +=
632 icache_uncorrected_err_count_delta; 632 icache_uncorrected_err_count_delta;
633 gk20a_writel(g, 633 gk20a_writel(g,
634 gr_pri_gpc0_tpc0_sm_icache_ecc_uncorrected_err_count_r() + offset, 634 gr_pri_gpc0_tpc0_sm_icache_ecc_uncorrected_err_count_r() + offset,
@@ -717,7 +717,7 @@ int gr_gv11b_handle_gcc_exception(struct gk20a *g, u32 gpc, u32 tpc,
717 gcc_l15_corrected_err_count_delta += 717 gcc_l15_corrected_err_count_delta +=
718 (is_gcc_l15_ecc_corrected_total_err_overflow << 718 (is_gcc_l15_ecc_corrected_total_err_overflow <<
719 gr_pri_gpc0_gcc_l15_ecc_corrected_err_count_total_s()); 719 gr_pri_gpc0_gcc_l15_ecc_corrected_err_count_total_s());
720 g->ecc.gr.gcc_l15_corrected_err_count.counters[gpc] += 720 g->ecc.gr.gcc_l15_ecc_corrected_err_count[gpc].counter +=
721 gcc_l15_corrected_err_count_delta; 721 gcc_l15_corrected_err_count_delta;
722 gk20a_writel(g, 722 gk20a_writel(g,
723 gr_pri_gpc0_gcc_l15_ecc_corrected_err_count_r() + offset, 723 gr_pri_gpc0_gcc_l15_ecc_corrected_err_count_r() + offset,
@@ -732,7 +732,7 @@ int gr_gv11b_handle_gcc_exception(struct gk20a *g, u32 gpc, u32 tpc,
732 gcc_l15_uncorrected_err_count_delta += 732 gcc_l15_uncorrected_err_count_delta +=
733 (is_gcc_l15_ecc_uncorrected_total_err_overflow << 733 (is_gcc_l15_ecc_uncorrected_total_err_overflow <<
734 gr_pri_gpc0_gcc_l15_ecc_uncorrected_err_count_total_s()); 734 gr_pri_gpc0_gcc_l15_ecc_uncorrected_err_count_total_s());
735 g->ecc.gr.gcc_l15_uncorrected_err_count.counters[gpc] += 735 g->ecc.gr.gcc_l15_ecc_uncorrected_err_count[gpc].counter +=
736 gcc_l15_uncorrected_err_count_delta; 736 gcc_l15_uncorrected_err_count_delta;
737 gk20a_writel(g, 737 gk20a_writel(g,
738 gr_pri_gpc0_gcc_l15_ecc_uncorrected_err_count_r() + offset, 738 gr_pri_gpc0_gcc_l15_ecc_uncorrected_err_count_r() + offset,
@@ -802,9 +802,9 @@ static int gr_gv11b_handle_gpcmmu_ecc_exception(struct gk20a *g, u32 gpc,
802 uncorrected_delta += (0x1UL << gr_gpc0_mmu_l1tlb_ecc_uncorrected_err_count_total_s()); 802 uncorrected_delta += (0x1UL << gr_gpc0_mmu_l1tlb_ecc_uncorrected_err_count_total_s());
803 803
804 804
805 g->ecc.gr.mmu_l1tlb_corrected_err_count.counters[gpc] += 805 g->ecc.gr.mmu_l1tlb_ecc_corrected_err_count[gpc].counter +=
806 corrected_delta; 806 corrected_delta;
807 g->ecc.gr.mmu_l1tlb_uncorrected_err_count.counters[gpc] += 807 g->ecc.gr.mmu_l1tlb_ecc_uncorrected_err_count[gpc].counter +=
808 uncorrected_delta; 808 uncorrected_delta;
809 nvgpu_log(g, gpu_dbg_intr, 809 nvgpu_log(g, gpu_dbg_intr,
810 "mmu l1tlb gpc:%d ecc interrupt intr: 0x%x", gpc, hww_esr); 810 "mmu l1tlb gpc:%d ecc interrupt intr: 0x%x", gpc, hww_esr);
@@ -824,8 +824,8 @@ static int gr_gv11b_handle_gpcmmu_ecc_exception(struct gk20a *g, u32 gpc,
824 "ecc error address: 0x%x", ecc_addr); 824 "ecc error address: 0x%x", ecc_addr);
825 nvgpu_log(g, gpu_dbg_intr, 825 nvgpu_log(g, gpu_dbg_intr,
826 "ecc error count corrected: %d, uncorrected %d", 826 "ecc error count corrected: %d, uncorrected %d",
827 g->ecc.gr.mmu_l1tlb_corrected_err_count.counters[gpc], 827 g->ecc.gr.mmu_l1tlb_ecc_corrected_err_count[gpc].counter,
828 g->ecc.gr.mmu_l1tlb_uncorrected_err_count.counters[gpc]); 828 g->ecc.gr.mmu_l1tlb_ecc_uncorrected_err_count[gpc].counter);
829 829
830 return ret; 830 return ret;
831} 831}
@@ -880,9 +880,9 @@ static int gr_gv11b_handle_gpccs_ecc_exception(struct gk20a *g, u32 gpc,
880 gk20a_writel(g, gr_gpc0_gpccs_falcon_ecc_status_r() + offset, 880 gk20a_writel(g, gr_gpc0_gpccs_falcon_ecc_status_r() + offset,
881 gr_gpc0_gpccs_falcon_ecc_status_reset_task_f()); 881 gr_gpc0_gpccs_falcon_ecc_status_reset_task_f());
882 882
883 g->ecc.gr.gpccs_corrected_err_count.counters[gpc] += 883 g->ecc.gr.gpccs_ecc_corrected_err_count[gpc].counter +=
884 corrected_delta; 884 corrected_delta;
885 g->ecc.gr.gpccs_uncorrected_err_count.counters[gpc] += 885 g->ecc.gr.gpccs_ecc_uncorrected_err_count[gpc].counter +=
886 uncorrected_delta; 886 uncorrected_delta;
887 nvgpu_log(g, gpu_dbg_intr, 887 nvgpu_log(g, gpu_dbg_intr,
888 "gppcs gpc:%d ecc interrupt intr: 0x%x", gpc, hww_esr); 888 "gppcs gpc:%d ecc interrupt intr: 0x%x", gpc, hww_esr);
@@ -907,8 +907,8 @@ static int gr_gv11b_handle_gpccs_ecc_exception(struct gk20a *g, u32 gpc,
907 907
908 nvgpu_log(g, gpu_dbg_intr, 908 nvgpu_log(g, gpu_dbg_intr,
909 "ecc error count corrected: %d, uncorrected %d", 909 "ecc error count corrected: %d, uncorrected %d",
910 g->ecc.gr.gpccs_corrected_err_count.counters[gpc], 910 g->ecc.gr.gpccs_ecc_corrected_err_count[gpc].counter,
911 g->ecc.gr.gpccs_uncorrected_err_count.counters[gpc]); 911 g->ecc.gr.gpccs_ecc_uncorrected_err_count[gpc].counter);
912 912
913 return ret; 913 return ret;
914} 914}
@@ -2419,9 +2419,9 @@ static void gr_gv11b_handle_fecs_ecc_error(struct gk20a *g, u32 intr)
2419 gk20a_writel(g, gr_fecs_falcon_ecc_status_r(), 2419 gk20a_writel(g, gr_fecs_falcon_ecc_status_r(),
2420 gr_fecs_falcon_ecc_status_reset_task_f()); 2420 gr_fecs_falcon_ecc_status_reset_task_f());
2421 2421
2422 g->ecc.gr.fecs_corrected_err_count.counters[0] += 2422 g->ecc.gr.fecs_ecc_corrected_err_count[0].counter +=
2423 corrected_delta; 2423 corrected_delta;
2424 g->ecc.gr.fecs_uncorrected_err_count.counters[0] += 2424 g->ecc.gr.fecs_ecc_uncorrected_err_count[0].counter +=
2425 uncorrected_delta; 2425 uncorrected_delta;
2426 2426
2427 nvgpu_log(g, gpu_dbg_intr, 2427 nvgpu_log(g, gpu_dbg_intr,
@@ -2450,8 +2450,8 @@ static void gr_gv11b_handle_fecs_ecc_error(struct gk20a *g, u32 intr)
2450 2450
2451 nvgpu_log(g, gpu_dbg_intr, 2451 nvgpu_log(g, gpu_dbg_intr,
2452 "ecc error count corrected: %d, uncorrected %d", 2452 "ecc error count corrected: %d, uncorrected %d",
2453 g->ecc.gr.fecs_corrected_err_count.counters[0], 2453 g->ecc.gr.fecs_ecc_corrected_err_count[0].counter,
2454 g->ecc.gr.fecs_uncorrected_err_count.counters[0]); 2454 g->ecc.gr.fecs_ecc_uncorrected_err_count[0].counter);
2455 } 2455 }
2456} 2456}
2457 2457