diff options
author | Catalin Udma <catalin.udma@freescale.com> | 2013-06-05 16:22:08 -0400 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2013-08-07 19:38:03 -0400 |
commit | 96c3c9e78f7fe45303985cce13ce26e35afd01ba (patch) | |
tree | 96f0e95f0472e909dde39b3e1afe505a53398d2e | |
parent | a9a5cda06922545ed7540cf5ed7e5ad6b80851d9 (diff) |
powerpc/perf: increase the perf HW events to 6
This change is required after the e6500 perf support has been added.
There are 6 counters in e6500 core instead of 4 in e500 core and
the MAX_HWEVENTS counter should be changed accordingly from 4 to 6.
Added also runtime check for counters overflow.
Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
-rw-r--r-- | arch/powerpc/include/asm/perf_event_fsl_emb.h | 2 | ||||
-rw-r--r-- | arch/powerpc/perf/core-fsl-emb.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/perf_event_fsl_emb.h b/arch/powerpc/include/asm/perf_event_fsl_emb.h index 718a9fa94e68..a58165450f6f 100644 --- a/arch/powerpc/include/asm/perf_event_fsl_emb.h +++ b/arch/powerpc/include/asm/perf_event_fsl_emb.h | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <asm/hw_irq.h> | 14 | #include <asm/hw_irq.h> |
15 | 15 | ||
16 | #define MAX_HWEVENTS 4 | 16 | #define MAX_HWEVENTS 6 |
17 | 17 | ||
18 | /* event flags */ | 18 | /* event flags */ |
19 | #define FSL_EMB_EVENT_VALID 1 | 19 | #define FSL_EMB_EVENT_VALID 1 |
diff --git a/arch/powerpc/perf/core-fsl-emb.c b/arch/powerpc/perf/core-fsl-emb.c index 106c53354675..0b13f74f5fb3 100644 --- a/arch/powerpc/perf/core-fsl-emb.c +++ b/arch/powerpc/perf/core-fsl-emb.c | |||
@@ -462,6 +462,12 @@ static int fsl_emb_pmu_event_init(struct perf_event *event) | |||
462 | int num_restricted; | 462 | int num_restricted; |
463 | int i; | 463 | int i; |
464 | 464 | ||
465 | if (ppmu->n_counter > MAX_HWEVENTS) { | ||
466 | WARN(1, "No. of perf counters (%d) is higher than max array size(%d)\n", | ||
467 | ppmu->n_counter, MAX_HWEVENTS); | ||
468 | ppmu->n_counter = MAX_HWEVENTS; | ||
469 | } | ||
470 | |||
465 | switch (event->attr.type) { | 471 | switch (event->attr.type) { |
466 | case PERF_TYPE_HARDWARE: | 472 | case PERF_TYPE_HARDWARE: |
467 | ev = event->attr.config; | 473 | ev = event->attr.config; |