ATF (ARM Trusted Firmware) is an important software in ARMv8.
Instead of using the whole, part of it is available.
This document explains how to do when using BL31 (EL3 Runtime Firmware) alone, for example, with Xilinx's Zynq UltraScale + MPSoC.

cm_prepare_el3_exit /* If execution is requested to EL2 or hyp mode, SCTLR_EL2 is initialized If execution is requested to non-secure EL1 or svc mode, and the CPU supports EL2 then EL2 is disabled by configuring all necessary EL2 registers. For all entries, the EL1 registers are initialized from the cpu_context */ void cm_prepare_el3_exit(uint32_t security_state) {https://github.com/ARM-software/arm-trusted-firmware/blob/master/lib/el3_runtime/aarch64/context_mgmt.c