summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2017-05-18 19:50:57 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-24 07:55:59 -0400
commit05388ad24a61c43a110e3d235622c23a356b5df7 (patch)
tree98e4eacd09571d8575a49977e268c3410a0e6834 /drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
parent94226c9c1ed67be2dd146648b0460ef7346a2900 (diff)
gpu: nvgpu: re-arrange parity counters
(1) Re-arrange the structure for parity counters reporting so multiple units can be managed JIRA: GPUT19X-84 Change-Id: If59a883dfe22d5a1d91a6d0ed2f5a6254434ffcb Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: http://git-master/r/1485276 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c')
-rw-r--r--drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c117
1 files changed, 71 insertions, 46 deletions
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
index 1dedd593..84175e98 100644
--- a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
@@ -484,13 +484,15 @@ static ssize_t ecc_stat_show(struct device *dev,
484 const char *ecc_stat_full_name = attr->attr.name; 484 const char *ecc_stat_full_name = attr->attr.name;
485 const char *ecc_stat_base_name; 485 const char *ecc_stat_base_name;
486 unsigned int hw_unit; 486 unsigned int hw_unit;
487 struct gr_gp10b_ecc_stat *ecc_stat; 487 struct gk20a_ecc_stat *ecc_stat;
488 u32 hash_key; 488 u32 hash_key;
489 489
490 if (sscanf(ecc_stat_full_name, "ltc%u", &hw_unit) == 1) { 490 if (sscanf(ecc_stat_full_name, "ltc%u", &hw_unit) == 1) {
491 ecc_stat_base_name = &(ecc_stat_full_name[strlen("ltc0_")]); 491 ecc_stat_base_name = &(ecc_stat_full_name[strlen("ltc0_")]);
492 } else if (sscanf(ecc_stat_full_name, "gpc0_tpc%u", &hw_unit) == 1) { 492 } else if (sscanf(ecc_stat_full_name, "gpc0_tpc%u", &hw_unit) == 1) {
493 ecc_stat_base_name = &(ecc_stat_full_name[strlen("gpc0_tpc0_")]); 493 ecc_stat_base_name = &(ecc_stat_full_name[strlen("gpc0_tpc0_")]);
494 } else if (sscanf(ecc_stat_full_name, "gpc%u", &hw_unit) == 1) {
495 ecc_stat_base_name = &(ecc_stat_full_name[strlen("gpc0_")]);
494 } else { 496 } else {
495 return snprintf(buf, 497 return snprintf(buf,
496 PAGE_SIZE, 498 PAGE_SIZE,
@@ -512,20 +514,39 @@ static ssize_t ecc_stat_show(struct device *dev,
512int gr_gp10b_ecc_stat_create(struct device *dev, 514int gr_gp10b_ecc_stat_create(struct device *dev,
513 int is_l2, 515 int is_l2,
514 char *ecc_stat_name, 516 char *ecc_stat_name,
515 struct gr_gp10b_ecc_stat *ecc_stat, 517 struct gk20a_ecc_stat *ecc_stat,
516 struct device_attribute *dev_attr_array) 518 struct device_attribute *dev_attr_array)
517{ 519{
518 int error = 0;
519 struct gk20a *g = get_gk20a(dev); 520 struct gk20a *g = get_gk20a(dev);
521 char *ltc_unit_name = "ltc";
522 char *gr_unit_name = "gpc0_tpc";
520 int num_hw_units = 0; 523 int num_hw_units = 0;
521 int hw_unit = 0;
522 u32 hash_key = 0;
523 524
524 if (is_l2) 525 if (is_l2)
525 num_hw_units = g->ltc_count; 526 num_hw_units = g->ltc_count;
526 else 527 else
527 num_hw_units = g->gr.tpc_count; 528 num_hw_units = g->gr.tpc_count;
528 529
530
531 return gp10b_ecc_stat_create(dev, num_hw_units,
532 is_l2 ? ltc_unit_name : gr_unit_name,
533 ecc_stat_name,
534 ecc_stat,
535 dev_attr_array);
536}
537
538int gp10b_ecc_stat_create(struct device *dev,
539 int num_hw_units,
540 char *ecc_unit_name,
541 char *ecc_stat_name,
542 struct gk20a_ecc_stat *ecc_stat,
543 struct device_attribute *dev_attr_array)
544{
545 int error = 0;
546 struct gk20a *g = get_gk20a(dev);
547 int hw_unit = 0;
548 u32 hash_key = 0;
549
529 /* Allocate arrays */ 550 /* Allocate arrays */
530 dev_attr_array = nvgpu_kzalloc(g, sizeof(struct device_attribute) * 551 dev_attr_array = nvgpu_kzalloc(g, sizeof(struct device_attribute) *
531 num_hw_units); 552 num_hw_units);
@@ -538,16 +559,10 @@ int gr_gp10b_ecc_stat_create(struct device *dev,
538 559
539 for (hw_unit = 0; hw_unit < num_hw_units; hw_unit++) { 560 for (hw_unit = 0; hw_unit < num_hw_units; hw_unit++) {
540 /* Fill in struct device_attribute members */ 561 /* Fill in struct device_attribute members */
541 if (is_l2)
542 snprintf(ecc_stat->names[hw_unit], 562 snprintf(ecc_stat->names[hw_unit],
543 ECC_STAT_NAME_MAX_SIZE, 563 ECC_STAT_NAME_MAX_SIZE,
544 "ltc%d_%s", 564 "%s%d_%s",
545 hw_unit, 565 ecc_unit_name,
546 ecc_stat_name);
547 else
548 snprintf(ecc_stat->names[hw_unit],
549 ECC_STAT_NAME_MAX_SIZE,
550 "gpc0_tpc%d_%s",
551 hw_unit, 566 hw_unit,
552 ecc_stat_name); 567 ecc_stat_name);
553 568
@@ -572,18 +587,28 @@ int gr_gp10b_ecc_stat_create(struct device *dev,
572 587
573void gr_gp10b_ecc_stat_remove(struct device *dev, 588void gr_gp10b_ecc_stat_remove(struct device *dev,
574 int is_l2, 589 int is_l2,
575 struct gr_gp10b_ecc_stat *ecc_stat, 590 struct gk20a_ecc_stat *ecc_stat,
576 struct device_attribute *dev_attr_array) 591 struct device_attribute *dev_attr_array)
577{ 592{
578 struct gk20a *g = get_gk20a(dev); 593 struct gk20a *g = get_gk20a(dev);
579 int num_hw_units = 0; 594 int num_hw_units = 0;
580 int hw_unit = 0;
581 595
582 if (is_l2) 596 if (is_l2)
583 num_hw_units = g->ltc_count; 597 num_hw_units = g->ltc_count;
584 else 598 else
585 num_hw_units = g->gr.tpc_count; 599 num_hw_units = g->gr.tpc_count;
586 600
601 gp10b_ecc_stat_remove(dev, num_hw_units, ecc_stat, dev_attr_array);
602}
603
604void gp10b_ecc_stat_remove(struct device *dev,
605 int num_hw_units,
606 struct gk20a_ecc_stat *ecc_stat,
607 struct device_attribute *dev_attr_array)
608{
609 struct gk20a *g = get_gk20a(dev);
610 int hw_unit = 0;
611
587 /* Remove sysfs files */ 612 /* Remove sysfs files */
588 for (hw_unit = 0; hw_unit < num_hw_units; hw_unit++) { 613 for (hw_unit = 0; hw_unit < num_hw_units; hw_unit++) {
589 device_remove_file(dev, &dev_attr_array[hw_unit]); 614 device_remove_file(dev, &dev_attr_array[hw_unit]);
@@ -610,86 +635,86 @@ void gr_gp10b_create_sysfs(struct device *dev)
610 initialized multiple times but we only need to create the ECC 635 initialized multiple times but we only need to create the ECC
611 stats once. Therefore, add the following check to avoid 636 stats once. Therefore, add the following check to avoid
612 creating duplicate stat sysfs nodes. */ 637 creating duplicate stat sysfs nodes. */
613 if (g->gr.t18x.ecc_stats.sm_lrf_single_err_count.counters != NULL) 638 if (g->ecc.gr.t18x.sm_lrf_single_err_count.counters != NULL)
614 return; 639 return;
615 640
616 error |= gr_gp10b_ecc_stat_create(dev, 641 error |= gr_gp10b_ecc_stat_create(dev,
617 0, 642 0,
618 "sm_lrf_ecc_single_err_count", 643 "sm_lrf_ecc_single_err_count",
619 &g->gr.t18x.ecc_stats.sm_lrf_single_err_count, 644 &g->ecc.gr.t18x.sm_lrf_single_err_count,
620 dev_attr_sm_lrf_ecc_single_err_count_array); 645 dev_attr_sm_lrf_ecc_single_err_count_array);
621 error |= gr_gp10b_ecc_stat_create(dev, 646 error |= gr_gp10b_ecc_stat_create(dev,
622 0, 647 0,
623 "sm_lrf_ecc_double_err_count", 648 "sm_lrf_ecc_double_err_count",
624 &g->gr.t18x.ecc_stats.sm_lrf_double_err_count, 649 &g->ecc.gr.t18x.sm_lrf_double_err_count,
625 dev_attr_sm_lrf_ecc_double_err_count_array); 650 dev_attr_sm_lrf_ecc_double_err_count_array);
626 651
627 error |= gr_gp10b_ecc_stat_create(dev, 652 error |= gr_gp10b_ecc_stat_create(dev,
628 0, 653 0,
629 "sm_shm_ecc_sec_count", 654 "sm_shm_ecc_sec_count",
630 &g->gr.t18x.ecc_stats.sm_shm_sec_count, 655 &g->ecc.gr.t18x.sm_shm_sec_count,
631 dev_attr_sm_shm_ecc_sec_count_array); 656 dev_attr_sm_shm_ecc_sec_count_array);
632 error |= gr_gp10b_ecc_stat_create(dev, 657 error |= gr_gp10b_ecc_stat_create(dev,
633 0, 658 0,
634 "sm_shm_ecc_sed_count", 659 "sm_shm_ecc_sed_count",
635 &g->gr.t18x.ecc_stats.sm_shm_sed_count, 660 &g->ecc.gr.t18x.sm_shm_sed_count,
636 dev_attr_sm_shm_ecc_sed_count_array); 661 dev_attr_sm_shm_ecc_sed_count_array);
637 error |= gr_gp10b_ecc_stat_create(dev, 662 error |= gr_gp10b_ecc_stat_create(dev,
638 0, 663 0,
639 "sm_shm_ecc_ded_count", 664 "sm_shm_ecc_ded_count",
640 &g->gr.t18x.ecc_stats.sm_shm_ded_count, 665 &g->ecc.gr.t18x.sm_shm_ded_count,
641 dev_attr_sm_shm_ecc_ded_count_array); 666 dev_attr_sm_shm_ecc_ded_count_array);
642 667
643 error |= gr_gp10b_ecc_stat_create(dev, 668 error |= gr_gp10b_ecc_stat_create(dev,
644 0, 669 0,
645 "tex_ecc_total_sec_pipe0_count", 670 "tex_ecc_total_sec_pipe0_count",
646 &g->gr.t18x.ecc_stats.tex_total_sec_pipe0_count, 671 &g->ecc.gr.t18x.tex_total_sec_pipe0_count,
647 dev_attr_tex_ecc_total_sec_pipe0_count_array); 672 dev_attr_tex_ecc_total_sec_pipe0_count_array);
648 error |= gr_gp10b_ecc_stat_create(dev, 673 error |= gr_gp10b_ecc_stat_create(dev,
649 0, 674 0,
650 "tex_ecc_total_ded_pipe0_count", 675 "tex_ecc_total_ded_pipe0_count",
651 &g->gr.t18x.ecc_stats.tex_total_ded_pipe0_count, 676 &g->ecc.gr.t18x.tex_total_ded_pipe0_count,
652 dev_attr_tex_ecc_total_ded_pipe0_count_array); 677 dev_attr_tex_ecc_total_ded_pipe0_count_array);
653 error |= gr_gp10b_ecc_stat_create(dev, 678 error |= gr_gp10b_ecc_stat_create(dev,
654 0, 679 0,
655 "tex_ecc_unique_sec_pipe0_count", 680 "tex_ecc_unique_sec_pipe0_count",
656 &g->gr.t18x.ecc_stats.tex_unique_sec_pipe0_count, 681 &g->ecc.gr.t18x.tex_unique_sec_pipe0_count,
657 dev_attr_tex_ecc_unique_sec_pipe0_count_array); 682 dev_attr_tex_ecc_unique_sec_pipe0_count_array);
658 error |= gr_gp10b_ecc_stat_create(dev, 683 error |= gr_gp10b_ecc_stat_create(dev,
659 0, 684 0,
660 "tex_ecc_unique_ded_pipe0_count", 685 "tex_ecc_unique_ded_pipe0_count",
661 &g->gr.t18x.ecc_stats.tex_unique_ded_pipe0_count, 686 &g->ecc.gr.t18x.tex_unique_ded_pipe0_count,
662 dev_attr_tex_ecc_unique_ded_pipe0_count_array); 687 dev_attr_tex_ecc_unique_ded_pipe0_count_array);
663 error |= gr_gp10b_ecc_stat_create(dev, 688 error |= gr_gp10b_ecc_stat_create(dev,
664 0, 689 0,
665 "tex_ecc_total_sec_pipe1_count", 690 "tex_ecc_total_sec_pipe1_count",
666 &g->gr.t18x.ecc_stats.tex_total_sec_pipe1_count, 691 &g->ecc.gr.t18x.tex_total_sec_pipe1_count,
667 dev_attr_tex_ecc_total_sec_pipe1_count_array); 692 dev_attr_tex_ecc_total_sec_pipe1_count_array);
668 error |= gr_gp10b_ecc_stat_create(dev, 693 error |= gr_gp10b_ecc_stat_create(dev,
669 0, 694 0,
670 "tex_ecc_total_ded_pipe1_count", 695 "tex_ecc_total_ded_pipe1_count",
671 &g->gr.t18x.ecc_stats.tex_total_ded_pipe1_count, 696 &g->ecc.gr.t18x.tex_total_ded_pipe1_count,
672 dev_attr_tex_ecc_total_ded_pipe1_count_array); 697 dev_attr_tex_ecc_total_ded_pipe1_count_array);
673 error |= gr_gp10b_ecc_stat_create(dev, 698 error |= gr_gp10b_ecc_stat_create(dev,
674 0, 699 0,
675 "tex_ecc_unique_sec_pipe1_count", 700 "tex_ecc_unique_sec_pipe1_count",
676 &g->gr.t18x.ecc_stats.tex_unique_sec_pipe1_count, 701 &g->ecc.gr.t18x.tex_unique_sec_pipe1_count,
677 dev_attr_tex_ecc_unique_sec_pipe1_count_array); 702 dev_attr_tex_ecc_unique_sec_pipe1_count_array);
678 error |= gr_gp10b_ecc_stat_create(dev, 703 error |= gr_gp10b_ecc_stat_create(dev,
679 0, 704 0,
680 "tex_ecc_unique_ded_pipe1_count", 705 "tex_ecc_unique_ded_pipe1_count",
681 &g->gr.t18x.ecc_stats.tex_unique_ded_pipe1_count, 706 &g->ecc.gr.t18x.tex_unique_ded_pipe1_count,
682 dev_attr_tex_ecc_unique_ded_pipe1_count_array); 707 dev_attr_tex_ecc_unique_ded_pipe1_count_array);
683 708
684 error |= gr_gp10b_ecc_stat_create(dev, 709 error |= gr_gp10b_ecc_stat_create(dev,
685 1, 710 1,
686 "lts0_ecc_sec_count", 711 "lts0_ecc_sec_count",
687 &g->gr.t18x.ecc_stats.l2_sec_count, 712 &g->ecc.gr.t18x.l2_sec_count,
688 dev_attr_l2_ecc_sec_count_array); 713 dev_attr_l2_ecc_sec_count_array);
689 error |= gr_gp10b_ecc_stat_create(dev, 714 error |= gr_gp10b_ecc_stat_create(dev,
690 1, 715 1,
691 "lts0_ecc_ded_count", 716 "lts0_ecc_ded_count",
692 &g->gr.t18x.ecc_stats.l2_ded_count, 717 &g->ecc.gr.t18x.l2_ded_count,
693 dev_attr_l2_ecc_ded_count_array); 718 dev_attr_l2_ecc_ded_count_array);
694 719
695 if (error) 720 if (error)
@@ -702,65 +727,65 @@ static void gr_gp10b_remove_sysfs(struct device *dev)
702 727
703 gr_gp10b_ecc_stat_remove(dev, 728 gr_gp10b_ecc_stat_remove(dev,
704 0, 729 0,
705 &g->gr.t18x.ecc_stats.sm_lrf_single_err_count, 730 &g->ecc.gr.t18x.sm_lrf_single_err_count,
706 dev_attr_sm_lrf_ecc_single_err_count_array); 731 dev_attr_sm_lrf_ecc_single_err_count_array);
707 gr_gp10b_ecc_stat_remove(dev, 732 gr_gp10b_ecc_stat_remove(dev,
708 0, 733 0,
709 &g->gr.t18x.ecc_stats.sm_lrf_double_err_count, 734 &g->ecc.gr.t18x.sm_lrf_double_err_count,
710 dev_attr_sm_lrf_ecc_double_err_count_array); 735 dev_attr_sm_lrf_ecc_double_err_count_array);
711 736
712 gr_gp10b_ecc_stat_remove(dev, 737 gr_gp10b_ecc_stat_remove(dev,
713 0, 738 0,
714 &g->gr.t18x.ecc_stats.sm_shm_sec_count, 739 &g->ecc.gr.t18x.sm_shm_sec_count,
715 dev_attr_sm_shm_ecc_sec_count_array); 740 dev_attr_sm_shm_ecc_sec_count_array);
716 gr_gp10b_ecc_stat_remove(dev, 741 gr_gp10b_ecc_stat_remove(dev,
717 0, 742 0,
718 &g->gr.t18x.ecc_stats.sm_shm_sed_count, 743 &g->ecc.gr.t18x.sm_shm_sed_count,
719 dev_attr_sm_shm_ecc_sed_count_array); 744 dev_attr_sm_shm_ecc_sed_count_array);
720 gr_gp10b_ecc_stat_remove(dev, 745 gr_gp10b_ecc_stat_remove(dev,
721 0, 746 0,
722 &g->gr.t18x.ecc_stats.sm_shm_ded_count, 747 &g->ecc.gr.t18x.sm_shm_ded_count,
723 dev_attr_sm_shm_ecc_ded_count_array); 748 dev_attr_sm_shm_ecc_ded_count_array);
724 749
725 gr_gp10b_ecc_stat_remove(dev, 750 gr_gp10b_ecc_stat_remove(dev,
726 0, 751 0,
727 &g->gr.t18x.ecc_stats.tex_total_sec_pipe0_count, 752 &g->ecc.gr.t18x.tex_total_sec_pipe0_count,
728 dev_attr_tex_ecc_total_sec_pipe0_count_array); 753 dev_attr_tex_ecc_total_sec_pipe0_count_array);
729 gr_gp10b_ecc_stat_remove(dev, 754 gr_gp10b_ecc_stat_remove(dev,
730 0, 755 0,
731 &g->gr.t18x.ecc_stats.tex_total_ded_pipe0_count, 756 &g->ecc.gr.t18x.tex_total_ded_pipe0_count,
732 dev_attr_tex_ecc_total_ded_pipe0_count_array); 757 dev_attr_tex_ecc_total_ded_pipe0_count_array);
733 gr_gp10b_ecc_stat_remove(dev, 758 gr_gp10b_ecc_stat_remove(dev,
734 0, 759 0,
735 &g->gr.t18x.ecc_stats.tex_unique_sec_pipe0_count, 760 &g->ecc.gr.t18x.tex_unique_sec_pipe0_count,
736 dev_attr_tex_ecc_unique_sec_pipe0_count_array); 761 dev_attr_tex_ecc_unique_sec_pipe0_count_array);
737 gr_gp10b_ecc_stat_remove(dev, 762 gr_gp10b_ecc_stat_remove(dev,
738 0, 763 0,
739 &g->gr.t18x.ecc_stats.tex_unique_ded_pipe0_count, 764 &g->ecc.gr.t18x.tex_unique_ded_pipe0_count,
740 dev_attr_tex_ecc_unique_ded_pipe0_count_array); 765 dev_attr_tex_ecc_unique_ded_pipe0_count_array);
741 gr_gp10b_ecc_stat_remove(dev, 766 gr_gp10b_ecc_stat_remove(dev,
742 0, 767 0,
743 &g->gr.t18x.ecc_stats.tex_total_sec_pipe1_count, 768 &g->ecc.gr.t18x.tex_total_sec_pipe1_count,
744 dev_attr_tex_ecc_total_sec_pipe1_count_array); 769 dev_attr_tex_ecc_total_sec_pipe1_count_array);
745 gr_gp10b_ecc_stat_remove(dev, 770 gr_gp10b_ecc_stat_remove(dev,
746 0, 771 0,
747 &g->gr.t18x.ecc_stats.tex_total_ded_pipe1_count, 772 &g->ecc.gr.t18x.tex_total_ded_pipe1_count,
748 dev_attr_tex_ecc_total_ded_pipe1_count_array); 773 dev_attr_tex_ecc_total_ded_pipe1_count_array);
749 gr_gp10b_ecc_stat_remove(dev, 774 gr_gp10b_ecc_stat_remove(dev,
750 0, 775 0,
751 &g->gr.t18x.ecc_stats.tex_unique_sec_pipe1_count, 776 &g->ecc.gr.t18x.tex_unique_sec_pipe1_count,
752 dev_attr_tex_ecc_unique_sec_pipe1_count_array); 777 dev_attr_tex_ecc_unique_sec_pipe1_count_array);
753 gr_gp10b_ecc_stat_remove(dev, 778 gr_gp10b_ecc_stat_remove(dev,
754 0, 779 0,
755 &g->gr.t18x.ecc_stats.tex_unique_ded_pipe1_count, 780 &g->ecc.gr.t18x.tex_unique_ded_pipe1_count,
756 dev_attr_tex_ecc_unique_ded_pipe1_count_array); 781 dev_attr_tex_ecc_unique_ded_pipe1_count_array);
757 782
758 gr_gp10b_ecc_stat_remove(dev, 783 gr_gp10b_ecc_stat_remove(dev,
759 1, 784 1,
760 &g->gr.t18x.ecc_stats.l2_sec_count, 785 &g->ecc.gr.t18x.l2_sec_count,
761 dev_attr_l2_ecc_sec_count_array); 786 dev_attr_l2_ecc_sec_count_array);
762 gr_gp10b_ecc_stat_remove(dev, 787 gr_gp10b_ecc_stat_remove(dev,
763 1, 788 1,
764 &g->gr.t18x.ecc_stats.l2_ded_count, 789 &g->ecc.gr.t18x.l2_ded_count,
765 dev_attr_l2_ecc_ded_count_array); 790 dev_attr_l2_ecc_ded_count_array);
766} 791}