aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/litmus.c
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2012-10-12 14:53:58 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2012-10-12 15:13:23 -0400
commit1278828e332e1c697c35110dbe8dd2f0b18c80c5 (patch)
tree0c421def156fd802de57b0faaeffd14f9ebdd9e0 /litmus/litmus.c
parenta15b72cc9e991b37b6929c5c6e0ee014fb542ecd (diff)
Fix cycle counters for ARM v7 CPUs.
Conflicts: arch/arm/mach-omap2/board-omap4panda.c Signed-off-by: Christopher Kenna <cjk@cs.unc.edu>
Diffstat (limited to 'litmus/litmus.c')
-rw-r--r--litmus/litmus.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c
index 1bbad8db1a55..531a2245133d 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -656,6 +656,35 @@ static struct sysrq_key_op sysrq_kill_rt_tasks_op = {
656 656
657extern struct sched_plugin linux_sched_plugin; 657extern struct sched_plugin linux_sched_plugin;
658 658
659#if defined(CONFIG_CPU_V7) && !defined(CONFIG_HW_PERF_EVENTS)
660static void __init litmus_enable_perfcounters_v7(void *_ignore)
661{
662 u32 enable_val;
663
664 /* write 1 to enable user-mode access to the performance counter */
665 asm volatile("mcr p15, 0, %0, c9, c14, 0" : : "r" (1));
666
667 /* disable counter overflow interrupts (just in case) */
668 asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (0x8000000f));
669
670 enable_val = 1; /* bit 1 enables the counters */
671 enable_val |= 2; /* resets cycle counter to zero */
672 /* performance monitor control register: enable all counters */
673 asm volatile("mcr p15, 0, %0, c9, c12, 0" : : "r"(enable_val));
674
675 /* enables counters (currently just cycle counter) */
676 asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r"(0x80000000));
677}
678
679static void __init litmus_enable_perfcounters(void)
680{
681 litmus_enable_perfcounters_v7(NULL);
682 smp_call_function(litmus_enable_perfcounters_v7, NULL, 0);
683}
684#else
685#define litmus_enable_perfcounters() do { } while (0)
686#endif
687
659static int __init _init_litmus(void) 688static int __init _init_litmus(void)
660{ 689{
661 /* Common initializers, 690 /* Common initializers,
@@ -691,6 +720,8 @@ static int __init _init_litmus(void)
691 init_topology(); 720 init_topology();
692#endif 721#endif
693 722
723 litmus_enable_perfcounters();
724
694 return 0; 725 return 0;
695} 726}
696 727