diff options
| author | David S. Miller <davem@davemloft.net> | 2012-08-17 06:14:01 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2012-08-19 02:26:20 -0400 |
| commit | b4f061a4b8cbf947de4fa816a1cfc53960da218e (patch) | |
| tree | 4fba7fd029f3c15a7f88156bf08f738eb943b87b /arch/sparc/kernel | |
| parent | 5ab968413515e17788003c522f7ca40a07fae900 (diff) | |
sparc64: Make sparc_pmu_{enable,disable}_event() multi-pcr aware.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel')
| -rw-r--r-- | arch/sparc/kernel/perf_event.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 197c79e9206a..c3ad63775ff9 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
| @@ -623,27 +623,35 @@ static u64 nop_for_index(int idx) | |||
| 623 | static inline void sparc_pmu_enable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx) | 623 | static inline void sparc_pmu_enable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx) |
| 624 | { | 624 | { |
| 625 | u64 val, mask = mask_for_index(idx); | 625 | u64 val, mask = mask_for_index(idx); |
| 626 | int pcr_index = 0; | ||
| 626 | 627 | ||
| 627 | val = cpuc->pcr[0]; | 628 | if (sparc_pmu->num_pcrs > 1) |
| 629 | pcr_index = idx; | ||
| 630 | |||
| 631 | val = cpuc->pcr[pcr_index]; | ||
| 628 | val &= ~mask; | 632 | val &= ~mask; |
| 629 | val |= hwc->config; | 633 | val |= hwc->config; |
| 630 | cpuc->pcr[0] = val; | 634 | cpuc->pcr[pcr_index] = val; |
| 631 | 635 | ||
| 632 | pcr_ops->write_pcr(0, cpuc->pcr[0]); | 636 | pcr_ops->write_pcr(pcr_index, cpuc->pcr[pcr_index]); |
| 633 | } | 637 | } |
| 634 | 638 | ||
| 635 | static inline void sparc_pmu_disable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx) | 639 | static inline void sparc_pmu_disable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx) |
| 636 | { | 640 | { |
| 637 | u64 mask = mask_for_index(idx); | 641 | u64 mask = mask_for_index(idx); |
| 638 | u64 nop = nop_for_index(idx); | 642 | u64 nop = nop_for_index(idx); |
| 643 | int pcr_index = 0; | ||
| 639 | u64 val; | 644 | u64 val; |
| 640 | 645 | ||
| 641 | val = cpuc->pcr[0]; | 646 | if (sparc_pmu->num_pcrs > 1) |
| 647 | pcr_index = idx; | ||
| 648 | |||
| 649 | val = cpuc->pcr[pcr_index]; | ||
| 642 | val &= ~mask; | 650 | val &= ~mask; |
| 643 | val |= nop; | 651 | val |= nop; |
| 644 | cpuc->pcr[0] = val; | 652 | cpuc->pcr[pcr_index] = val; |
| 645 | 653 | ||
| 646 | pcr_ops->write_pcr(0, cpuc->pcr[0]); | 654 | pcr_ops->write_pcr(pcr_index, cpuc->pcr[pcr_index]); |
| 647 | } | 655 | } |
| 648 | 656 | ||
| 649 | static u64 sparc_perf_event_update(struct perf_event *event, | 657 | static u64 sparc_perf_event_update(struct perf_event *event, |
