~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm64/include/asm/arm_dsu_pmu.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * ARM DynamIQ Shared Unit (DSU) PMU Low level register access routines.
  4  *
  5  * Copyright (C) ARM Limited, 2017.
  6  *
  7  * Author: Suzuki K Poulose <suzuki.poulose@arm.com>
  8  */
  9 
 10 #include <linux/bitops.h>
 11 #include <linux/build_bug.h>
 12 #include <linux/compiler.h>
 13 #include <linux/types.h>
 14 #include <asm/barrier.h>
 15 #include <asm/sysreg.h>
 16 
 17 
 18 #define CLUSTERPMCR_EL1                 sys_reg(3, 0, 15, 5, 0)
 19 #define CLUSTERPMCNTENSET_EL1           sys_reg(3, 0, 15, 5, 1)
 20 #define CLUSTERPMCNTENCLR_EL1           sys_reg(3, 0, 15, 5, 2)
 21 #define CLUSTERPMOVSSET_EL1             sys_reg(3, 0, 15, 5, 3)
 22 #define CLUSTERPMOVSCLR_EL1             sys_reg(3, 0, 15, 5, 4)
 23 #define CLUSTERPMSELR_EL1               sys_reg(3, 0, 15, 5, 5)
 24 #define CLUSTERPMINTENSET_EL1           sys_reg(3, 0, 15, 5, 6)
 25 #define CLUSTERPMINTENCLR_EL1           sys_reg(3, 0, 15, 5, 7)
 26 #define CLUSTERPMCCNTR_EL1              sys_reg(3, 0, 15, 6, 0)
 27 #define CLUSTERPMXEVTYPER_EL1           sys_reg(3, 0, 15, 6, 1)
 28 #define CLUSTERPMXEVCNTR_EL1            sys_reg(3, 0, 15, 6, 2)
 29 #define CLUSTERPMMDCR_EL1               sys_reg(3, 0, 15, 6, 3)
 30 #define CLUSTERPMCEID0_EL1              sys_reg(3, 0, 15, 6, 4)
 31 #define CLUSTERPMCEID1_EL1              sys_reg(3, 0, 15, 6, 5)
 32 
 33 static inline u32 __dsu_pmu_read_pmcr(void)
 34 {
 35         return read_sysreg_s(CLUSTERPMCR_EL1);
 36 }
 37 
 38 static inline void __dsu_pmu_write_pmcr(u32 val)
 39 {
 40         write_sysreg_s(val, CLUSTERPMCR_EL1);
 41         isb();
 42 }
 43 
 44 static inline u32 __dsu_pmu_get_reset_overflow(void)
 45 {
 46         u32 val = read_sysreg_s(CLUSTERPMOVSCLR_EL1);
 47         /* Clear the bit */
 48         write_sysreg_s(val, CLUSTERPMOVSCLR_EL1);
 49         isb();
 50         return val;
 51 }
 52 
 53 static inline void __dsu_pmu_select_counter(int counter)
 54 {
 55         write_sysreg_s(counter, CLUSTERPMSELR_EL1);
 56         isb();
 57 }
 58 
 59 static inline u64 __dsu_pmu_read_counter(int counter)
 60 {
 61         __dsu_pmu_select_counter(counter);
 62         return read_sysreg_s(CLUSTERPMXEVCNTR_EL1);
 63 }
 64 
 65 static inline void __dsu_pmu_write_counter(int counter, u64 val)
 66 {
 67         __dsu_pmu_select_counter(counter);
 68         write_sysreg_s(val, CLUSTERPMXEVCNTR_EL1);
 69         isb();
 70 }
 71 
 72 static inline void __dsu_pmu_set_event(int counter, u32 event)
 73 {
 74         __dsu_pmu_select_counter(counter);
 75         write_sysreg_s(event, CLUSTERPMXEVTYPER_EL1);
 76         isb();
 77 }
 78 
 79 static inline u64 __dsu_pmu_read_pmccntr(void)
 80 {
 81         return read_sysreg_s(CLUSTERPMCCNTR_EL1);
 82 }
 83 
 84 static inline void __dsu_pmu_write_pmccntr(u64 val)
 85 {
 86         write_sysreg_s(val, CLUSTERPMCCNTR_EL1);
 87         isb();
 88 }
 89 
 90 static inline void __dsu_pmu_disable_counter(int counter)
 91 {
 92         write_sysreg_s(BIT(counter), CLUSTERPMCNTENCLR_EL1);
 93         isb();
 94 }
 95 
 96 static inline void __dsu_pmu_enable_counter(int counter)
 97 {
 98         write_sysreg_s(BIT(counter), CLUSTERPMCNTENSET_EL1);
 99         isb();
100 }
101 
102 static inline void __dsu_pmu_counter_interrupt_enable(int counter)
103 {
104         write_sysreg_s(BIT(counter), CLUSTERPMINTENSET_EL1);
105         isb();
106 }
107 
108 static inline void __dsu_pmu_counter_interrupt_disable(int counter)
109 {
110         write_sysreg_s(BIT(counter), CLUSTERPMINTENCLR_EL1);
111         isb();
112 }
113 
114 
115 static inline u32 __dsu_pmu_read_pmceid(int n)
116 {
117         switch (n) {
118         case 0:
119                 return read_sysreg_s(CLUSTERPMCEID0_EL1);
120         case 1:
121                 return read_sysreg_s(CLUSTERPMCEID1_EL1);
122         default:
123                 BUILD_BUG();
124                 return 0;
125         }
126 }
127 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php