From 88727fc3ec897b176f30a6d41111c4a0e581d6e8 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Thu, 26 Jan 2023 16:47:52 +0000 Subject: refactor(cpufeat): enable FEAT_DIT for FEAT_STATE_CHECKED At the moment we only support FEAT_DIT to be either unconditionally compiled in, or to be not supported at all. Add support for runtime detection (ENABLE_DIT=2), by splitting is_armv8_4_dit_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). We use ENABLE_DIT in two occassions in assembly code, where we just set the DIT bit in the DIT system register. Protect those two cases by reading the CPU ID register when ENABLE_DIT is set to 2. Change the FVP platform default to the now supported dynamic option (=2), so the right decision can be made by the code at runtime. Change-Id: I506d352f18e23c60db8cdf08edb449f60adbe098 Signed-off-by: Andre Przywara --- lib/el3_runtime/aarch64/context.S | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/el3_runtime') diff --git a/lib/el3_runtime/aarch64/context.S b/lib/el3_runtime/aarch64/context.S index 013a505d4..769117163 100644 --- a/lib/el3_runtime/aarch64/context.S +++ b/lib/el3_runtime/aarch64/context.S @@ -553,8 +553,14 @@ endfunc fpregs_context_restore * always enable DIT in EL3 */ #if ENABLE_FEAT_DIT +#if ENABLE_FEAT_DIT == 2 + mrs x8, id_aa64pfr0_el1 + and x8, x8, #(ID_AA64PFR0_DIT_MASK << ID_AA64PFR0_DIT_SHIFT) + cbz x8, 1f +#endif mov x8, #DIT_BIT msr DIT, x8 +1: #endif /* ENABLE_FEAT_DIT */ .endm /* set_unset_pstate_bits */ -- cgit v1.2.3