perf/imx_ddr: speed up overflow frequency of cycle
authorXu Yang <xu.yang_2@nxp.com>
Fri, 11 Aug 2023 01:54:37 +0000 (09:54 +0800)
committerWill Deacon <will@kernel.org>
Wed, 16 Aug 2023 13:32:47 +0000 (14:32 +0100)
commite89ecd8368860bf05437eabd07d292c316221cfc
treeaa1d597bf498569687c4ae041232c372f2464c0d
parent83a6d80c2bfd1d348e5e7079af21a924fdc5c972
perf/imx_ddr: speed up overflow frequency of cycle

For i.MX8MP, we cannot ensure that cycle counter overflow occurs at least
4 times as often as other events. Due to byte counters will count for any
event configured, it will overflow more often. And if byte counters
overflow that related counters would stop since they share the
COUNTER_CNTL. We can speed up cycle counter overflow frequency by setting
counter parameter (CP) field of cycle counter. In this way, we can avoid
stop counting byte counters when interrupt didn't come and the byte
counters can be fetched or updated from each cycle counter overflow
interrupt.

Because we initialize CP filed to shorten counter0 overflow time, the cycle
counter will start couting from a fixed/base value each time. We need to
remove the base from the result too. Therefore, we could get precise result
from cycle counter.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20230811015438.1999307-1-xu.yang_2@nxp.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/perf/fsl_imx8_ddr_perf.c