feat: add helper functions for SP sleep

This patch introduces new helper utilities: virtualcounter_read() and
sp_sleep_elapsed_time() which are further used in sp_sleep() utility.

This patch also adds a needed isb when reading the virtual counter,
to prevent reading stale values, as well as reducing the number of
reads of the virtual counter required. Refer Arm ARM D11.2.2

Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: Icaf1777e85ee2efc043bfa83d630edf54bf5a099
diff --git a/spm/common/sp_helpers.h b/spm/common/sp_helpers.h
index 9f5400c..6fe8ec0 100644
--- a/spm/common/sp_helpers.h
+++ b/spm/common/sp_helpers.h
@@ -56,6 +56,9 @@
 void announce_test_start(const char *test_desc);
 void announce_test_end(const char *test_desc);
 
+/* Sleep for at least 'ms' milliseconds and return the elapsed time(ms). */
+uint64_t sp_sleep_elapsed_time(uint32_t ms);
+
 /* Sleep for at least 'ms' milliseconds. */
 void sp_sleep(uint32_t ms);