summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2023-02-22 17:55:59 +0000
committerAndre Przywara <andre.przywara@arm.com>2023-03-22 13:33:22 +0000
commitac17e52c728e7786e80f41e41673420433637fa6 (patch)
tree1e24d7853f445d1a2fe7c74dae3692e7dda3f0b4 /common
parent623f6140fc8eaa547d477179b67ca2fde2720fe4 (diff)
downloadarm-trusted-firmware-ac17e52c728e7786e80f41e41673420433637fa6.tar.gz
refactor(cpufeat): enable FEAT_RNG for FEAT_STATE_CHECKED
At the moment we only support for FEAT_RNG to be either unconditionally compiled in, or to be not supported at all. Add support for runtime detection (FEAT_RNG=2), by splitting is_armv8_5_rng_present() into an ID register reading function and a second function to report the support status. That function considers both build time settings and runtime information (if needed), and is used before we access the RNDRRS system register. Change the QEMU platform default to the now supported dynamic option (=2), so the right decision can be made by the code at runtime. Change-Id: I1a4a538d5ad395fead7324f297d0056bda4f84cb Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'common')
-rw-r--r--common/feat_detect.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/common/feat_detect.c b/common/feat_detect.c
index 0f66157b3..9218c07e1 100644
--- a/common/feat_detect.c
+++ b/common/feat_detect.c
@@ -102,16 +102,6 @@ static void read_feat_mte(void)
#endif
}
-/***********************************************
- * Feature : FEAT_RNG (Random Number Generator)
- **********************************************/
-static void read_feat_rng(void)
-{
-#if (ENABLE_FEAT_RNG == FEAT_STATE_ALWAYS)
- feat_detect_panic(is_armv8_5_rng_present(), "RNG");
-#endif
-}
-
/****************************************************
* Feature : FEAT_BTI (Branch Target Identification)
***************************************************/
@@ -210,7 +200,7 @@ void detect_arch_features(void)
/* v8.5 features */
read_feat_mte();
- read_feat_rng();
+ check_feature(ENABLE_FEAT_RNG, read_feat_rng_id_field(), "RNG", 1, 1);
read_feat_bti();
read_feat_rng_trap();