Yesterday I've tried to get access to the Omap3 performance counters.
To enable usermode access I wrote a minimal kernel-module that toggles
the performance counter user-mode access flag in the coprocessor. The
module worked out of the box.
I'm now able to read the cycle counter register. I can reset all
event-counters, read and write to them, setup events and so on without
problems. However, no matter what I program into the event-registers,
the counter-register never increase. :-(
I found some old posts on this list regarding the same issue, so I
wonder if someone has solved the problem in the meantime.
Btw: I'm running my tests on a rev. B4 beagleboard which as far as I
know has very early silicon. Is it possible that the performance
counters are simply not functional with this revision?
Cheers,
Nils
Are you declaring your pointers as volatile? Maybe gcc is optimizing
out your reads from the counter register?
b.g.
--
Bill Gatliff
bg...@billgatliff.com
Thanks for answering.
The registers are not memory mapped but reside inside the coprocessor.
I use an asm volatile inline-assembler code block to read them, so the
compiler can't optimize them out. I also checked the disassembly to make
sure everything compiles as expected.. Looks fine so far..
Cheers,
Nils Pipenbrinck
I've tried the code, but it has exactly the same problem as mine. The
thread also shows that I'm not the first one who has these problems. I
can access the performance-counters (no exceptions generated), but they
never increase in value.
After some further digging I found out that there are two bits that
further control access to performance counters. It's NIDEN and DBGEN.
After boot these are zero. I checked that via one of the CP14 debug
registers.
Digging deeper:
DBGEN is not a bit in some register but a signal. Seems like I need a
JTAG-devide to set it.
NIDEN otoh is a ordinary register bit. I could set it in the "Secure
Debug Enable Register" of CP15. Unfortunately I need secure privileged
mode to do so.
Twiddeling this bit from a kernel-module results in exceptions. Guess
I'm not secure or privileged enough at the moment.
Any idea how to execute code in this secure mode? I thought executing
stuff from the kernel is the most privileged thing I could do.
Cheers,
Nils Pipenbrinck