summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authordp-arm <dimitris.papastamos@arm.com>2016-09-19 11:18:44 +0100
committerdp-arm <dimitris.papastamos@arm.com>2016-10-12 15:36:49 +0100
commit872be88a2916f45d3de38120ede8c8b199b7498f (patch)
treec3cb92eeef9b70c1d8b7a34a95a2396d1dbc4d27 /services
parentf10796a0686ee361fde54b887da05dd25e0ed2cf (diff)
Add PMF instrumentation points in TF
In order to quantify the overall time spent in the PSCI software implementation, an initial collection of PMF instrumentation points has been added. Instrumentation has been added to the following code paths: - Entry to PSCI SMC handler. The timestamp is captured as early as possible during the runtime exception and stored in memory before entering the PSCI SMC handler. - Exit from PSCI SMC handler. The timestamp is captured after normal return from the PSCI SMC handler or if a low power state was requested it is captured in the bl31 warm boot path before return to normal world. - Entry to low power state. The timestamp is captured before entry to a low power state which implies either standby or power down. As these power states are mutually exclusive, only one timestamp is defined to describe both. It is possible to differentiate between the two power states using the PSCI STAT interface. - Exit from low power state. The timestamp is captured after a standby or power up operation has completed. To calculate the number of cycles spent running code in Trusted Firmware one can perform the following calculation: (exit_psci - enter_psci) - (exit_low_pwr - enter_low_pwr). The resulting number of cycles can be converted to time given the frequency of the counter. Change-Id: Ie3b8f3d16409b6703747093b3a2d5c7429ad0166 Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
Diffstat (limited to 'services')
-rw-r--r--services/std_svc/std_svc_setup.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/services/std_svc/std_svc_setup.c b/services/std_svc/std_svc_setup.c
index e0966014..97a9fbd6 100644
--- a/services/std_svc/std_svc_setup.c
+++ b/services/std_svc/std_svc_setup.c
@@ -29,8 +29,11 @@
*/
#include <assert.h>
+#include <cpu_data.h>
#include <debug.h>
+#include <pmf.h>
#include <psci.h>
+#include <runtime_instr.h>
#include <runtime_svc.h>
#include <smcc_helpers.h>
#include <std_svc.h>
@@ -75,9 +78,25 @@ uintptr_t std_svc_smc_handler(uint32_t smc_fid,
* value
*/
if (is_psci_fid(smc_fid)) {
- SMC_RET1(handle,
- psci_smc_handler(smc_fid, x1, x2, x3, x4,
- cookie, handle, flags));
+ uint64_t ret;
+
+#if ENABLE_RUNTIME_INSTRUMENTATION
+ PMF_WRITE_TIMESTAMP(rt_instr_svc,
+ RT_INSTR_ENTER_PSCI,
+ PMF_NO_CACHE_MAINT,
+ get_cpu_data(cpu_data_pmf_ts[CPU_DATA_PMF_TS0_IDX]));
+#endif
+
+ ret = psci_smc_handler(smc_fid, x1, x2, x3, x4,
+ cookie, handle, flags);
+
+#if ENABLE_RUNTIME_INSTRUMENTATION
+ PMF_CAPTURE_TIMESTAMP(rt_instr_svc,
+ RT_INSTR_EXIT_PSCI,
+ PMF_NO_CACHE_MAINT);
+#endif
+
+ SMC_RET1(handle, ret);
}
switch (smc_fid) {