aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/oprofile/op_model_v6.c
diff options
context:
space:
mode:
authorJamie Iles <jamie.iles@picochip.com>2010-02-02 14:24:07 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-02-12 12:23:43 -0500
commit1618fdd9602c689de2f820a88cb3e283a39c3d90 (patch)
treebe2cec6548d61dc83b7fc538fa929533f9cb9112 /arch/arm/oprofile/op_model_v6.c
parent0f4f0672ac950c96cffaf84a666d35e817d7c3ca (diff)
ARM: 5901/2: arm/oprofile: reserve the PMU when starting
Make sure that we have access to the performance counters and that they aren't being used by perf events or anything else. Cc: Will Deacon <will.deacon@arm.com> Cc: Jean Pihet <jpihet@mvista.com> Signed-off-by: Jamie Iles <jamie.iles@picochip.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/oprofile/op_model_v6.c')
-rw-r--r--arch/arm/oprofile/op_model_v6.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/arch/arm/oprofile/op_model_v6.c b/arch/arm/oprofile/op_model_v6.c
index f7d2ec5ee9a1..a22357a2fd08 100644
--- a/arch/arm/oprofile/op_model_v6.c
+++ b/arch/arm/oprofile/op_model_v6.c
@@ -19,39 +19,47 @@
19/* #define DEBUG */ 19/* #define DEBUG */
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/err.h>
22#include <linux/sched.h> 23#include <linux/sched.h>
23#include <linux/oprofile.h> 24#include <linux/oprofile.h>
24#include <linux/interrupt.h> 25#include <linux/interrupt.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/system.h> 27#include <asm/system.h>
28#include <asm/pmu.h>
27 29
28#include "op_counter.h" 30#include "op_counter.h"
29#include "op_arm_model.h" 31#include "op_arm_model.h"
30#include "op_model_arm11_core.h" 32#include "op_model_arm11_core.h"
31 33
32static int irqs[] = { 34static const struct pmu_irqs *pmu_irqs;
33#ifdef CONFIG_ARCH_OMAP2
34 3,
35#endif
36#ifdef CONFIG_ARCH_BCMRING
37 IRQ_PMUIRQ, /* for BCMRING, ARM PMU interrupt is 43 */
38#endif
39};
40 35
41static void armv6_pmu_stop(void) 36static void armv6_pmu_stop(void)
42{ 37{
43 arm11_stop_pmu(); 38 arm11_stop_pmu();
44 arm11_release_interrupts(irqs, ARRAY_SIZE(irqs)); 39 arm11_release_interrupts(pmu_irqs->irqs, pmu_irqs->num_irqs);
40 release_pmu(pmu_irqs);
41 pmu_irqs = NULL;
45} 42}
46 43
47static int armv6_pmu_start(void) 44static int armv6_pmu_start(void)
48{ 45{
49 int ret; 46 int ret;
50 47
51 ret = arm11_request_interrupts(irqs, ARRAY_SIZE(irqs)); 48 pmu_irqs = reserve_pmu();
52 if (ret >= 0) 49 if (IS_ERR(pmu_irqs)) {
50 ret = PTR_ERR(pmu_irqs);
51 goto out;
52 }
53
54 ret = arm11_request_interrupts(pmu_irqs->irqs, pmu_irqs->num_irqs);
55 if (ret >= 0) {
53 ret = arm11_start_pmu(); 56 ret = arm11_start_pmu();
57 } else {
58 release_pmu(pmu_irqs);
59 pmu_irqs = NULL;
60 }
54 61
62out:
55 return ret; 63 return ret;
56} 64}
57 65