diff options
Diffstat (limited to 'lib/psci')
-rw-r--r-- | lib/psci/psci_main.c | 14 | ||||
-rw-r--r-- | lib/psci/psci_off.c | 15 | ||||
-rw-r--r-- | lib/psci/psci_suspend.c | 27 |
3 files changed, 56 insertions, 0 deletions
diff --git a/lib/psci/psci_main.c b/lib/psci/psci_main.c index 23bd106c..0a3a60ac 100644 --- a/lib/psci/psci_main.c +++ b/lib/psci/psci_main.c @@ -33,6 +33,8 @@ #include <assert.h> #include <debug.h> #include <platform.h> +#include <pmf.h> +#include <runtime_instr.h> #include <smcc.h> #include <string.h> #include "psci_private.h" @@ -124,11 +126,23 @@ int psci_cpu_suspend(unsigned int power_state, PMF_NO_CACHE_MAINT); #endif +#if ENABLE_RUNTIME_INSTRUMENTATION + PMF_CAPTURE_TIMESTAMP(rt_instr_svc, + RT_INSTR_ENTER_HW_LOW_PWR, + PMF_NO_CACHE_MAINT); +#endif + psci_plat_pm_ops->cpu_standby(cpu_pd_state); /* Upon exit from standby, set the state back to RUN. */ psci_set_cpu_local_state(PSCI_LOCAL_STATE_RUN); +#if ENABLE_RUNTIME_INSTRUMENTATION + PMF_CAPTURE_TIMESTAMP(rt_instr_svc, + RT_INSTR_EXIT_HW_LOW_PWR, + PMF_NO_CACHE_MAINT); +#endif + #if ENABLE_PSCI_STAT /* Capture time-stamp after CPU standby */ PMF_CAPTURE_TIMESTAMP(psci_svc, PSCI_STAT_ID_EXIT_LOW_PWR, diff --git a/lib/psci/psci_off.c b/lib/psci/psci_off.c index 471141dd..1cc6ede3 100644 --- a/lib/psci/psci_off.c +++ b/lib/psci/psci_off.c @@ -33,6 +33,8 @@ #include <assert.h> #include <debug.h> #include <platform.h> +#include <pmf.h> +#include <runtime_instr.h> #include <string.h> #include "psci_private.h" @@ -153,6 +155,19 @@ exit: dsbish(); inv_cpu_data(psci_svc_cpu_data.aff_info_state); +#if ENABLE_RUNTIME_INSTRUMENTATION + + /* + * Update the timestamp with cache off. We assume this + * timestamp can only be read from the current CPU and the + * timestamp cache line will be flushed before return to + * normal world on wakeup. + */ + PMF_CAPTURE_TIMESTAMP(rt_instr_svc, + RT_INSTR_ENTER_HW_LOW_PWR, + PMF_NO_CACHE_MAINT); +#endif + if (psci_plat_pm_ops->pwr_domain_pwr_down_wfi) { /* This function must not return */ psci_plat_pm_ops->pwr_domain_pwr_down_wfi(&state_info); diff --git a/lib/psci/psci_suspend.c b/lib/psci/psci_suspend.c index 0887e3b2..10d2481d 100644 --- a/lib/psci/psci_suspend.c +++ b/lib/psci/psci_suspend.c @@ -37,6 +37,8 @@ #include <cpu_data.h> #include <debug.h> #include <platform.h> +#include <pmf.h> +#include <runtime_instr.h> #include <stddef.h> #include "psci_private.h" @@ -212,6 +214,19 @@ exit: return; if (is_power_down_state) { +#if ENABLE_RUNTIME_INSTRUMENTATION + + /* + * Update the timestamp with cache off. We assume this + * timestamp can only be read from the current CPU and the + * timestamp cache line will be flushed before return to + * normal world on wakeup. + */ + PMF_CAPTURE_TIMESTAMP(rt_instr_svc, + RT_INSTR_ENTER_HW_LOW_PWR, + PMF_NO_CACHE_MAINT); +#endif + /* The function calls below must not return */ if (psci_plat_pm_ops->pwr_domain_pwr_down_wfi) psci_plat_pm_ops->pwr_domain_pwr_down_wfi(state_info); @@ -219,6 +234,12 @@ exit: psci_power_down_wfi(); } +#if ENABLE_RUNTIME_INSTRUMENTATION + PMF_CAPTURE_TIMESTAMP(rt_instr_svc, + RT_INSTR_ENTER_HW_LOW_PWR, + PMF_NO_CACHE_MAINT); +#endif + /* * We will reach here if only retention/standby states have been * requested at multiple power levels. This means that the cpu @@ -226,6 +247,12 @@ exit: */ wfi(); +#if ENABLE_RUNTIME_INSTRUMENTATION + PMF_CAPTURE_TIMESTAMP(rt_instr_svc, + RT_INSTR_EXIT_HW_LOW_PWR, + PMF_NO_CACHE_MAINT); +#endif + /* * After we wake up from context retaining suspend, call the * context retaining suspend finisher. |