diff options
author | David S. Miller <davem@davemloft.net> | 2015-04-21 16:14:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-21 16:14:53 -0400 |
commit | df386375ffa8c2262a52db64a5b6446e11896978 (patch) | |
tree | 35a484468ae42adb8dc86300688e0d9fdbab5693 /arch/sparc | |
parent | 4113756603db46cec464b39100770979e982bd4c (diff) |
sparc64: Use M7 PMC write on all chips T4 and onward.
They both work equally well, and the M7 implementation is
simpler and cheaper (less register writes).
With help from David Ahern.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/perf_event.c | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 86eebfa3b158..59cf917a77b5 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
@@ -737,25 +737,9 @@ static void sparc_vt_write_pmc(int idx, u64 val) | |||
737 | { | 737 | { |
738 | u64 pcr; | 738 | u64 pcr; |
739 | 739 | ||
740 | /* There seems to be an internal latch on the overflow event | ||
741 | * on SPARC-T4 that prevents it from triggering unless you | ||
742 | * update the PIC exactly as we do here. The requirement | ||
743 | * seems to be that you have to turn off event counting in the | ||
744 | * PCR around the PIC update. | ||
745 | * | ||
746 | * For example, after the following sequence: | ||
747 | * | ||
748 | * 1) set PIC to -1 | ||
749 | * 2) enable event counting and overflow reporting in PCR | ||
750 | * 3) overflow triggers, softint 15 handler invoked | ||
751 | * 4) clear OV bit in PCR | ||
752 | * 5) write PIC to -1 | ||
753 | * | ||
754 | * a subsequent overflow event will not trigger. This | ||
755 | * sequence works on SPARC-T3 and previous chips. | ||
756 | */ | ||
757 | pcr = pcr_ops->read_pcr(idx); | 740 | pcr = pcr_ops->read_pcr(idx); |
758 | pcr_ops->write_pcr(idx, PCR_N4_PICNPT); | 741 | /* ensure ov and ntc are reset */ |
742 | pcr &= ~(PCR_N4_OV | PCR_N4_NTC); | ||
759 | 743 | ||
760 | pcr_ops->write_pic(idx, val & 0xffffffff); | 744 | pcr_ops->write_pic(idx, val & 0xffffffff); |
761 | 745 | ||
@@ -792,25 +776,12 @@ static const struct sparc_pmu niagara4_pmu = { | |||
792 | .num_pic_regs = 4, | 776 | .num_pic_regs = 4, |
793 | }; | 777 | }; |
794 | 778 | ||
795 | static void sparc_m7_write_pmc(int idx, u64 val) | ||
796 | { | ||
797 | u64 pcr; | ||
798 | |||
799 | pcr = pcr_ops->read_pcr(idx); | ||
800 | /* ensure ov and ntc are reset */ | ||
801 | pcr &= ~(PCR_N4_OV | PCR_N4_NTC); | ||
802 | |||
803 | pcr_ops->write_pic(idx, val & 0xffffffff); | ||
804 | |||
805 | pcr_ops->write_pcr(idx, pcr); | ||
806 | } | ||
807 | |||
808 | static const struct sparc_pmu sparc_m7_pmu = { | 779 | static const struct sparc_pmu sparc_m7_pmu = { |
809 | .event_map = niagara4_event_map, | 780 | .event_map = niagara4_event_map, |
810 | .cache_map = &niagara4_cache_map, | 781 | .cache_map = &niagara4_cache_map, |
811 | .max_events = ARRAY_SIZE(niagara4_perfmon_event_map), | 782 | .max_events = ARRAY_SIZE(niagara4_perfmon_event_map), |
812 | .read_pmc = sparc_vt_read_pmc, | 783 | .read_pmc = sparc_vt_read_pmc, |
813 | .write_pmc = sparc_m7_write_pmc, | 784 | .write_pmc = sparc_vt_write_pmc, |
814 | .upper_shift = 5, | 785 | .upper_shift = 5, |
815 | .lower_shift = 5, | 786 | .lower_shift = 5, |
816 | .event_mask = 0x7ff, | 787 | .event_mask = 0x7ff, |