summaryrefslogtreecommitdiff
path: root/plat/common
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2017-10-16 15:19:31 +0100
committerSoby Mathew <soby.mathew@arm.com>2017-11-03 13:27:34 +0000
commitbfc87a8dff75688f3f0ef558f4921c4b1acc07b1 (patch)
tree56156cbd60e72c7796fbe2472f956de9830080ba /plat/common
parent122af7dd6d4937922317bc949ca9b8c62bcd20aa (diff)
Fix PSCI STAT time stamp collection
This patch includes various fixes for PSCI STAT functionality relating to timestamp collection: 1. The PSCI stat accounting for retention states for higher level power domains were done outside the locks which could lead to spurious values in some race conditions. This is moved inside the locks. Also, the call to start the stat accounting was redundant which is now removed. 2. The timestamp wrap-around case when calculating residency did not cater for AArch32. This is now fixed. 3. In the warm boot path, `plat_psci_stat_accounting_stop()` was getting invoked prior to population of target power states. This is now corrected. Change-Id: I851526455304fb74ff0a724f4d5318cd89e19589 Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Diffstat (limited to 'plat/common')
-rw-r--r--plat/common/plat_psci_common.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/plat/common/plat_psci_common.c b/plat/common/plat_psci_common.c
index 95adb051..0e818d0d 100644
--- a/plat/common/plat_psci_common.c
+++ b/plat/common/plat_psci_common.c
@@ -18,6 +18,13 @@
/* Ticks elapsed in one second by a signal of 1 MHz */
#define MHZ_TICKS_PER_SEC 1000000
+/* Maximum time-stamp value read from architectural counters */
+#ifdef AARCH32
+#define MAX_TS UINT32_MAX
+#else
+#define MAX_TS UINT64_MAX
+#endif
+
/* Following are used as ID's to capture time-stamp */
#define PSCI_STAT_ID_ENTER_LOW_PWR 0
#define PSCI_STAT_ID_EXIT_LOW_PWR 1
@@ -45,7 +52,7 @@ static u_register_t calc_stat_residency(unsigned long long pwrupts,
assert(residency_div);
if (pwrupts < pwrdnts)
- res = UINT64_MAX - pwrdnts + pwrupts;
+ res = MAX_TS - pwrdnts + pwrupts;
else
res = pwrupts - pwrdnts;