aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2011-07-26 17:10:28 -0400
committerWill Deacon <will.deacon@arm.com>2011-08-31 05:17:59 -0400
commitb0e89590f4f27ea5ff30bdedb9a58ea904a6b353 (patch)
tree8d81a0d268dd6780e4c5a7cfa4b9c49708afebc7 /arch/arm/include
parenta6c93afed38c242ccf4ec5bcb5ff26ff2521cf36 (diff)
ARM: PMU: move CPU PMU platform device handling and init into perf
Once upon a time, OProfile and Perf fought hard over who could play with the PMU. To stop all hell from breaking loose, pmu.c offered an internal reserve/release API and took care of parsing PMU platform data passed in from board support code. Now that Perf has ingested OProfile, let's move the platform device handling into the Perf driver and out of the PMU locking code. Unfortunately, the lock has to remain to prevent Perf being bitten by out-of-tree modules such as LTTng, which still claim a right to the PMU when Perf isn't looking. Acked-by: Jamie Iles <jamie@jamieiles.com> Reviewed-by: Jean Pihet <j-pihet@ti.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/pmu.h29
1 files changed, 10 insertions, 19 deletions
diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
index b7e82c4aced6..a06ba8773cd7 100644
--- a/arch/arm/include/asm/pmu.h
+++ b/arch/arm/include/asm/pmu.h
@@ -14,6 +14,10 @@
14 14
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16 16
17/*
18 * Types of PMUs that can be accessed directly and require mutual
19 * exclusion between profiling tools.
20 */
17enum arm_pmu_type { 21enum arm_pmu_type {
18 ARM_PMU_DEVICE_CPU = 0, 22 ARM_PMU_DEVICE_CPU = 0,
19 ARM_NUM_PMU_DEVICES, 23 ARM_NUM_PMU_DEVICES,
@@ -37,21 +41,17 @@ struct arm_pmu_platdata {
37 * reserve_pmu() - reserve the hardware performance counters 41 * reserve_pmu() - reserve the hardware performance counters
38 * 42 *
39 * Reserve the hardware performance counters in the system for exclusive use. 43 * Reserve the hardware performance counters in the system for exclusive use.
40 * The platform_device for the system is returned on success, ERR_PTR() 44 * Returns 0 on success or -EBUSY if the lock is already held.
41 * encoded error on failure.
42 */ 45 */
43extern struct platform_device * 46extern int
44reserve_pmu(enum arm_pmu_type type); 47reserve_pmu(enum arm_pmu_type type);
45 48
46/** 49/**
47 * release_pmu() - Relinquish control of the performance counters 50 * release_pmu() - Relinquish control of the performance counters
48 * 51 *
49 * Release the performance counters and allow someone else to use them. 52 * Release the performance counters and allow someone else to use them.
50 * Callers must have disabled the counters and released IRQs before calling
51 * this. The platform_device returned from reserve_pmu() must be passed as
52 * a cookie.
53 */ 53 */
54extern int 54extern void
55release_pmu(enum arm_pmu_type type); 55release_pmu(enum arm_pmu_type type);
56 56
57/** 57/**
@@ -68,23 +68,14 @@ init_pmu(enum arm_pmu_type type);
68 68
69#include <linux/err.h> 69#include <linux/err.h>
70 70
71static inline struct platform_device *
72reserve_pmu(enum arm_pmu_type type)
73{
74 return ERR_PTR(-ENODEV);
75}
76
77static inline int 71static inline int
78release_pmu(enum arm_pmu_type type) 72reserve_pmu(enum arm_pmu_type type)
79{ 73{
80 return -ENODEV; 74 return -ENODEV;
81} 75}
82 76
83static inline int 77static inline void
84init_pmu(enum arm_pmu_type type) 78release_pmu(enum arm_pmu_type type) { }
85{
86 return -ENODEV;
87}
88 79
89#endif /* CONFIG_CPU_HAS_PMU */ 80#endif /* CONFIG_CPU_HAS_PMU */
90 81