1 /*
2  * Copyright 2021 The Hafnium Authors.
3  *
4  * Use of this source code is governed by a BSD-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/BSD-3-Clause.
7  */
8 
9 #include "hf/arch/init.h"
10 #include "hf/arch/mmu.h"
11 #include "hf/arch/plat/psci.h"
12 
13 #include "hf/layout.h"
14 
15 /**
16  * Performs arch specific boot time initialization.
17  */
arch_one_time_init(void)18 void arch_one_time_init(void)
19 {
20 	plat_psci_init();
21 }
22 
23 /**
24  * Updates the hypervisor page table such that the stack address range
25  * is mapped into the address space at the corresponding address range in the
26  * architecture-specific mode.
27  */
arch_stack_mm_init(struct mm_stage1_locked stage1_locked,struct mpool * ppool)28 bool arch_stack_mm_init(struct mm_stage1_locked stage1_locked,
29 			struct mpool *ppool)
30 {
31 #if ENABLE_MTE
32 	return mm_identity_map(stage1_locked, layout_stacks_begin(),
33 			       layout_stacks_end(),
34 			       MM_MODE_R | MM_MODE_W | MM_MODE_T, ppool);
35 #else
36 	return mm_identity_map(stage1_locked, layout_stacks_begin(),
37 			       layout_stacks_end(), MM_MODE_R | MM_MODE_W,
38 			       ppool);
39 #endif
40 }
41