aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/perf_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/perf_event.c')
-rw-r--r--arch/sparc/kernel/perf_event.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index e48651dace1b..885a8af74064 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -817,15 +817,17 @@ static u64 nop_for_index(int idx)
817 817
818static inline void sparc_pmu_enable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx) 818static inline void sparc_pmu_enable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx)
819{ 819{
820 u64 val, mask = mask_for_index(idx); 820 u64 enc, val, mask = mask_for_index(idx);
821 int pcr_index = 0; 821 int pcr_index = 0;
822 822
823 if (sparc_pmu->num_pcrs > 1) 823 if (sparc_pmu->num_pcrs > 1)
824 pcr_index = idx; 824 pcr_index = idx;
825 825
826 enc = perf_event_get_enc(cpuc->events[idx]);
827
826 val = cpuc->pcr[pcr_index]; 828 val = cpuc->pcr[pcr_index];
827 val &= ~mask; 829 val &= ~mask;
828 val |= hwc->config; 830 val |= event_encoding(enc, idx);
829 cpuc->pcr[pcr_index] = val; 831 cpuc->pcr[pcr_index] = val;
830 832
831 pcr_ops->write_pcr(pcr_index, cpuc->pcr[pcr_index]); 833 pcr_ops->write_pcr(pcr_index, cpuc->pcr[pcr_index]);
@@ -1738,8 +1740,6 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
1738{ 1740{
1739 unsigned long ufp; 1741 unsigned long ufp;
1740 1742
1741 perf_callchain_store(entry, regs->tpc);
1742
1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS; 1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
1744 do { 1744 do {
1745 struct sparc_stackf *usf, sf; 1745 struct sparc_stackf *usf, sf;
@@ -1760,8 +1760,6 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1760{ 1760{
1761 unsigned long ufp; 1761 unsigned long ufp;
1762 1762
1763 perf_callchain_store(entry, regs->tpc);
1764
1765 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL; 1763 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
1766 do { 1764 do {
1767 struct sparc_stackf32 *usf, sf; 1765 struct sparc_stackf32 *usf, sf;
@@ -1780,6 +1778,11 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1780void 1778void
1781perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs) 1779perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
1782{ 1780{
1781 perf_callchain_store(entry, regs->tpc);
1782
1783 if (!current->mm)
1784 return;
1785
1783 flushw_user(); 1786 flushw_user();
1784 if (test_thread_flag(TIF_32BIT)) 1787 if (test_thread_flag(TIF_32BIT))
1785 perf_callchain_user_32(entry, regs); 1788 perf_callchain_user_32(entry, regs);