Try to leak counter values from secure world.
This patch introduces a series of tests that try to leak PMU counter values
from EL3 and S_EL1.
PMU events used:
- CPU cycles via PMU counter PMCCNTR_EL0
- Retired writes to PC via PMU counter PMEVCNTR0_EL0
This AARCH64-specific patch is for security fix:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/1789
The AARCH32 versions of these tests will be in a future patch.
Signed-off-by: Petre-Ionut Tudor <petre-ionut.tudor@arm.com>
Change-Id: Ib27948edadde30272e59a9ab208543703fa078bd
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index 2cf6e83..141f00c 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -155,6 +155,20 @@
} \
} while (0)
+#define SKIP_TEST_IF_ARCH_DEBUG_VERSION_LESS_THAN(version) \
+ do { \
+ uint32_t debug_ver = read_id_aa64dfr0_el1() & \
+ (ID_AA64DFR0_DEBUG_MASK << ID_AA64DFR0_DEBUG_SHIFT); \
+ \
+ if ((debug_ver >> ID_AA64DFR0_DEBUG_SHIFT) < version) { \
+ tftf_testcase_printf("Debug version returned %d\n" \
+ "The required version is %d\n", \
+ debug_ver >> ID_AA64DFR0_DEBUG_SHIFT,\
+ version); \
+ return TEST_RESULT_SKIPPED; \
+ } \
+ } while (0)
+
/* Helper macro to verify if system suspend API is supported */
#define is_psci_sys_susp_supported() \
(tftf_get_psci_feature_info(SMC_PSCI_SYSTEM_SUSPEND) \