mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 01:24:27 +00:00
refactor(context-mgmt): move FEAT_HCX save/restore into C
At the moment we save and restore the HCRX_EL2 register in assembly, and just depend on the build time flags. To allow runtime checking, and to avoid too much code in assembly, move that over to C, and use the new combined build/runtime feature check. This also allows to drop the assert, since this should now be covered by the different FEAT_STATE_x options. Change-Id: I3e20b9ba17121d423cd08edc20bbf4e7ae7c0178 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
parent
d242128c1d
commit
c5a3ebbd3a
4 changed files with 9 additions and 39 deletions
|
@ -93,15 +93,6 @@ void bl31_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
|||
/* Perform late platform-specific setup */
|
||||
bl31_plat_arch_setup();
|
||||
|
||||
#if ENABLE_FEAT_HCX
|
||||
/*
|
||||
* Assert that FEAT_HCX is supported on this system, without this check
|
||||
* an exception would occur during context save/restore if enabled but
|
||||
* not supported.
|
||||
*/
|
||||
assert(is_feat_hcx_supported());
|
||||
#endif /* ENABLE_FEAT_HCX */
|
||||
|
||||
#if CTX_INCLUDE_PAUTH_REGS
|
||||
/*
|
||||
* Assert that the ARMv8.3-PAuth registers are present or an access
|
||||
|
|
|
@ -547,10 +547,6 @@ void el2_sysregs_context_restore_trf(el2_sysregs_t *regs);
|
|||
void el2_sysregs_context_save_csv2(el2_sysregs_t *regs);
|
||||
void el2_sysregs_context_restore_csv2(el2_sysregs_t *regs);
|
||||
#endif /* ENABLE_FEAT_CSV2_2 */
|
||||
#if ENABLE_FEAT_HCX
|
||||
void el2_sysregs_context_save_hcx(el2_sysregs_t *regs);
|
||||
void el2_sysregs_context_restore_hcx(el2_sysregs_t *regs);
|
||||
#endif /* ENABLE_FEAT_HCX */
|
||||
#endif /* CTX_INCLUDE_EL2_REGS */
|
||||
|
||||
#if CTX_INCLUDE_FPREGS
|
||||
|
|
|
@ -49,10 +49,6 @@
|
|||
.global el2_sysregs_context_save_csv2
|
||||
.global el2_sysregs_context_restore_csv2
|
||||
#endif /* ENABLE_FEAT_CSV2_2 */
|
||||
#if ENABLE_FEAT_HCX
|
||||
.global el2_sysregs_context_save_hcx
|
||||
.global el2_sysregs_context_restore_hcx
|
||||
#endif /* ENABLE_FEAT_HCX */
|
||||
#endif /* CTX_INCLUDE_EL2_REGS */
|
||||
|
||||
.global el1_sysregs_context_save
|
||||
|
@ -432,19 +428,6 @@ func el2_sysregs_context_restore_csv2
|
|||
endfunc el2_sysregs_context_restore_csv2
|
||||
#endif /* ENABLE_FEAT_CSV2_2 */
|
||||
|
||||
#if ENABLE_FEAT_HCX
|
||||
func el2_sysregs_context_save_hcx
|
||||
mrs x14, hcrx_el2
|
||||
str x14, [x0, #CTX_HCRX_EL2]
|
||||
ret
|
||||
endfunc el2_sysregs_context_save_hcx
|
||||
|
||||
func el2_sysregs_context_restore_hcx
|
||||
ldr x14, [x0, #CTX_HCRX_EL2]
|
||||
msr hcrx_el2, x14
|
||||
ret
|
||||
endfunc el2_sysregs_context_restore_hcx
|
||||
#endif /* ENABLE_FEAT_HCX */
|
||||
#endif /* CTX_INCLUDE_EL2_REGS */
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
|
|
|
@ -320,9 +320,9 @@ static void setup_context_common(cpu_context_t *ctx, const entry_point_info_t *e
|
|||
* If FEAT_HCX is enabled, enable access to HCRX_EL2 by setting
|
||||
* SCR_EL3.HXEn.
|
||||
*/
|
||||
#if ENABLE_FEAT_HCX
|
||||
scr_el3 |= SCR_HXEn_BIT;
|
||||
#endif
|
||||
if (is_feat_hcx_supported()) {
|
||||
scr_el3 |= SCR_HXEn_BIT;
|
||||
}
|
||||
|
||||
/*
|
||||
* If FEAT_RNG_TRAP is enabled, all reads of the RNDR and RNDRRS
|
||||
|
@ -873,9 +873,9 @@ void cm_el2_sysregs_context_save(uint32_t security_state)
|
|||
#if ENABLE_FEAT_CSV2_2
|
||||
el2_sysregs_context_save_csv2(el2_sysregs_ctx);
|
||||
#endif
|
||||
#if ENABLE_FEAT_HCX
|
||||
el2_sysregs_context_save_hcx(el2_sysregs_ctx);
|
||||
#endif
|
||||
if (is_feat_hcx_supported()) {
|
||||
write_ctx_reg(el2_sysregs_ctx, CTX_HCRX_EL2, read_hcrx_el2());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -931,9 +931,9 @@ void cm_el2_sysregs_context_restore(uint32_t security_state)
|
|||
#if ENABLE_FEAT_CSV2_2
|
||||
el2_sysregs_context_restore_csv2(el2_sysregs_ctx);
|
||||
#endif
|
||||
#if ENABLE_FEAT_HCX
|
||||
el2_sysregs_context_restore_hcx(el2_sysregs_ctx);
|
||||
#endif
|
||||
if (is_feat_hcx_supported()) {
|
||||
write_hcrx_el2(read_ctx_reg(el2_sysregs_ctx, CTX_HCRX_EL2));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* CTX_INCLUDE_EL2_REGS */
|
||||
|
|
Loading…
Add table
Reference in a new issue