You should set SUNIDEN and SUIDEN bit on Secure Debug Enable Register. (Cf "C12.4.1 Interaction with Security Extensions", "C12.1.7 Effects of non-invasive debug authentication on the Performance Monitors, "B4.1.131 SDER Secure Debug Enable Register, Security Extensions" of "ARM Architecture Reference Manual ARMv7-A and ARMv7-R").
To test this solution you can use prabindh/peemuperf · GitHub
Patch peemuperf_entry.c
--- peemuperf_entry.c.origi 2013-06-27 18:00:17.136793148 +0200
+++ peemuperf_entry.c 2013-06-27 18:00:52.228791934 +0200
@@ -46,6 +46,19 @@
static void pmu_start(unsigned int event_array[],unsigned int count)
{
int i;
+ {
+ u32 val = 0;
+ // SDER
+ asm volatile("mrc p15, 0, %0, c1, c1, 1" : "=r" (val));
+ printk(KERN_ALERT "Lecture de SDER avant %u\n", val);
+
+ val = 0b11;
+ asm volatile("mcr p15, 0, %0, c1, c1, 1" : : "r" (val));
+
+ asm volatile("mrc p15, 0, %0, c1, c1, 1" : "=r" (val));
+ printk(KERN_ALERT "Lecture de SDER apres %u\n", val);
+ }
+
enable_pmu(); // Enable the PMU
reset_ccnt(); // Reset the CCNT (cycle counter)
reset_pmn(); // Reset the configurable counters
Compile the module and run it, it should works.
I will submit a patch for linux perf_event in few days.