Other Parts Discussed in Thread: OMAP3530
Hi.
I am using a BeagleBoard RevC3 board with OMAP3530. My board's documentation states I am using OMAP ES3.0 silicon, with r1p3 Cortex-A8 MPU and ROM revision 14.04.
I am trying to implement support to use the performance counters built into the ARM Cortex MPU to monitor linux processes. I am using a modified version of linux kernel (kernel-2.6.29) running on top of a microkernel.
The microkernel runs in ARM supervisor mode and linux runs is ARM user mode.
I have problems using my particular OMAP3530 ES3.0's Cortex-A8 MPU to count the function 0x11 (cycle counter) in conjunction with any of the programable counters even if I perform the correct procedure of:
- disabling the PMNC (p15, 0, %0, c9, c12, 0) by reseting the E bit;
- setting up the counter (in this case PMCNT0 although I've tried them all)
- write 0 to PMNXSEL (p15, 0, %0, c9, c12, 5);
- write 0x11 to EVTSEL (p15, 0, %0, c9, c13, 1);
- bit set bit 0 of CNTENS (p15, 0, %0, c9, c12, 1);
- enabling the PMNC by setting the E bit
This procedure worked from the microkernel for other functionalites (like instruction counting) from the begining. I wrote simple inine assembler tests. It did not work for cycles (counter remained at the preset value after count function was set to 0x11).
Once I tried to program any one of the programmable counters with function 0x11, they did not count any more. Since by apllying the same procedure I can count events for different functionalites like instructions, stalls, cache hits and misses it's not the procedure that's responsible.
Initially I was unable to use any of the programmable counters after linux booted up, even if applied the procedure above. After some digging I found out linux was idling a piece of hardware in OMAP3530 which can as a sideeffect disable the PMN counters.
The effect I saw was that when DEBUGAUTHSTATUS @ 0x54011fb8 got to be 0 (because some idling performed by linux) the programmable counters no longer counted when enabled by me (enabling both the PMNC and setting the proper bit in CNTENS).
I guess this register set is reflecting the part of hardware responsible for setting up hardware debug bit in the Cortex-A8 MPU, without which the programable counters are set not to count.
My fix for that is to temporarily disable a function in kernel init that causes stuff to get idled.
Now I am faced with the same problem I had at the microkernel level: OMAP3530's MPU is not counting for programble counters for function 0x11 (cycle count). I can count instructions, cache hits, etc with programable counters, but not cycles. The fixed functionality cycle counter (CCNT) works fine.
I am frustrated since I do not know if the programable counters not counting when using cycle counter as their count function is:
- a software issue that can be solved by applying a patch or
- hardware issue on
- my MPU alone,
- OMAP3 ES3.0 silicon alone,
- or described in the OMAP3530's errata...
Hope somebody has an idea,
Thank you,
Gabi Voiculescu

