111db7410SMarc Zyngier // SPDX-License-Identifier: GPL-2.0 211db7410SMarc Zyngier 311db7410SMarc Zyngier #ifndef __ASM_APPLE_M1_PMU_h 411db7410SMarc Zyngier #define __ASM_APPLE_M1_PMU_h 511db7410SMarc Zyngier 611db7410SMarc Zyngier #include <linux/bits.h> 711db7410SMarc Zyngier #include <asm/sysreg.h> 811db7410SMarc Zyngier 9*a639027aSMarc Zyngier /* Counters */ 10*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC0_EL1 sys_reg(3, 2, 15, 0, 0) 11*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC1_EL1 sys_reg(3, 2, 15, 1, 0) 12*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC2_EL1 sys_reg(3, 2, 15, 2, 0) 13*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC3_EL1 sys_reg(3, 2, 15, 3, 0) 14*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC4_EL1 sys_reg(3, 2, 15, 4, 0) 15*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC5_EL1 sys_reg(3, 2, 15, 5, 0) 16*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC6_EL1 sys_reg(3, 2, 15, 6, 0) 17*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC7_EL1 sys_reg(3, 2, 15, 7, 0) 18*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC8_EL1 sys_reg(3, 2, 15, 9, 0) 19*a639027aSMarc Zyngier #define SYS_IMP_APL_PMC9_EL1 sys_reg(3, 2, 15, 10, 0) 20*a639027aSMarc Zyngier 2111db7410SMarc Zyngier /* Core PMC control register */ 2211db7410SMarc Zyngier #define SYS_IMP_APL_PMCR0_EL1 sys_reg(3, 1, 15, 0, 0) 23*a639027aSMarc Zyngier #define PMCR0_CNT_ENABLE_0_7 GENMASK(7, 0) 2411db7410SMarc Zyngier #define PMCR0_IMODE GENMASK(10, 8) 2511db7410SMarc Zyngier #define PMCR0_IMODE_OFF 0 2611db7410SMarc Zyngier #define PMCR0_IMODE_PMI 1 2711db7410SMarc Zyngier #define PMCR0_IMODE_AIC 2 2811db7410SMarc Zyngier #define PMCR0_IMODE_HALT 3 2911db7410SMarc Zyngier #define PMCR0_IMODE_FIQ 4 3011db7410SMarc Zyngier #define PMCR0_IACT BIT(11) 31*a639027aSMarc Zyngier #define PMCR0_PMI_ENABLE_0_7 GENMASK(19, 12) 32*a639027aSMarc Zyngier #define PMCR0_STOP_CNT_ON_PMI BIT(20) 33*a639027aSMarc Zyngier #define PMCR0_CNT_GLOB_L2C_EVT BIT(21) 34*a639027aSMarc Zyngier #define PMCR0_DEFER_PMI_TO_ERET BIT(22) 35*a639027aSMarc Zyngier #define PMCR0_ALLOW_CNT_EN_EL0 BIT(30) 36*a639027aSMarc Zyngier #define PMCR0_CNT_ENABLE_8_9 GENMASK(33, 32) 37*a639027aSMarc Zyngier #define PMCR0_PMI_ENABLE_8_9 GENMASK(45, 44) 38*a639027aSMarc Zyngier 39*a639027aSMarc Zyngier #define SYS_IMP_APL_PMCR1_EL1 sys_reg(3, 1, 15, 1, 0) 40*a639027aSMarc Zyngier #define PMCR1_COUNT_A64_EL0_0_7 GENMASK(15, 8) 41*a639027aSMarc Zyngier #define PMCR1_COUNT_A64_EL1_0_7 GENMASK(23, 16) 42*a639027aSMarc Zyngier #define PMCR1_COUNT_A64_EL0_8_9 GENMASK(41, 40) 43*a639027aSMarc Zyngier #define PMCR1_COUNT_A64_EL1_8_9 GENMASK(49, 48) 44*a639027aSMarc Zyngier 45*a639027aSMarc Zyngier #define SYS_IMP_APL_PMCR2_EL1 sys_reg(3, 1, 15, 2, 0) 46*a639027aSMarc Zyngier #define SYS_IMP_APL_PMCR3_EL1 sys_reg(3, 1, 15, 3, 0) 47*a639027aSMarc Zyngier #define SYS_IMP_APL_PMCR4_EL1 sys_reg(3, 1, 15, 4, 0) 48*a639027aSMarc Zyngier 49*a639027aSMarc Zyngier #define SYS_IMP_APL_PMESR0_EL1 sys_reg(3, 1, 15, 5, 0) 50*a639027aSMarc Zyngier #define PMESR0_EVT_CNT_2 GENMASK(7, 0) 51*a639027aSMarc Zyngier #define PMESR0_EVT_CNT_3 GENMASK(15, 8) 52*a639027aSMarc Zyngier #define PMESR0_EVT_CNT_4 GENMASK(23, 16) 53*a639027aSMarc Zyngier #define PMESR0_EVT_CNT_5 GENMASK(31, 24) 54*a639027aSMarc Zyngier 55*a639027aSMarc Zyngier #define SYS_IMP_APL_PMESR1_EL1 sys_reg(3, 1, 15, 6, 0) 56*a639027aSMarc Zyngier #define PMESR1_EVT_CNT_6 GENMASK(7, 0) 57*a639027aSMarc Zyngier #define PMESR1_EVT_CNT_7 GENMASK(15, 8) 58*a639027aSMarc Zyngier #define PMESR1_EVT_CNT_8 GENMASK(23, 16) 59*a639027aSMarc Zyngier #define PMESR1_EVT_CNT_9 GENMASK(31, 24) 60*a639027aSMarc Zyngier 61*a639027aSMarc Zyngier #define SYS_IMP_APL_PMSR_EL1 sys_reg(3, 1, 15, 13, 0) 62*a639027aSMarc Zyngier #define PMSR_OVERFLOW GENMASK(9, 0) 6311db7410SMarc Zyngier 6411db7410SMarc Zyngier #endif /* __ASM_APPLE_M1_PMU_h */ 65