powerpc/pmu: Make the generic compat PMU use the architected events
authorPaul Mackerras <paulus@ozlabs.org>
Tue, 4 May 2021 07:43:43 +0000 (17:43 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 25 Jun 2021 04:47:20 +0000 (14:47 +1000)
commitd40a82be2f79d16cc18c28c14d267da240659949
tree1b1d68654fb096e4e3589c6a0de308f2d09cff1f
parentbfb0c9fcf5870036e54081b28cae2af5f9ee7088
powerpc/pmu: Make the generic compat PMU use the architected events

This changes generic-compat-pmu.c so that it only uses architected
events defined in Power ISA v3.0B, rather than event encodings which,
while common to all the IBM Power Systems implementations, are
nevertheless implementation-specific rather than architected.  The
intention is that any CPU implementation designed to conform to Power
ISA v3.0B or later can use generic-compat-pmu.c.

In addition to the existing events for cycles and instructions, this
adds several other architected events, including alternative encodings
for some events.  In order to make it possible to measure cycles and
instructions at the same time as each other, we set the CC5-6RUN bit
in MMCR0, which makes PMC5 and PMC6 count instructions and cycles
regardless of the run bit, so their events are now PM_CYC and
PM_INST_CMPL rather than PM_RUN_CYC and PM_RUN_INST_CMPL (the latter
are still available via other event codes).

Note that POWER9 has an erratum where one architected event
(PM_FLOP_CMPL, floating-point operations completed, code 0x100f4) does
not work correctly.  Given that there is a specific PMU driver for P9
which will be used in preference to generic-compat-pmu.c, that is not
a real problem.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/YJD7L9yeoxvxqeYi@thinks.paulus.ozlabs.org
arch/powerpc/perf/generic-compat-pmu.c