@ -26,7 +26,7 @@ static struct amu_ctx amu_ctxs[PLATFORM_CORE_COUNT];
* ID_AA64PFR0_AMU_V1P1 : FEAT_AMUv1p1 supported ( introduced in ARM v8 .6 )
* ID_AA64PFR0_AMU_V1P1 : FEAT_AMUv1p1 supported ( introduced in ARM v8 .6 )
* ID_AA64PFR0_AMU_NOT_SUPPORTED : not supported
* ID_AA64PFR0_AMU_NOT_SUPPORTED : not supported
*/
*/
unsigned int amu_get_version ( void )
static unsigned int amu_get_version ( void )
{
{
return ( unsigned int ) ( read_id_aa64pfr0_el1 ( ) > > ID_AA64PFR0_AMU_SHIFT ) &
return ( unsigned int ) ( read_id_aa64pfr0_el1 ( ) > > ID_AA64PFR0_AMU_SHIFT ) &
ID_AA64PFR0_AMU_MASK ;
ID_AA64PFR0_AMU_MASK ;
@ -34,7 +34,7 @@ unsigned int amu_get_version(void)
# if AMU_GROUP1_NR_COUNTERS
# if AMU_GROUP1_NR_COUNTERS
/* Check if group 1 counters is implemented */
/* Check if group 1 counters is implemented */
bool amu_group1_supported ( void )
static bool amu_group1_supported ( void )
{
{
uint64_t features = read_amcfgr_el0 ( ) > > AMCFGR_EL0_NCG_SHIFT ;
uint64_t features = read_amcfgr_el0 ( ) > > AMCFGR_EL0_NCG_SHIFT ;
@ -130,7 +130,7 @@ void amu_enable(bool el2_unused, cpu_context_t *ctx)
}
}
/* Read the group 0 counter identified by the given `idx`. */
/* Read the group 0 counter identified by the given `idx`. */
uint64_t amu_group0_cnt_read ( unsigned int idx )
static uint64_t amu_group0_cnt_read ( unsigned int idx )
{
{
assert ( amu_get_version ( ) ! = ID_AA64PFR0_AMU_NOT_SUPPORTED ) ;
assert ( amu_get_version ( ) ! = ID_AA64PFR0_AMU_NOT_SUPPORTED ) ;
assert ( idx < AMU_GROUP0_NR_COUNTERS ) ;
assert ( idx < AMU_GROUP0_NR_COUNTERS ) ;
@ -139,7 +139,7 @@ uint64_t amu_group0_cnt_read(unsigned int idx)
}
}
/* Write the group 0 counter identified by the given `idx` with `val` */
/* Write the group 0 counter identified by the given `idx` with `val` */
void amu_group0_cnt_write ( unsigned int idx , uint64_t val )
static void amu_group0_cnt_write ( unsigned int idx , uint64_t val )
{
{
assert ( amu_get_version ( ) ! = ID_AA64PFR0_AMU_NOT_SUPPORTED ) ;
assert ( amu_get_version ( ) ! = ID_AA64PFR0_AMU_NOT_SUPPORTED ) ;
assert ( idx < AMU_GROUP0_NR_COUNTERS ) ;
assert ( idx < AMU_GROUP0_NR_COUNTERS ) ;
@ -154,7 +154,7 @@ void amu_group0_cnt_write(unsigned int idx, uint64_t val)
*
*
* Using this function requires FEAT_AMUv1p1 support .
* Using this function requires FEAT_AMUv1p1 support .
*/
*/
uint64_t amu_group0_voffset_read ( unsigned int idx )
static uint64_t amu_group0_voffset_read ( unsigned int idx )
{
{
assert ( amu_get_version ( ) > = ID_AA64PFR0_AMU_V1P1 ) ;
assert ( amu_get_version ( ) > = ID_AA64PFR0_AMU_V1P1 ) ;
assert ( idx < AMU_GROUP0_NR_COUNTERS ) ;
assert ( idx < AMU_GROUP0_NR_COUNTERS ) ;
@ -169,7 +169,7 @@ uint64_t amu_group0_voffset_read(unsigned int idx)
*
*
* Using this function requires FEAT_AMUv1p1 support .
* Using this function requires FEAT_AMUv1p1 support .
*/
*/
void amu_group0_voffset_write ( unsigned int idx , uint64_t val )
static void amu_group0_voffset_write ( unsigned int idx , uint64_t val )
{
{
assert ( amu_get_version ( ) > = ID_AA64PFR0_AMU_V1P1 ) ;
assert ( amu_get_version ( ) > = ID_AA64PFR0_AMU_V1P1 ) ;
assert ( idx < AMU_GROUP0_NR_COUNTERS ) ;
assert ( idx < AMU_GROUP0_NR_COUNTERS ) ;
@ -181,7 +181,7 @@ void amu_group0_voffset_write(unsigned int idx, uint64_t val)
# if AMU_GROUP1_NR_COUNTERS
# if AMU_GROUP1_NR_COUNTERS
/* Read the group 1 counter identified by the given `idx` */
/* Read the group 1 counter identified by the given `idx` */
uint64_t amu_group1_cnt_read ( unsigned int idx )
static uint64_t amu_group1_cnt_read ( unsigned int idx )
{
{
assert ( amu_get_version ( ) ! = ID_AA64PFR0_AMU_NOT_SUPPORTED ) ;
assert ( amu_get_version ( ) ! = ID_AA64PFR0_AMU_NOT_SUPPORTED ) ;
assert ( amu_group1_supported ( ) ) ;
assert ( amu_group1_supported ( ) ) ;
@ -191,7 +191,7 @@ uint64_t amu_group1_cnt_read(unsigned int idx)
}
}
/* Write the group 1 counter identified by the given `idx` with `val` */
/* Write the group 1 counter identified by the given `idx` with `val` */
void amu_group1_cnt_write ( unsigned int idx , uint64_t val )
static void amu_group1_cnt_write ( unsigned int idx , uint64_t val )
{
{
assert ( amu_get_version ( ) ! = ID_AA64PFR0_AMU_NOT_SUPPORTED ) ;
assert ( amu_get_version ( ) ! = ID_AA64PFR0_AMU_NOT_SUPPORTED ) ;
assert ( amu_group1_supported ( ) ) ;
assert ( amu_group1_supported ( ) ) ;
@ -206,7 +206,7 @@ void amu_group1_cnt_write(unsigned int idx, uint64_t val)
*
*
* Using this function requires FEAT_AMUv1p1 support .
* Using this function requires FEAT_AMUv1p1 support .
*/
*/
uint64_t amu_group1_voffset_read ( unsigned int idx )
static uint64_t amu_group1_voffset_read ( unsigned int idx )
{
{
assert ( amu_get_version ( ) > = ID_AA64PFR0_AMU_V1P1 ) ;
assert ( amu_get_version ( ) > = ID_AA64PFR0_AMU_V1P1 ) ;
assert ( amu_group1_supported ( ) ) ;
assert ( amu_group1_supported ( ) ) ;
@ -222,7 +222,7 @@ uint64_t amu_group1_voffset_read(unsigned int idx)
*
*
* Using this function requires FEAT_AMUv1p1 support .
* Using this function requires FEAT_AMUv1p1 support .
*/
*/
void amu_group1_voffset_write ( unsigned int idx , uint64_t val )
static void amu_group1_voffset_write ( unsigned int idx , uint64_t val )
{
{
assert ( amu_get_version ( ) > = ID_AA64PFR0_AMU_V1P1 ) ;
assert ( amu_get_version ( ) > = ID_AA64PFR0_AMU_V1P1 ) ;
assert ( amu_group1_supported ( ) ) ;
assert ( amu_group1_supported ( ) ) ;
@ -233,20 +233,6 @@ void amu_group1_voffset_write(unsigned int idx, uint64_t val)
amu_group1_voffset_write_internal ( idx , val ) ;
amu_group1_voffset_write_internal ( idx , val ) ;
isb ( ) ;
isb ( ) ;
}
}
/*
* Program the event type register for the given ` idx ` with
* the event number ` val `
*/
void amu_group1_set_evtype ( unsigned int idx , unsigned int val )
{
assert ( amu_get_version ( ) ! = ID_AA64PFR0_AMU_NOT_SUPPORTED ) ;
assert ( amu_group1_supported ( ) ) ;
assert ( idx < AMU_GROUP1_NR_COUNTERS ) ;
amu_group1_set_evtype_internal ( idx , val ) ;
isb ( ) ;
}
# endif /* AMU_GROUP1_NR_COUNTERS */
# endif /* AMU_GROUP1_NR_COUNTERS */
static void * amu_context_save ( const void * arg )
static void * amu_context_save ( const void * arg )