]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Sep 2023 09:11:00 +0000 (11:11 +0200)
commitd42d342d313206ef0d08d72311b5d86c72a1756e
tree5f6b3278f7f2410891fd7a6e328018ac3e7ec1a1
parent9d9b5cbc12f49fbdbbc454383981039005af8211
perf/imx_ddr: speed up overflow frequency of cycle

[ Upstream commit e89ecd8368860bf05437eabd07d292c316221cfc ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/perf/fsl_imx8_ddr_perf.c