162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci#ifndef __ASM_APPLE_M1_PMU_h 462306a36Sopenharmony_ci#define __ASM_APPLE_M1_PMU_h 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#include <linux/bits.h> 762306a36Sopenharmony_ci#include <asm/sysreg.h> 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci/* Counters */ 1062306a36Sopenharmony_ci#define SYS_IMP_APL_PMC0_EL1 sys_reg(3, 2, 15, 0, 0) 1162306a36Sopenharmony_ci#define SYS_IMP_APL_PMC1_EL1 sys_reg(3, 2, 15, 1, 0) 1262306a36Sopenharmony_ci#define SYS_IMP_APL_PMC2_EL1 sys_reg(3, 2, 15, 2, 0) 1362306a36Sopenharmony_ci#define SYS_IMP_APL_PMC3_EL1 sys_reg(3, 2, 15, 3, 0) 1462306a36Sopenharmony_ci#define SYS_IMP_APL_PMC4_EL1 sys_reg(3, 2, 15, 4, 0) 1562306a36Sopenharmony_ci#define SYS_IMP_APL_PMC5_EL1 sys_reg(3, 2, 15, 5, 0) 1662306a36Sopenharmony_ci#define SYS_IMP_APL_PMC6_EL1 sys_reg(3, 2, 15, 6, 0) 1762306a36Sopenharmony_ci#define SYS_IMP_APL_PMC7_EL1 sys_reg(3, 2, 15, 7, 0) 1862306a36Sopenharmony_ci#define SYS_IMP_APL_PMC8_EL1 sys_reg(3, 2, 15, 9, 0) 1962306a36Sopenharmony_ci#define SYS_IMP_APL_PMC9_EL1 sys_reg(3, 2, 15, 10, 0) 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci/* Core PMC control register */ 2262306a36Sopenharmony_ci#define SYS_IMP_APL_PMCR0_EL1 sys_reg(3, 1, 15, 0, 0) 2362306a36Sopenharmony_ci#define PMCR0_CNT_ENABLE_0_7 GENMASK(7, 0) 2462306a36Sopenharmony_ci#define PMCR0_IMODE GENMASK(10, 8) 2562306a36Sopenharmony_ci#define PMCR0_IMODE_OFF 0 2662306a36Sopenharmony_ci#define PMCR0_IMODE_PMI 1 2762306a36Sopenharmony_ci#define PMCR0_IMODE_AIC 2 2862306a36Sopenharmony_ci#define PMCR0_IMODE_HALT 3 2962306a36Sopenharmony_ci#define PMCR0_IMODE_FIQ 4 3062306a36Sopenharmony_ci#define PMCR0_IACT BIT(11) 3162306a36Sopenharmony_ci#define PMCR0_PMI_ENABLE_0_7 GENMASK(19, 12) 3262306a36Sopenharmony_ci#define PMCR0_STOP_CNT_ON_PMI BIT(20) 3362306a36Sopenharmony_ci#define PMCR0_CNT_GLOB_L2C_EVT BIT(21) 3462306a36Sopenharmony_ci#define PMCR0_DEFER_PMI_TO_ERET BIT(22) 3562306a36Sopenharmony_ci#define PMCR0_ALLOW_CNT_EN_EL0 BIT(30) 3662306a36Sopenharmony_ci#define PMCR0_CNT_ENABLE_8_9 GENMASK(33, 32) 3762306a36Sopenharmony_ci#define PMCR0_PMI_ENABLE_8_9 GENMASK(45, 44) 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define SYS_IMP_APL_PMCR1_EL1 sys_reg(3, 1, 15, 1, 0) 4062306a36Sopenharmony_ci#define PMCR1_COUNT_A64_EL0_0_7 GENMASK(15, 8) 4162306a36Sopenharmony_ci#define PMCR1_COUNT_A64_EL1_0_7 GENMASK(23, 16) 4262306a36Sopenharmony_ci#define PMCR1_COUNT_A64_EL0_8_9 GENMASK(41, 40) 4362306a36Sopenharmony_ci#define PMCR1_COUNT_A64_EL1_8_9 GENMASK(49, 48) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define SYS_IMP_APL_PMCR2_EL1 sys_reg(3, 1, 15, 2, 0) 4662306a36Sopenharmony_ci#define SYS_IMP_APL_PMCR3_EL1 sys_reg(3, 1, 15, 3, 0) 4762306a36Sopenharmony_ci#define SYS_IMP_APL_PMCR4_EL1 sys_reg(3, 1, 15, 4, 0) 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci#define SYS_IMP_APL_PMESR0_EL1 sys_reg(3, 1, 15, 5, 0) 5062306a36Sopenharmony_ci#define PMESR0_EVT_CNT_2 GENMASK(7, 0) 5162306a36Sopenharmony_ci#define PMESR0_EVT_CNT_3 GENMASK(15, 8) 5262306a36Sopenharmony_ci#define PMESR0_EVT_CNT_4 GENMASK(23, 16) 5362306a36Sopenharmony_ci#define PMESR0_EVT_CNT_5 GENMASK(31, 24) 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci#define SYS_IMP_APL_PMESR1_EL1 sys_reg(3, 1, 15, 6, 0) 5662306a36Sopenharmony_ci#define PMESR1_EVT_CNT_6 GENMASK(7, 0) 5762306a36Sopenharmony_ci#define PMESR1_EVT_CNT_7 GENMASK(15, 8) 5862306a36Sopenharmony_ci#define PMESR1_EVT_CNT_8 GENMASK(23, 16) 5962306a36Sopenharmony_ci#define PMESR1_EVT_CNT_9 GENMASK(31, 24) 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#define SYS_IMP_APL_PMSR_EL1 sys_reg(3, 1, 15, 13, 0) 6262306a36Sopenharmony_ci#define PMSR_OVERFLOW GENMASK(9, 0) 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#endif /* __ASM_APPLE_M1_PMU_h */ 65