aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDeng-Cheng Zhu <dengcheng.zhu@imgtec.com>2014-02-10 12:48:53 -0500
committerRalf Baechle <ralf@linux-mips.org>2014-03-31 12:17:12 -0400
commitc52068bd2f5d733a6edaab5108a9975dcb333494 (patch)
tree4c776c6ba48561eafaf1e550b1527fe7e3262303 /arch
parent6b0b84295c4a82c89de64b80923e9d975e9249ed (diff)
MIPS: perf: Add proAptiv support
Choose event/cache maps and handle raw event mapping for proAptiv. Update code comments. Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com> Reviewed-by: Markos Chandras <Markos.Chandras@imgtec.com> Reviewed-by: James Hogan <james.hogan@imgtec.com> Cc: linux-mips@linux-mips.org Cc: Steven.Hill@imgtec.com Patchwork: https://patchwork.linux-mips.org/patch/6527/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index d5294cc7a6ac..fc4cf07358cb 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -814,7 +814,7 @@ static const struct mips_perf_event mipsxxcore_event_map
814 [PERF_COUNT_HW_BRANCH_MISSES] = { 0x02, CNTR_ODD, T }, 814 [PERF_COUNT_HW_BRANCH_MISSES] = { 0x02, CNTR_ODD, T },
815}; 815};
816 816
817/* 74K core has different branch event code. */ 817/* 74K/proAptiv core has different branch event code. */
818static const struct mips_perf_event mipsxxcore_event_map2 818static const struct mips_perf_event mipsxxcore_event_map2
819 [PERF_COUNT_HW_MAX] = { 819 [PERF_COUNT_HW_MAX] = {
820 [PERF_COUNT_HW_CPU_CYCLES] = { 0x00, CNTR_EVEN | CNTR_ODD, P }, 820 [PERF_COUNT_HW_CPU_CYCLES] = { 0x00, CNTR_EVEN | CNTR_ODD, P },
@@ -930,7 +930,7 @@ static const struct mips_perf_event mipsxxcore_cache_map
930}, 930},
931}; 931};
932 932
933/* 74K core has completely different cache event map. */ 933/* 74K/proAptiv core has completely different cache event map. */
934static const struct mips_perf_event mipsxxcore_cache_map2 934static const struct mips_perf_event mipsxxcore_cache_map2
935 [PERF_COUNT_HW_CACHE_MAX] 935 [PERF_COUNT_HW_CACHE_MAX]
936 [PERF_COUNT_HW_CACHE_OP_MAX] 936 [PERF_COUNT_HW_CACHE_OP_MAX]
@@ -978,6 +978,11 @@ static const struct mips_perf_event mipsxxcore_cache_map2
978 [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN, P }, 978 [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN, P },
979 }, 979 },
980}, 980},
981/*
982 * 74K core does not have specific DTLB events. proAptiv core has
983 * "speculative" DTLB events which are numbered 0x63 (even/odd) and
984 * not included here. One can use raw events if really needed.
985 */
981[C(ITLB)] = { 986[C(ITLB)] = {
982 [C(OP_READ)] = { 987 [C(OP_READ)] = {
983 [C(RESULT_ACCESS)] = { 0x04, CNTR_EVEN, T }, 988 [C(RESULT_ACCESS)] = { 0x04, CNTR_EVEN, T },
@@ -1378,6 +1383,10 @@ static irqreturn_t mipsxx_pmu_handle_irq(int irq, void *dev)
1378#define IS_BOTH_COUNTERS_74K_EVENT(b) \ 1383#define IS_BOTH_COUNTERS_74K_EVENT(b) \
1379 ((b) == 0 || (b) == 1) 1384 ((b) == 0 || (b) == 1)
1380 1385
1386/* proAptiv */
1387#define IS_BOTH_COUNTERS_PROAPTIV_EVENT(b) \
1388 ((b) == 0 || (b) == 1)
1389
1381/* 1004K */ 1390/* 1004K */
1382#define IS_BOTH_COUNTERS_1004K_EVENT(b) \ 1391#define IS_BOTH_COUNTERS_1004K_EVENT(b) \
1383 ((b) == 0 || (b) == 1 || (b) == 11) 1392 ((b) == 0 || (b) == 1 || (b) == 11)
@@ -1452,6 +1461,16 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config)
1452 raw_event.range = P; 1461 raw_event.range = P;
1453#endif 1462#endif
1454 break; 1463 break;
1464 case CPU_PROAPTIV:
1465 if (IS_BOTH_COUNTERS_PROAPTIV_EVENT(base_id))
1466 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
1467 else
1468 raw_event.cntr_mask =
1469 raw_id > 127 ? CNTR_ODD : CNTR_EVEN;
1470#ifdef CONFIG_MIPS_MT_SMP
1471 raw_event.range = P;
1472#endif
1473 break;
1455 case CPU_1004K: 1474 case CPU_1004K:
1456 if (IS_BOTH_COUNTERS_1004K_EVENT(base_id)) 1475 if (IS_BOTH_COUNTERS_1004K_EVENT(base_id))
1457 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD; 1476 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
@@ -1580,6 +1599,11 @@ init_hw_perf_events(void)
1580 mipspmu.general_event_map = &mipsxxcore_event_map2; 1599 mipspmu.general_event_map = &mipsxxcore_event_map2;
1581 mipspmu.cache_event_map = &mipsxxcore_cache_map2; 1600 mipspmu.cache_event_map = &mipsxxcore_cache_map2;
1582 break; 1601 break;
1602 case CPU_PROAPTIV:
1603 mipspmu.name = "mips/proAptiv";
1604 mipspmu.general_event_map = &mipsxxcore_event_map2;
1605 mipspmu.cache_event_map = &mipsxxcore_cache_map2;
1606 break;
1583 case CPU_1004K: 1607 case CPU_1004K:
1584 mipspmu.name = "mips/1004K"; 1608 mipspmu.name = "mips/1004K";
1585 mipspmu.general_event_map = &mipsxxcore_event_map; 1609 mipspmu.general_event_map = &mipsxxcore_event_map;