arch: arm: aarch64: export z_arm64_mmu_init for SMP

Export z_arm64_mmu_init for SMP usage

Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
Peng Fan 2020-11-22 13:00:08 +08:00 committed by Anas Nashif
commit 251b1d39ac
3 changed files with 10 additions and 2 deletions

View file

@ -532,8 +532,13 @@ void z_arm64_mmu_init(void)
/* Ensure that MMU is already not enabled */ /* Ensure that MMU is already not enabled */
__ASSERT((read_sctlr_el1() & SCTLR_M_BIT) == 0, "MMU is already enabled\n"); __ASSERT((read_sctlr_el1() & SCTLR_M_BIT) == 0, "MMU is already enabled\n");
kernel_ptables.base_xlat_table = new_table(); /*
setup_page_tables(&kernel_ptables); * Only booting core setup up the page tables.
*/
if (IS_PRIMARY_CORE()) {
kernel_ptables.base_xlat_table = new_table();
setup_page_tables(&kernel_ptables);
}
/* currently only EL1 is supported */ /* currently only EL1 is supported */
enable_mmu_el1(&kernel_ptables, flags); enable_mmu_el1(&kernel_ptables, flags);

View file

@ -142,6 +142,7 @@
#define TCR_PS_BITS_256TB 0x5ULL #define TCR_PS_BITS_256TB 0x5ULL
#ifndef _ASMLANGUAGE #ifndef _ASMLANGUAGE
/* Region definition data structure */ /* Region definition data structure */
struct arm_mmu_region { struct arm_mmu_region {
/* Region Base Physical Address */ /* Region Base Physical Address */
@ -193,6 +194,7 @@ struct arm_mmu_ptables {
*/ */
extern const struct arm_mmu_config mmu_config; extern const struct arm_mmu_config mmu_config;
void z_arm64_mmu_init(void);
#endif /* _ASMLANGUAGE */ #endif /* _ASMLANGUAGE */
#endif /* ZEPHYR_INCLUDE_ARCH_ARM64_MMU_ARM_MMU_H_ */ #endif /* ZEPHYR_INCLUDE_ARCH_ARM64_MMU_ARM_MMU_H_ */

View file

@ -77,6 +77,7 @@
#define GET_MPIDR() read_sysreg(mpidr_el1) #define GET_MPIDR() read_sysreg(mpidr_el1)
#define MPIDR_TO_CORE(mpidr) MPIDR_AFFLVL(mpidr, 0) #define MPIDR_TO_CORE(mpidr) MPIDR_AFFLVL(mpidr, 0)
#define IS_PRIMARY_CORE() (!MPIDR_TO_CORE(GET_MPIDR()))
#define MODE_EL_SHIFT (0x2) #define MODE_EL_SHIFT (0x2)
#define MODE_EL_MASK (0x3) #define MODE_EL_MASK (0x3)