diff options
Diffstat (limited to 'lib/el3_runtime')
-rw-r--r-- | lib/el3_runtime/aarch64/context.S | 24 | ||||
-rw-r--r-- | lib/el3_runtime/aarch64/context_mgmt.c | 16 |
2 files changed, 10 insertions, 30 deletions
diff --git a/lib/el3_runtime/aarch64/context.S b/lib/el3_runtime/aarch64/context.S index 715406487..013a505d4 100644 --- a/lib/el3_runtime/aarch64/context.S +++ b/lib/el3_runtime/aarch64/context.S @@ -21,10 +21,6 @@ .global el2_sysregs_context_save_ras .global el2_sysregs_context_restore_ras #endif /* RAS_EXTENSION */ -#if CTX_INCLUDE_NEVE_REGS - .global el2_sysregs_context_save_nv2 - .global el2_sysregs_context_restore_nv2 -#endif /* CTX_INCLUDE_NEVE_REGS */ #endif /* CTX_INCLUDE_EL2_REGS */ .global el1_sysregs_context_save @@ -238,26 +234,6 @@ func el2_sysregs_context_restore_ras endfunc el2_sysregs_context_restore_ras #endif /* RAS_EXTENSION */ -#if CTX_INCLUDE_NEVE_REGS -func el2_sysregs_context_save_nv2 - /* - * VNCR_EL2 register is saved only when FEAT_NV2 is supported. - */ - mrs x16, vncr_el2 - str x16, [x0, #CTX_VNCR_EL2] - ret -endfunc el2_sysregs_context_save_nv2 - -func el2_sysregs_context_restore_nv2 - /* - * VNCR_EL2 register is restored only when FEAT_NV2 is supported. - */ - ldr x16, [x0, #CTX_VNCR_EL2] - msr vncr_el2, x16 - ret -endfunc el2_sysregs_context_restore_nv2 -#endif /* CTX_INCLUDE_NEVE_REGS */ - #endif /* CTX_INCLUDE_EL2_REGS */ /* ------------------------------------------------------------------ diff --git a/lib/el3_runtime/aarch64/context_mgmt.c b/lib/el3_runtime/aarch64/context_mgmt.c index 8f46b80dc..2ba2f9ce2 100644 --- a/lib/el3_runtime/aarch64/context_mgmt.c +++ b/lib/el3_runtime/aarch64/context_mgmt.c @@ -970,9 +970,12 @@ void cm_el2_sysregs_context_save(uint32_t security_state) #if RAS_EXTENSION el2_sysregs_context_save_ras(el2_sysregs_ctx); #endif -#if CTX_INCLUDE_NEVE_REGS - el2_sysregs_context_save_nv2(el2_sysregs_ctx); -#endif + + if (is_feat_nv2_supported()) { + write_ctx_reg(el2_sysregs_ctx, CTX_VNCR_EL2, + read_vncr_el2()); + } + if (is_feat_trf_supported()) { write_ctx_reg(el2_sysregs_ctx, CTX_TRFCR_EL2, read_trfcr_el2()); } @@ -1036,9 +1039,10 @@ void cm_el2_sysregs_context_restore(uint32_t security_state) #if RAS_EXTENSION el2_sysregs_context_restore_ras(el2_sysregs_ctx); #endif -#if CTX_INCLUDE_NEVE_REGS - el2_sysregs_context_restore_nv2(el2_sysregs_ctx); -#endif + + if (is_feat_nv2_supported()) { + write_vncr_el2(read_ctx_reg(el2_sysregs_ctx, CTX_VNCR_EL2)); + } if (is_feat_trf_supported()) { write_trfcr_el2(read_ctx_reg(el2_sysregs_ctx, CTX_TRFCR_EL2)); } |