Commit 0319a977 authored by Dimitris Papastamos's avatar Dimitris Papastamos
Browse files

Implement support for the Activity Monitor Unit on Cortex A75



The Cortex A75 has 5 AMU counters.  The first three counters are fixed
and the remaining two are programmable.

A new build option is introduced, `ENABLE_AMU`.  When set, the fixed
counters will be enabled for use by lower ELs.  The programmable
counters are currently disabled.

Change-Id: I4bd5208799bb9ed7d2596e8b0bfc87abbbe18740
Signed-off-by: default avatarDimitris Papastamos <dimitris.papastamos@arm.com>
parent 11a70d7e
......@@ -456,6 +456,7 @@ $(eval $(call assert_boolean,CTX_INCLUDE_AARCH32_REGS))
$(eval $(call assert_boolean,CTX_INCLUDE_FPREGS))
$(eval $(call assert_boolean,DEBUG))
$(eval $(call assert_boolean,DISABLE_PEDANTIC))
$(eval $(call assert_boolean,ENABLE_AMU))
$(eval $(call assert_boolean,ENABLE_ASSERTIONS))
$(eval $(call assert_boolean,ENABLE_PLAT_COMPAT))
$(eval $(call assert_boolean,ENABLE_PMF))
......@@ -495,6 +496,7 @@ $(eval $(call add_define,ARM_GIC_ARCH))
$(eval $(call add_define,COLD_BOOT_SINGLE_CPU))
$(eval $(call add_define,CTX_INCLUDE_AARCH32_REGS))
$(eval $(call add_define,CTX_INCLUDE_FPREGS))
$(eval $(call add_define,ENABLE_AMU))
$(eval $(call add_define,ENABLE_ASSERTIONS))
$(eval $(call add_define,ENABLE_PLAT_COMPAT))
$(eval $(call add_define,ENABLE_PMF))
......
......@@ -321,6 +321,10 @@ Common build options
payload. Please refer to the "Booting an EL3 payload" section for more
details.
- ``ENABLE_AMU``: Boolean option to enable Activity Monitor Unit extensions.
Currently this option only applies for platforms that include a v8.2 processor
with AMU implemented. Default is 0.
- ``ENABLE_ASSERTIONS``: This option controls whether or not calls to ``assert()``
are compiled out. For debug builds, this option defaults to 1, and calls to
``assert()`` are left in place. For release builds, this option defaults to 0
......
......@@ -19,4 +19,38 @@
/* Definitions of register field mask in CORTEX_A75_CPUPWRCTLR_EL1 */
#define CORTEX_A75_CORE_PWRDN_EN_MASK 0x1
/*******************************************************************************
* CPU Activity Monitor Unit register specific definitions.
******************************************************************************/
#define CPUAMCNTENCLR_EL0 S3_3_C15_C9_7
#define CPUAMCNTENSET_EL0 S3_3_C15_C9_6
#define CPUAMCFGR_EL0 S3_3_C15_C10_6
#define CPUAMUSERENR_EL0 S3_3_C15_C10_7
/* Activity Monitor Event Counter Registers */
#define CPUAMEVCNTR0_EL0 S3_3_C15_C9_0
#define CPUAMEVCNTR1_EL0 S3_3_C15_C9_1
#define CPUAMEVCNTR2_EL0 S3_3_C15_C9_2
#define CPUAMEVCNTR3_EL0 S3_3_C15_C9_3
#define CPUAMEVCNTR4_EL0 S3_3_C15_C9_4
/* Activity Monitor Event Type Registers */
#define CPUAMEVTYPER0_EL0 S3_3_C15_C10_0
#define CPUAMEVTYPER1_EL0 S3_3_C15_C10_1
#define CPUAMEVTYPER2_EL0 S3_3_C15_C10_2
#define CPUAMEVTYPER3_EL0 S3_3_C15_C10_3
#define CPUAMEVTYPER4_EL0 S3_3_C15_C10_4
#define CORTEX_A75_ACTLR_AMEN_BIT (U(1) << 4)
/*
* The Cortex-A75 core implements five counters, 0-4. Events 0, 1, 2, are
* fixed and are enabled (Group 0). Events 3 and 4 (Group 1) are
* programmable by programming the appropriate Event count bits in
* CPUAMEVTYPER<n> register and are disabled by default. Platforms may
* enable this with suitable programming.
*/
#define CORTEX_A75_AMU_GROUP0_MASK 0x7
#define CORTEX_A75_AMU_GROUP1_MASK (0 << 3)
#endif /* __CORTEX_A75_H__ */
......@@ -11,6 +11,33 @@
#include <plat_macros.S>
#include <cortex_a75.h>
func cortex_a75_reset_func
#if ENABLE_AMU
/* Make sure accesses from EL0/EL1 and EL2 are not trapped to EL3 */
mrs x0, actlr_el3
orr x0, x0, #CORTEX_A75_ACTLR_AMEN_BIT
msr actlr_el3, x0
isb
/* Make sure accesses from EL0/EL1 are not trapped to EL2 */
mrs x0, actlr_el2
orr x0, x0, #CORTEX_A75_ACTLR_AMEN_BIT
msr actlr_el2, x0
isb
/* Enable group0 counters */
mov x0, #CORTEX_A75_AMU_GROUP0_MASK
msr CPUAMCNTENSET_EL0, x0
isb
/* Enable group1 counters */
mov x0, #CORTEX_A75_AMU_GROUP1_MASK
msr CPUAMCNTENSET_EL0, x0
isb
#endif
ret
endfunc cortex_a75_reset_func
/* ---------------------------------------------
* HW will do the cache maintenance while powering down
* ---------------------------------------------
......@@ -47,5 +74,5 @@ func cortex_a75_cpu_reg_dump
endfunc cortex_a75_cpu_reg_dump
declare_cpu_ops cortex_a75, CORTEX_A75_MIDR, \
CPU_NO_RESET_FUNC, \
cortex_a75_reset_func, \
cortex_a75_core_pwr_dwn
......@@ -156,3 +156,5 @@ ENABLE_SPE_FOR_LOWER_ELS := 1
ifeq (${ARCH},aarch32)
override ENABLE_SPE_FOR_LOWER_ELS := 0
endif
ENABLE_AMU := 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment