aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/perf_counter.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/perf_counter.c')
-rw-r--r--arch/powerpc/kernel/perf_counter.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c
index db8d5cafc159..8d4cafc84b82 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_counter.c
@@ -26,7 +26,7 @@ struct cpu_hw_counters {
26 int n_limited; 26 int n_limited;
27 u8 pmcs_enabled; 27 u8 pmcs_enabled;
28 struct perf_counter *counter[MAX_HWCOUNTERS]; 28 struct perf_counter *counter[MAX_HWCOUNTERS];
29 unsigned int events[MAX_HWCOUNTERS]; 29 u64 events[MAX_HWCOUNTERS];
30 unsigned int flags[MAX_HWCOUNTERS]; 30 unsigned int flags[MAX_HWCOUNTERS];
31 u64 mmcr[3]; 31 u64 mmcr[3];
32 struct perf_counter *limited_counter[MAX_LIMITED_HWCOUNTERS]; 32 struct perf_counter *limited_counter[MAX_LIMITED_HWCOUNTERS];
@@ -131,11 +131,11 @@ static void write_pmc(int idx, unsigned long val)
131 * and see if any combination of alternative codes is feasible. 131 * and see if any combination of alternative codes is feasible.
132 * The feasible set is returned in event[]. 132 * The feasible set is returned in event[].
133 */ 133 */
134static int power_check_constraints(unsigned int event[], unsigned int cflags[], 134static int power_check_constraints(u64 event[], unsigned int cflags[],
135 int n_ev) 135 int n_ev)
136{ 136{
137 u64 mask, value, nv; 137 u64 mask, value, nv;
138 unsigned int alternatives[MAX_HWCOUNTERS][MAX_EVENT_ALTERNATIVES]; 138 u64 alternatives[MAX_HWCOUNTERS][MAX_EVENT_ALTERNATIVES];
139 u64 amasks[MAX_HWCOUNTERS][MAX_EVENT_ALTERNATIVES]; 139 u64 amasks[MAX_HWCOUNTERS][MAX_EVENT_ALTERNATIVES];
140 u64 avalues[MAX_HWCOUNTERS][MAX_EVENT_ALTERNATIVES]; 140 u64 avalues[MAX_HWCOUNTERS][MAX_EVENT_ALTERNATIVES];
141 u64 smasks[MAX_HWCOUNTERS], svalues[MAX_HWCOUNTERS]; 141 u64 smasks[MAX_HWCOUNTERS], svalues[MAX_HWCOUNTERS];
@@ -564,7 +564,7 @@ void hw_perf_enable(void)
564} 564}
565 565
566static int collect_events(struct perf_counter *group, int max_count, 566static int collect_events(struct perf_counter *group, int max_count,
567 struct perf_counter *ctrs[], unsigned int *events, 567 struct perf_counter *ctrs[], u64 *events,
568 unsigned int *flags) 568 unsigned int *flags)
569{ 569{
570 int n = 0; 570 int n = 0;
@@ -752,11 +752,11 @@ struct pmu power_pmu = {
752 * that a limited PMC can count, doesn't require interrupts, and 752 * that a limited PMC can count, doesn't require interrupts, and
753 * doesn't exclude any processor mode. 753 * doesn't exclude any processor mode.
754 */ 754 */
755static int can_go_on_limited_pmc(struct perf_counter *counter, unsigned int ev, 755static int can_go_on_limited_pmc(struct perf_counter *counter, u64 ev,
756 unsigned int flags) 756 unsigned int flags)
757{ 757{
758 int n; 758 int n;
759 unsigned int alt[MAX_EVENT_ALTERNATIVES]; 759 u64 alt[MAX_EVENT_ALTERNATIVES];
760 760
761 if (counter->hw_event.exclude_user 761 if (counter->hw_event.exclude_user
762 || counter->hw_event.exclude_kernel 762 || counter->hw_event.exclude_kernel
@@ -776,10 +776,8 @@ static int can_go_on_limited_pmc(struct perf_counter *counter, unsigned int ev,
776 776
777 flags |= PPMU_LIMITED_PMC_OK | PPMU_LIMITED_PMC_REQD; 777 flags |= PPMU_LIMITED_PMC_OK | PPMU_LIMITED_PMC_REQD;
778 n = ppmu->get_alternatives(ev, flags, alt); 778 n = ppmu->get_alternatives(ev, flags, alt);
779 if (n)
780 return alt[0];
781 779
782 return 0; 780 return n > 0;
783} 781}
784 782
785/* 783/*
@@ -787,10 +785,9 @@ static int can_go_on_limited_pmc(struct perf_counter *counter, unsigned int ev,
787 * and return the event code, or 0 if there is no such alternative. 785 * and return the event code, or 0 if there is no such alternative.
788 * (Note: event code 0 is "don't count" on all machines.) 786 * (Note: event code 0 is "don't count" on all machines.)
789 */ 787 */
790static unsigned long normal_pmc_alternative(unsigned long ev, 788static u64 normal_pmc_alternative(u64 ev, unsigned long flags)
791 unsigned long flags)
792{ 789{
793 unsigned int alt[MAX_EVENT_ALTERNATIVES]; 790 u64 alt[MAX_EVENT_ALTERNATIVES];
794 int n; 791 int n;
795 792
796 flags &= ~(PPMU_LIMITED_PMC_OK | PPMU_LIMITED_PMC_REQD); 793 flags &= ~(PPMU_LIMITED_PMC_OK | PPMU_LIMITED_PMC_REQD);
@@ -820,9 +817,10 @@ static void hw_perf_counter_destroy(struct perf_counter *counter)
820 817
821const struct pmu *hw_perf_counter_init(struct perf_counter *counter) 818const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
822{ 819{
823 unsigned long ev, flags; 820 u64 ev;
821 unsigned long flags;
824 struct perf_counter *ctrs[MAX_HWCOUNTERS]; 822 struct perf_counter *ctrs[MAX_HWCOUNTERS];
825 unsigned int events[MAX_HWCOUNTERS]; 823 u64 events[MAX_HWCOUNTERS];
826 unsigned int cflags[MAX_HWCOUNTERS]; 824 unsigned int cflags[MAX_HWCOUNTERS];
827 int n; 825 int n;
828 int err; 826 int err;