diff options
author | Mark Rutland <mark.rutland@arm.com> | 2014-05-23 18:11:14 +0100 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2014-10-30 12:16:59 +0000 |
commit | 548a86cae4858433cab7e101bca2c6856ab55887 (patch) | |
tree | 91ec901f7e5bac7fa7645e809b2610cca195d0cc /arch/arm/include/asm/pmu.h | |
parent | 0f2a21018a71d8d3fec507f9c55ae8ed03ab9321 (diff) | |
download | blackbird-op-linux-548a86cae4858433cab7e101bca2c6856ab55887.tar.gz blackbird-op-linux-548a86cae4858433cab7e101bca2c6856ab55887.zip |
arm: perf: make PMU probing data-driven
The current PMU probing logic consists of a single switch statement,
which means that the core arm_pmu core in perf_event_cpu.c needs to know
about every CPU PMU variant supported by a driver using the arm_pmu
framework. This makes it rather difficult to decouple the drivers from
the (otherwise generic) probing code.
The patch refactors that switch statement to a table-driven lookup,
separating the logic and knowledge (in the form of the table). Later
patches will split the table across the relevant PMU drivers, which can
pass their tables to the generic probing function.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm/include/asm/pmu.h')
-rw-r--r-- | arch/arm/include/asm/pmu.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h index 0b648c541293..ff39290965af 100644 --- a/arch/arm/include/asm/pmu.h +++ b/arch/arm/include/asm/pmu.h @@ -15,6 +15,8 @@ #include <linux/interrupt.h> #include <linux/perf_event.h> +#include <asm/cputype.h> + /* * struct arm_pmu_platdata - ARM PMU platform data * @@ -127,6 +129,27 @@ int armpmu_map_event(struct perf_event *event, [PERF_COUNT_HW_CACHE_RESULT_MAX], u32 raw_event_mask); +struct pmu_probe_info { + unsigned int cpuid; + unsigned int mask; + int (*init)(struct arm_pmu *); +}; + +#define PMU_PROBE(_cpuid, _mask, _fn) \ +{ \ + .cpuid = (_cpuid), \ + .mask = (_mask), \ + .init = (_fn), \ +} + +#define ARM_PMU_PROBE(_cpuid, _fn) \ + PMU_PROBE(_cpuid, ARM_CPU_PART_MASK, _fn) + +#define ARM_PMU_XSCALE_MASK ((0xff << 24) | ARM_CPU_XSCALE_ARCH_MASK) + +#define XSCALE_PMU_PROBE(_version, _fn) \ + PMU_PROBE(ARM_CPU_IMP_INTEL << 24 | _version, ARM_PMU_XSCALE_MASK, _fn) + #endif /* CONFIG_HW_PERF_EVENTS */ #endif /* __ARM_PMU_H__ */ |