summaryrefslogtreecommitdiff
path: root/arch/arm64/include/asm/arm_pmuv3.h
diff options
context:
space:
mode:
authorZaid Al-Bassam <zalbassam@google.com>2023-03-17 22:50:22 +0300
committerWill Deacon <will@kernel.org>2023-03-27 16:01:18 +0300
commit711432770f78e5a9ae235a1a55decfb71993c958 (patch)
tree9bf498bedab09e21f74cf6680e231e7a1a980b7b /arch/arm64/include/asm/arm_pmuv3.h
parentdf29ddf4f04b00cf60669686dc7f534c3ed7c433 (diff)
downloadlinux-711432770f78e5a9ae235a1a55decfb71993c958.tar.xz
perf: pmuv3: Abstract PMU version checks
The current PMU version definitions are available for arm64 only, As we want to add PMUv3 support to arm (32-bit), abstracts these definitions by using arch-specific helpers. Signed-off-by: Zaid Al-Bassam <zalbassam@google.com> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20230317195027.3746949-4-zalbassam@google.com Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/include/asm/arm_pmuv3.h')
-rw-r--r--arch/arm64/include/asm/arm_pmuv3.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h
index c444cbfb3acd..80cdfa4c3e88 100644
--- a/arch/arm64/include/asm/arm_pmuv3.h
+++ b/arch/arm64/include/asm/arm_pmuv3.h
@@ -134,4 +134,20 @@ static inline u32 read_pmceid1(void)
return read_sysreg(pmceid1_el0);
}
+static inline bool pmuv3_implemented(int pmuver)
+{
+ return !(pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF ||
+ pmuver == ID_AA64DFR0_EL1_PMUVer_NI);
+}
+
+static inline bool is_pmuv3p4(int pmuver)
+{
+ return pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P4;
+}
+
+static inline bool is_pmuv3p5(int pmuver)
+{
+ return pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P5;
+}
+
#endif