diff options
author | Yatharth Kochar <yatharth.kochar@arm.com> | 2016-05-09 18:26:35 +0100 |
---|---|---|
committer | Soby Mathew <soby.mathew@arm.com> | 2016-06-16 08:55:00 +0100 |
commit | 170fb93dec97568eec426148019b1670c0b17e7d (patch) | |
tree | 456974555d3eb0b9a704198235884b9dd2314545 /services/std_svc/psci/psci_suspend.c | |
parent | a31d8983f42153b0448103bdd47e1f4c9c093765 (diff) |
Add optional PSCI STAT residency & count functions
This patch adds following optional PSCI STAT functions:
- PSCI_STAT_RESIDENCY: This call returns the amount of time spent
in power_state in microseconds, by the node represented by the
`target_cpu` and the highest level of `power_state`.
- PSCI_STAT_COUNT: This call returns the number of times a
`power_state` has been used by the node represented by the
`target_cpu` and the highest power level of `power_state`.
These APIs provides residency statistics for power states that has
been used by the platform. They are implemented according to v1.0
of the PSCI specification.
By default this optional feature is disabled in the PSCI
implementation. To enable it, set the boolean flag
`ENABLE_PSCI_STAT` to 1. This also sets `ENABLE_PMF` to 1.
Change-Id: Ie62e9d37d6d416ccb1813acd7f616d1ddd3e8aff
Diffstat (limited to 'services/std_svc/psci/psci_suspend.c')
-rw-r--r-- | services/std_svc/psci/psci_suspend.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/services/std_svc/psci/psci_suspend.c b/services/std_svc/psci/psci_suspend.c index 8c6ab6b4..e6c8cd99 100644 --- a/services/std_svc/psci/psci_suspend.c +++ b/services/std_svc/psci/psci_suspend.c @@ -168,6 +168,11 @@ void psci_cpu_suspend_start(entry_point_info_t *ep, */ psci_do_state_coordination(end_pwrlvl, state_info); +#if ENABLE_PSCI_STAT + /* Update the last cpu for each level till end_pwrlvl */ + psci_stats_update_pwr_down(end_pwrlvl, state_info); +#endif + if (is_power_down_state) psci_suspend_to_pwrdown_start(end_pwrlvl, ep, state_info); @@ -179,6 +184,16 @@ void psci_cpu_suspend_start(entry_point_info_t *ep, */ psci_plat_pm_ops->pwr_domain_suspend(state_info); +#if ENABLE_PSCI_STAT + /* + * Capture time-stamp while entering low power state. + * No cache maintenance needed because caches are off + * and writes are direct to main memory. + */ + PMF_CAPTURE_TIMESTAMP(psci_svc, PSCI_STAT_ID_ENTER_LOW_PWR, + PMF_NO_CACHE_MAINT); +#endif + exit: /* * Release the locks corresponding to each power level in the |