]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
perf/imx_ddr: Add stop event counters support for i.MX8MP
authorJoakim Zhang <qiangqing.zhang@nxp.com>
Tue, 27 Oct 2020 10:44:51 +0000 (18:44 +0800)
committerWill Deacon <will@kernel.org>
Wed, 25 Nov 2020 15:14:41 +0000 (15:14 +0000)
commit6b46338f2210e37deeb3cdd40b04e3c597b47570
treeb8c597e9e51cf792be18cb88f8b25947d5df3665
parent2c255223362e9747075320ba618bd5960b76e04f
perf/imx_ddr: Add stop event counters support for i.MX8MP

DDR Perf driver only supports free-running event counters(counter1/2/3)
now, this patch adds support for stop event counters.

Legacy SoCs:
Cycle counter(counter0) is a special counter, only count cycles. When
cycle counter overflow, it will lock all counters and generate an
interrupt. In ddr_perf_irq_handler, disable cycle counter then all
counters would stop at the same time, update all counters' count, then
enable cycle counter that all counters count again. During this process,
only clear cycle counter, no need to clear event counters since they are
free-running counters. They would continue counting after overflow and
do/while loop from ddr_perf_event_update can handle event counters
overflow case.

i.MX8MP:
Almost all is the same as legacy SoCs, the only difference is that, event
counters are not free-running any more. Like cycle counter, when event
counters overflow, they would stop counting unless clear the counter,
and no interrupt generate for event counters. So we should clear event
counters that let them re-count when cycle counter overflow, which ensure
event counters will not lose data.

This patch adds stop event counters support which would be compatible to
free-running event counters. We use the cycle counter to stop overflow
of the event counters.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Link: https://lore.kernel.org/r/20201027104451.15434-1-qiangqing.zhang@nxp.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/perf/fsl_imx8_ddr_perf.c