diff options
Diffstat (limited to 'arch/powerpc/perf/power8-pmu.c')
| -rw-r--r-- | arch/powerpc/perf/power8-pmu.c | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index a3f7abd2f13f..96cee20dcd34 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c | |||
| @@ -25,6 +25,37 @@ | |||
| 25 | #define PM_BRU_FIN 0x10068 | 25 | #define PM_BRU_FIN 0x10068 |
| 26 | #define PM_BR_MPRED_CMPL 0x400f6 | 26 | #define PM_BR_MPRED_CMPL 0x400f6 |
| 27 | 27 | ||
| 28 | /* All L1 D cache load references counted at finish, gated by reject */ | ||
| 29 | #define PM_LD_REF_L1 0x100ee | ||
| 30 | /* Load Missed L1 */ | ||
| 31 | #define PM_LD_MISS_L1 0x3e054 | ||
| 32 | /* Store Missed L1 */ | ||
| 33 | #define PM_ST_MISS_L1 0x300f0 | ||
| 34 | /* L1 cache data prefetches */ | ||
| 35 | #define PM_L1_PREF 0x0d8b8 | ||
| 36 | /* Instruction fetches from L1 */ | ||
| 37 | #define PM_INST_FROM_L1 0x04080 | ||
| 38 | /* Demand iCache Miss */ | ||
| 39 | #define PM_L1_ICACHE_MISS 0x200fd | ||
| 40 | /* Instruction Demand sectors wriittent into IL1 */ | ||
| 41 | #define PM_L1_DEMAND_WRITE 0x0408c | ||
| 42 | /* Instruction prefetch written into IL1 */ | ||
| 43 | #define PM_IC_PREF_WRITE 0x0408e | ||
| 44 | /* The data cache was reloaded from local core's L3 due to a demand load */ | ||
| 45 | #define PM_DATA_FROM_L3 0x4c042 | ||
| 46 | /* Demand LD - L3 Miss (not L2 hit and not L3 hit) */ | ||
| 47 | #define PM_DATA_FROM_L3MISS 0x300fe | ||
| 48 | /* All successful D-side store dispatches for this thread */ | ||
| 49 | #define PM_L2_ST 0x17080 | ||
| 50 | /* All successful D-side store dispatches for this thread that were L2 Miss */ | ||
| 51 | #define PM_L2_ST_MISS 0x17082 | ||
| 52 | /* Total HW L3 prefetches(Load+store) */ | ||
| 53 | #define PM_L3_PREF_ALL 0x4e052 | ||
| 54 | /* Data PTEG reload */ | ||
| 55 | #define PM_DTLB_MISS 0x300fc | ||
| 56 | /* ITLB Reloaded */ | ||
| 57 | #define PM_ITLB_MISS 0x400fc | ||
| 58 | |||
| 28 | 59 | ||
| 29 | /* | 60 | /* |
| 30 | * Raw event encoding for POWER8: | 61 | * Raw event encoding for POWER8: |
| @@ -557,6 +588,8 @@ static int power8_generic_events[] = { | |||
| 557 | [PERF_COUNT_HW_INSTRUCTIONS] = PM_INST_CMPL, | 588 | [PERF_COUNT_HW_INSTRUCTIONS] = PM_INST_CMPL, |
| 558 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BRU_FIN, | 589 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BRU_FIN, |
| 559 | [PERF_COUNT_HW_BRANCH_MISSES] = PM_BR_MPRED_CMPL, | 590 | [PERF_COUNT_HW_BRANCH_MISSES] = PM_BR_MPRED_CMPL, |
| 591 | [PERF_COUNT_HW_CACHE_REFERENCES] = PM_LD_REF_L1, | ||
| 592 | [PERF_COUNT_HW_CACHE_MISSES] = PM_LD_MISS_L1, | ||
| 560 | }; | 593 | }; |
| 561 | 594 | ||
| 562 | static u64 power8_bhrb_filter_map(u64 branch_sample_type) | 595 | static u64 power8_bhrb_filter_map(u64 branch_sample_type) |
| @@ -596,6 +629,116 @@ static void power8_config_bhrb(u64 pmu_bhrb_filter) | |||
| 596 | mtspr(SPRN_MMCRA, (mfspr(SPRN_MMCRA) | pmu_bhrb_filter)); | 629 | mtspr(SPRN_MMCRA, (mfspr(SPRN_MMCRA) | pmu_bhrb_filter)); |
| 597 | } | 630 | } |
| 598 | 631 | ||
| 632 | #define C(x) PERF_COUNT_HW_CACHE_##x | ||
| 633 | |||
| 634 | /* | ||
| 635 | * Table of generalized cache-related events. | ||
| 636 | * 0 means not supported, -1 means nonsensical, other values | ||
| 637 | * are event codes. | ||
| 638 | */ | ||
| 639 | static int power8_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { | ||
| 640 | [ C(L1D) ] = { | ||
| 641 | [ C(OP_READ) ] = { | ||
| 642 | [ C(RESULT_ACCESS) ] = PM_LD_REF_L1, | ||
| 643 | [ C(RESULT_MISS) ] = PM_LD_MISS_L1, | ||
| 644 | }, | ||
| 645 | [ C(OP_WRITE) ] = { | ||
| 646 | [ C(RESULT_ACCESS) ] = 0, | ||
| 647 | [ C(RESULT_MISS) ] = PM_ST_MISS_L1, | ||
| 648 | }, | ||
| 649 | [ C(OP_PREFETCH) ] = { | ||
| 650 | [ C(RESULT_ACCESS) ] = PM_L1_PREF, | ||
| 651 | [ C(RESULT_MISS) ] = 0, | ||
| 652 | }, | ||
| 653 | }, | ||
| 654 | [ C(L1I) ] = { | ||
| 655 | [ C(OP_READ) ] = { | ||
| 656 | [ C(RESULT_ACCESS) ] = PM_INST_FROM_L1, | ||
| 657 | [ C(RESULT_MISS) ] = PM_L1_ICACHE_MISS, | ||
| 658 | }, | ||
| 659 | [ C(OP_WRITE) ] = { | ||
| 660 | [ C(RESULT_ACCESS) ] = PM_L1_DEMAND_WRITE, | ||
| 661 | [ C(RESULT_MISS) ] = -1, | ||
| 662 | }, | ||
| 663 | [ C(OP_PREFETCH) ] = { | ||
| 664 | [ C(RESULT_ACCESS) ] = PM_IC_PREF_WRITE, | ||
| 665 | [ C(RESULT_MISS) ] = 0, | ||
| 666 | }, | ||
| 667 | }, | ||
| 668 | [ C(LL) ] = { | ||
| 669 | [ C(OP_READ) ] = { | ||
| 670 | [ C(RESULT_ACCESS) ] = PM_DATA_FROM_L3, | ||
| 671 | [ C(RESULT_MISS) ] = PM_DATA_FROM_L3MISS, | ||
| 672 | }, | ||
| 673 | [ C(OP_WRITE) ] = { | ||
| 674 | [ C(RESULT_ACCESS) ] = PM_L2_ST, | ||
| 675 | [ C(RESULT_MISS) ] = PM_L2_ST_MISS, | ||
| 676 | }, | ||
| 677 | [ C(OP_PREFETCH) ] = { | ||
| 678 | [ C(RESULT_ACCESS) ] = PM_L3_PREF_ALL, | ||
| 679 | [ C(RESULT_MISS) ] = 0, | ||
| 680 | }, | ||
| 681 | }, | ||
| 682 | [ C(DTLB) ] = { | ||
| 683 | [ C(OP_READ) ] = { | ||
| 684 | [ C(RESULT_ACCESS) ] = 0, | ||
| 685 | [ C(RESULT_MISS) ] = PM_DTLB_MISS, | ||
| 686 | }, | ||
| 687 | [ C(OP_WRITE) ] = { | ||
| 688 | [ C(RESULT_ACCESS) ] = -1, | ||
| 689 | [ C(RESULT_MISS) ] = -1, | ||
| 690 | }, | ||
| 691 | [ C(OP_PREFETCH) ] = { | ||
| 692 | [ C(RESULT_ACCESS) ] = -1, | ||
| 693 | [ C(RESULT_MISS) ] = -1, | ||
| 694 | }, | ||
| 695 | }, | ||
| 696 | [ C(ITLB) ] = { | ||
| 697 | [ C(OP_READ) ] = { | ||
| 698 | [ C(RESULT_ACCESS) ] = 0, | ||
| 699 | [ C(RESULT_MISS) ] = PM_ITLB_MISS, | ||
| 700 | }, | ||
| 701 | [ C(OP_WRITE) ] = { | ||
| 702 | [ C(RESULT_ACCESS) ] = -1, | ||
| 703 | [ C(RESULT_MISS) ] = -1, | ||
| 704 | }, | ||
| 705 | [ C(OP_PREFETCH) ] = { | ||
| 706 | [ C(RESULT_ACCESS) ] = -1, | ||
| 707 | [ C(RESULT_MISS) ] = -1, | ||
| 708 | }, | ||
| 709 | }, | ||
| 710 | [ C(BPU) ] = { | ||
| 711 | [ C(OP_READ) ] = { | ||
| 712 | [ C(RESULT_ACCESS) ] = PM_BRU_FIN, | ||
| 713 | [ C(RESULT_MISS) ] = PM_BR_MPRED_CMPL, | ||
| 714 | }, | ||
| 715 | [ C(OP_WRITE) ] = { | ||
| 716 | [ C(RESULT_ACCESS) ] = -1, | ||
| 717 | [ C(RESULT_MISS) ] = -1, | ||
| 718 | }, | ||
| 719 | [ C(OP_PREFETCH) ] = { | ||
| 720 | [ C(RESULT_ACCESS) ] = -1, | ||
| 721 | [ C(RESULT_MISS) ] = -1, | ||
| 722 | }, | ||
| 723 | }, | ||
| 724 | [ C(NODE) ] = { | ||
| 725 | [ C(OP_READ) ] = { | ||
| 726 | [ C(RESULT_ACCESS) ] = -1, | ||
| 727 | [ C(RESULT_MISS) ] = -1, | ||
| 728 | }, | ||
| 729 | [ C(OP_WRITE) ] = { | ||
| 730 | [ C(RESULT_ACCESS) ] = -1, | ||
| 731 | [ C(RESULT_MISS) ] = -1, | ||
| 732 | }, | ||
| 733 | [ C(OP_PREFETCH) ] = { | ||
| 734 | [ C(RESULT_ACCESS) ] = -1, | ||
| 735 | [ C(RESULT_MISS) ] = -1, | ||
| 736 | }, | ||
| 737 | }, | ||
| 738 | }; | ||
| 739 | |||
| 740 | #undef C | ||
| 741 | |||
| 599 | static struct power_pmu power8_pmu = { | 742 | static struct power_pmu power8_pmu = { |
| 600 | .name = "POWER8", | 743 | .name = "POWER8", |
| 601 | .n_counter = 6, | 744 | .n_counter = 6, |
| @@ -611,6 +754,7 @@ static struct power_pmu power8_pmu = { | |||
| 611 | .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB | PPMU_EBB, | 754 | .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB | PPMU_EBB, |
| 612 | .n_generic = ARRAY_SIZE(power8_generic_events), | 755 | .n_generic = ARRAY_SIZE(power8_generic_events), |
| 613 | .generic_events = power8_generic_events, | 756 | .generic_events = power8_generic_events, |
| 757 | .cache_events = &power8_cache_events, | ||
| 614 | .attr_groups = power8_pmu_attr_groups, | 758 | .attr_groups = power8_pmu_attr_groups, |
| 615 | .bhrb_nr = 32, | 759 | .bhrb_nr = 32, |
| 616 | }; | 760 | }; |
