The TF-A is often started before the MMU is initialized. There are some
exceptions though. On Layerscape  the TF-A (or: PPA in that case) is
started while the MMU is running. The PPA is then executed in EL3 and
returns in EL2. For this case setup the TTB for EL2 as well so that we
have a valid MMU setup when the PPA returns.

Signed-off-by: Sascha Hauer <[email protected]>
---
 arch/arm/cpu/mmu_64.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index b718cb1efa..716e717c72 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -297,6 +297,8 @@ void mmu_early_enable(unsigned long membase, unsigned long 
memsize)
 
        el = current_el();
        set_ttbr_tcr_mair(el, ttb, calc_tcr(el, BITS_PER_VA), 
MEMORY_ATTRIBUTES);
+       if (el == 3)
+               set_ttbr_tcr_mair(2, ttb, calc_tcr(2, BITS_PER_VA), 
MEMORY_ATTRIBUTES);
 
        memset((void *)ttb, 0, GRANULE_SIZE);
 
-- 
2.39.2


Reply via email to