diff options
author | Madhavan Srinivasan <maddy@linux.ibm.com> | 2021-04-08 13:15:04 +0530 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-04-19 12:22:09 +1000 |
commit | d8a1d6c58986d8778768b15dc5bac0b4b082d345 (patch) | |
tree | e5587fed4f4456e3efbd76375fe672272263474a /arch/powerpc/perf/power10-pmu.c | |
parent | a38cb4171928f622c8c0ab7902971516540cacad (diff) | |
download | linux-d8a1d6c58986d8778768b15dc5bac0b4b082d345.tar.bz2 |
powerpc/perf: Add platform specific check_attr_config
Add platform specific attr.config value checks. Patch
includes checks for both power9 and power10.
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210408074504.248211-2-maddy@linux.ibm.com
Diffstat (limited to 'arch/powerpc/perf/power10-pmu.c')
-rw-r--r-- | arch/powerpc/perf/power10-pmu.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/perf/power10-pmu.c b/arch/powerpc/perf/power10-pmu.c index a901c1348cad..f9d64c63bb4a 100644 --- a/arch/powerpc/perf/power10-pmu.c +++ b/arch/powerpc/perf/power10-pmu.c @@ -106,6 +106,18 @@ static int power10_get_alternatives(u64 event, unsigned int flags, u64 alt[]) return num_alt; } +static int power10_check_attr_config(struct perf_event *ev) +{ + u64 val; + u64 event = ev->attr.config; + + val = (event >> EVENT_SAMPLE_SHIFT) & EVENT_SAMPLE_MASK; + if (val == 0x10 || isa3XX_check_attr_config(ev)) + return -EINVAL; + + return 0; +} + GENERIC_EVENT_ATTR(cpu-cycles, PM_RUN_CYC); GENERIC_EVENT_ATTR(instructions, PM_RUN_INST_CMPL); GENERIC_EVENT_ATTR(branch-instructions, PM_BR_CMPL); @@ -559,6 +571,7 @@ static struct power_pmu power10_pmu = { .attr_groups = power10_pmu_attr_groups, .bhrb_nr = 32, .capabilities = PERF_PMU_CAP_EXTENDED_REGS, + .check_attr_config = power10_check_attr_config, }; int init_power10_pmu(void) |