tools/perf/pmu-events/powerpc: Add support for compat events in json
authorAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Thu, 10 Oct 2024 14:51:06 +0000 (20:21 +0530)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 17 Oct 2024 18:24:52 +0000 (11:24 -0700)
commit86f45d0f17d2f4d4857a8553673add9c71fb45aa
tree4f1427a39ec329bfa60cf9841a8e4c5ba08cc92b
parent05a62936e6b14c005db3b0c9c7d8b93d825dd9ca
tools/perf/pmu-events/powerpc: Add support for compat events in json

perf list picks the events supported for specific platform
from pmu-events/arch/powerpc/<platform>. Example power10 events
are in pmu-events/arch/powerpc/power10, power9 events are part
of pmu-events/arch/powerpc/power9. The decision of which
platform to pick is determined based on PVR value in powerpc.
The PVR value is matched from pmu-events/arch/powerpc/mapfile.csv

Example:

Format:
        PVR,Version,JSON/file/pathname,Type

0x004[bcd][[:xdigit:]]{4},1,power8,core
0x0066[[:xdigit:]]{4},1,power8,core
0x004e[[:xdigit:]]{4},1,power9,core
0x0080[[:xdigit:]]{4},1,power10,core
0x0082[[:xdigit:]]{4},1,power10,core

The code gets the PVR from system using get_cpuid_str function
in arch/powerpc/util/headers.c ( from SPRN_PVR ) and compares
with value from mapfile.csv

In case of compat mode, say when partition is booted in a power9
mode when the system is a power10, add an entry to pick the
ISA architected events from "pmu-events/arch/powerpc/compat".
Add json file generic-events.json which will contain these
events which is supported in compat mode.

Suggested-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Tested-by: Disha Goel <disgoel@linux.ibm.com>
Cc: akanksha@linux.ibm.com
Cc: hbathini@linux.ibm.com
Cc: kjain@linux.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20241010145107.51211-1-atrajeev@linux.vnet.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/pmu-events/arch/powerpc/compat/generic-events.json [new file with mode: 0644]
tools/perf/pmu-events/arch/powerpc/mapfile.csv