]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
AMU: Add plat interface to select which group 1 counters to enable
authorDimitris Papastamos <dimitris.papastamos@arm.com>
Wed, 13 Dec 2017 10:54:37 +0000 (10:54 +0000)
committerDimitris Papastamos <dimitris.papastamos@arm.com>
Thu, 11 Jan 2018 12:27:27 +0000 (12:27 +0000)
A new platform macro `PLAT_AMU_GROUP1_COUNTERS_MASK` controls which
group 1 counters should be enabled. The maximum number of group 1
counters supported by AMUv1 is 16 so the mask can be at most 0xffff.
If the platform does not define this mask, no group 1 counters are
enabled.

A related platform macro `PLAT_AMU_GROUP1_NR_COUNTERS` is used by
generic code to allocate an array to save and restore the counters on
CPU suspend.

Change-Id: I6d135badf4846292de931a43bb563077f42bb47b
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
docs/porting-guide.rst
include/lib/extensions/amu.h
lib/extensions/amu/aarch64/amu.c

index f020ec97d0ad727d42780716c9cee6440514984b..51d2e64a4d1cc2ffb7795d9f87e3fcf1defac731 100644 (file)
@@ -549,6 +549,22 @@ behaviour of the ``assert()`` function (for example, to save memory).
    doesn't print anything to the console. If ``PLAT_LOG_LEVEL_ASSERT`` isn't
    defined, it defaults to ``LOG_LEVEL``.
 
+If the platform port uses the Activity Monitor Unit, the following constants
+may be defined:
+
+-  **PLAT\_AMU\_GROUP1\_COUNTERS\_MASK**
+   This mask reflects the set of group counters that should be enabled.  The
+   maximum number of group 1 counters supported by AMUv1 is 16 so the mask
+   can be at most 0xffff. If the platform does not define this mask, no group 1
+   counters are enabled. If the platform defines this mask, the following
+   constant needs to also be defined.
+
+-  **PLAT\_AMU\_GROUP1\_NR\_COUNTERS**
+   This value is used to allocate an array to save and restore the counters
+   specified by ``PLAT_AMU_GROUP1_COUNTERS_MASK`` on CPU suspend.
+   This value should be equal to the highest bit position set in the
+   mask, plus 1.  The maximum number of group 1 counters in AMUv1 is 16.
+
 File : plat\_macros.S [mandatory]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
index bbefe8ff6649b630aa775db6911a8d4277afea23..2ecbea568292ab74bb69480860f8d0fa9718ff5f 100644 (file)
@@ -7,9 +7,28 @@
 #ifndef __AMU_H__
 #define __AMU_H__
 
-/* Enable all group 0 counters */
+#include <sys/cdefs.h> /* for CASSERT() */
+#include <cassert.h>
+#include <platform_def.h>
+
+/* All group 0 counters */
 #define AMU_GROUP0_COUNTERS_MASK       0xf
 
+#ifdef PLAT_AMU_GROUP1_COUNTERS_MASK
+#define AMU_GROUP1_COUNTERS_MASK       PLAT_AMU_GROUP1_COUNTERS_MASK
+#else
+#define AMU_GROUP1_COUNTERS_MASK       0
+#endif
+
+#ifdef PLAT_AMU_GROUP1_NR_COUNTERS
+#define AMU_GROUP1_NR_COUNTERS         PLAT_AMU_GROUP1_NR_COUNTERS
+#else
+#define AMU_GROUP1_NR_COUNTERS         0
+#endif
+
+CASSERT(AMU_GROUP1_COUNTERS_MASK <= 0xffff, invalid_amu_group1_counters_mask);
+CASSERT(AMU_GROUP1_NR_COUNTERS <= 16, invalid_amu_group1_nr_counters);
+
 void amu_enable(int el2_unused);
 
 #endif /* __AMU_H__ */
index 007b3494fed50350e3a795f9e12c4dcc65a556f0..c00aa5a17eae6c832b6ccfc03ea595d747a37ae1 100644 (file)
@@ -36,5 +36,7 @@ void amu_enable(int el2_unused)
 
                /* Enable group 0 counters */
                write_amcntenset0_el0(AMU_GROUP0_COUNTERS_MASK);
+               /* Enable group 1 counters */
+               write_amcntenset1_el0(AMU_GROUP1_COUNTERS_MASK);
        }
 }