feat(fake_host): Add support for per PE sysreg emulation
This patch adds support to emulate per PE sysreg access to the host_util
library on the fake_host platform. This allows to emulate different CPUs
by calling host_util_cpuid() with the desired CPU to emulate.
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: I97c7f299ff78a9cf5dc78f353d7526a0209cdc6b
diff --git a/plat/host/host_build/src/host_setup.c b/plat/host/host_build/src/host_setup.c
index ead28aa..d1b3c98 100644
--- a/plat/host/host_build/src/host_setup.c
+++ b/plat/host/host_build/src/host_setup.c
@@ -33,6 +33,12 @@
static void setup_sysreg_and_boot_manifest(void)
{
/*
+ * By default, set current CPU to be CPU0.
+ * Fake host doesn't support using more than one CPU.
+ */
+ host_util_set_cpuid(0U);
+
+ /*
* Initialize ID_AA64MMFR0_EL1 with a physical address
* range of 48 bits (PARange bits set to 0b0101)
*/
@@ -49,9 +55,15 @@
/* SCTLR_EL2 is reset to zero */
(void)host_util_set_default_sysreg_cb("sctlr_el2", 0UL);
+ /* TPIDR_EL2 is reset to zero */
+ (void)host_util_set_default_sysreg_cb("tpidr_el2", 0UL);
+
/* Initialize the boot manifest */
boot_manifest->version = RMM_EL3_IFC_SUPPORTED_VERSION;
boot_manifest->plat_data = (uintptr_t)NULL;
+
+ /* Store current CPU ID into tpidr_el2 */
+ write_tpidr_el2(0);
}
/*
@@ -69,10 +81,10 @@
(void)argc;
(void)argv;
- setup_sysreg_and_boot_manifest();
-
VERBOSE("RMM: Beginning of Fake Host execution\n");
+ setup_sysreg_and_boot_manifest();
+
plat_setup(0UL,
RMM_EL3_IFC_ABI_VERSION,
RMM_EL3_MAX_CPUS,