refactor: memory config moved to vcpu context
This change is motivated by [1] where secure accessible only EL2
registers are no longer saved/restored as part of the EL3 context switch
sequence. This mainly concerns VSTCR_EL2/VSTTBR_EL2.
From Hafnium (SPMC) perspective VTCR_EL2/VSTCR_EL2 are statically
configured once for all at boot time. Provided that VSTCR_EL2 is no
longer maintained as part of EL2 SPMC state, its contents can be lost
upon a core resume from suspend.
This change moves VTCR_EL2/VTTBR_EL2/VSTCR_EL2/VSTTBR_EL2 as part of the
(S-)EL2 vCPU switch sequence. Those become VM/vCPU properties rather
than SPMC's.
In effect VTCR_EL2/VSTCR_EL2 (non-secure and secure IPA spaces
configuration) hold the same values across all vCPUs (whichever the VM).
VTTBR_EL2/VSTTBR_EL2 hold the same values for all vCPUs within a VM
(point to VM non-secure/secure IPA root page tables). Presently this
address is equal for both IPA spaces. In a future change
VTTBR_EL2/VSTTBR_EL2 will be split into different sets of page tables.
Note non-secure VTCR_EL2/VTTBR_EL2 are kept in the EL3 sequence but also
added to vCPU context for the sake of completeness but that may not be
strictly required.
[1] https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/13803
Change-Id: I9a85ab106a81086be07fd93088d6501cae83c43f
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/inc/hf/arch/mm.h b/inc/hf/arch/mm.h
index 043c564..83dabce 100644
--- a/inc/hf/arch/mm.h
+++ b/inc/hf/arch/mm.h
@@ -184,3 +184,7 @@
* Returns the maximum supported PA Range in bits.
*/
uint32_t arch_mm_get_pa_range(void);
+
+uintptr_t arch_mm_get_vtcr_el2(void);
+
+uintptr_t arch_mm_get_vstcr_el2(void);