diff options
author | David S. Miller <davem@davemloft.net> | 2009-09-10 10:22:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-10 10:42:02 -0400 |
commit | b73d884756303316ead4cd7dad51236b2a515a1a (patch) | |
tree | a118f6a77c5ed20930f8c198f3ecfb9c9909e123 /arch | |
parent | 660d13765f342ecb6e774fcbc35b64beb0a069da (diff) |
sparc64: Initial niagara2 perf counter support.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc/kernel/perf_counter.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/sparc/kernel/perf_counter.c b/arch/sparc/kernel/perf_counter.c index f3b8ccca3c92..09de4035eaa9 100644 --- a/arch/sparc/kernel/perf_counter.c +++ b/arch/sparc/kernel/perf_counter.c | |||
@@ -102,6 +102,32 @@ static const struct sparc_pmu ultra3i_pmu = { | |||
102 | .lower_nop = 0x14, | 102 | .lower_nop = 0x14, |
103 | }; | 103 | }; |
104 | 104 | ||
105 | static const struct perf_event_map niagara2_perfmon_event_map[] = { | ||
106 | [PERF_COUNT_HW_CPU_CYCLES] = { 0x02ff, PIC_UPPER | PIC_LOWER }, | ||
107 | [PERF_COUNT_HW_INSTRUCTIONS] = { 0x02ff, PIC_UPPER | PIC_LOWER }, | ||
108 | [PERF_COUNT_HW_CACHE_REFERENCES] = { 0x0208, PIC_UPPER | PIC_LOWER }, | ||
109 | [PERF_COUNT_HW_CACHE_MISSES] = { 0x0302, PIC_UPPER | PIC_LOWER }, | ||
110 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = { 0x0201, PIC_UPPER | PIC_LOWER }, | ||
111 | [PERF_COUNT_HW_BRANCH_MISSES] = { 0x0202, PIC_UPPER | PIC_LOWER }, | ||
112 | }; | ||
113 | |||
114 | static const struct perf_event_map *niagara2_event_map(int event) | ||
115 | { | ||
116 | return &niagara2_perfmon_event_map[event]; | ||
117 | } | ||
118 | |||
119 | static const struct sparc_pmu niagara2_pmu = { | ||
120 | .event_map = niagara2_event_map, | ||
121 | .max_events = ARRAY_SIZE(niagara2_perfmon_event_map), | ||
122 | .upper_shift = 19, | ||
123 | .lower_shift = 6, | ||
124 | .event_mask = 0xfff, | ||
125 | .hv_bit = 0x8, | ||
126 | .irq_bit = 0x03, | ||
127 | .upper_nop = 0x220, | ||
128 | .lower_nop = 0x220, | ||
129 | }; | ||
130 | |||
105 | static const struct sparc_pmu *sparc_pmu __read_mostly; | 131 | static const struct sparc_pmu *sparc_pmu __read_mostly; |
106 | 132 | ||
107 | static u64 event_encoding(u64 event, int idx) | 133 | static u64 event_encoding(u64 event, int idx) |
@@ -504,6 +530,10 @@ static bool __init supported_pmu(void) | |||
504 | sparc_pmu = &ultra3i_pmu; | 530 | sparc_pmu = &ultra3i_pmu; |
505 | return true; | 531 | return true; |
506 | } | 532 | } |
533 | if (!strcmp(sparc_pmu_type, "niagara2")) { | ||
534 | sparc_pmu = &niagara2_pmu; | ||
535 | return true; | ||
536 | } | ||
507 | return false; | 537 | return false; |
508 | } | 538 | } |
509 | 539 | ||