summaryrefslogtreecommitdiff
path: root/lib/psci
diff options
context:
space:
mode:
authordanh-arm <dan.handley@arm.com>2016-12-19 15:39:33 +0000
committerGitHub <noreply@github.com>2016-12-19 15:39:33 +0000
commit5d93484ab53bcf58b00c51c9ed800d3f527e9e72 (patch)
tree4bd983bfa49631ee9343d846e1ce65e5b3d4d9e5 /lib/psci
parent78b4c5b0785f73eb95a58ac9fe8d696f3fef5224 (diff)
parent7941816a3428f015a9f4a6c5dc978b4fca568f4b (diff)
Merge pull request #779 from dp-arm/dp/rtinstr-cache
Add two timestamps to measure PSCI cache flush overhead
Diffstat (limited to 'lib/psci')
-rw-r--r--lib/psci/psci_off.c17
-rw-r--r--lib/psci/psci_suspend.c17
2 files changed, 34 insertions, 0 deletions
diff --git a/lib/psci/psci_off.c b/lib/psci/psci_off.c
index 1cc6ede3..897bf319 100644
--- a/lib/psci/psci_off.c
+++ b/lib/psci/psci_off.c
@@ -107,12 +107,29 @@ int psci_do_cpu_off(unsigned int end_pwrlvl)
psci_stats_update_pwr_down(end_pwrlvl, &state_info);
#endif
+#if ENABLE_RUNTIME_INSTRUMENTATION
+
+ /*
+ * Flush cache line so that even if CPU power down happens
+ * the timestamp update is reflected in memory.
+ */
+ PMF_CAPTURE_TIMESTAMP(rt_instr_svc,
+ RT_INSTR_ENTER_CFLUSH,
+ PMF_CACHE_MAINT);
+#endif
+
/*
* Arch. management. Perform the necessary steps to flush all
* cpu caches.
*/
psci_do_pwrdown_cache_maintenance(psci_find_max_off_lvl(&state_info));
+#if ENABLE_RUNTIME_INSTRUMENTATION
+ PMF_CAPTURE_TIMESTAMP(rt_instr_svc,
+ RT_INSTR_EXIT_CFLUSH,
+ PMF_NO_CACHE_MAINT);
+#endif
+
/*
* Plat. management: Perform platform specific actions to turn this
* cpu off e.g. exit cpu coherency, program the power controller etc.
diff --git a/lib/psci/psci_suspend.c b/lib/psci/psci_suspend.c
index 10d2481d..dc2ab774 100644
--- a/lib/psci/psci_suspend.c
+++ b/lib/psci/psci_suspend.c
@@ -109,6 +109,17 @@ static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl,
*/
cm_init_my_context(ep);
+#if ENABLE_RUNTIME_INSTRUMENTATION
+
+ /*
+ * Flush cache line so that even if CPU power down happens
+ * the timestamp update is reflected in memory.
+ */
+ PMF_CAPTURE_TIMESTAMP(rt_instr_svc,
+ RT_INSTR_ENTER_CFLUSH,
+ PMF_CACHE_MAINT);
+#endif
+
/*
* Arch. management. Perform the necessary steps to flush all
* cpu caches. Currently we assume that the power level correspond
@@ -117,6 +128,12 @@ static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl,
* and the cpu-ops power down to perform from the platform.
*/
psci_do_pwrdown_cache_maintenance(max_off_lvl);
+
+#if ENABLE_RUNTIME_INSTRUMENTATION
+ PMF_CAPTURE_TIMESTAMP(rt_instr_svc,
+ RT_INSTR_EXIT_CFLUSH,
+ PMF_NO_CACHE_MAINT);
+#endif
}
/*******************************************************************************