arm64: refine the code for primary core checking

We can find caller of z_arm64_mmu_init is on primary
core or not, so no need to check mpidr, just add a
function parameter.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
This commit is contained in:
Jiafei Pan 2021-04-15 11:49:55 +08:00 committed by Anas Nashif
commit 7889364771
4 changed files with 7 additions and 7 deletions

View file

@ -785,7 +785,7 @@ static sys_slist_t domain_list;
* This function provides the default configuration mechanism for the Memory
* Management Unit (MMU).
*/
void z_arm64_mmu_init(void)
void z_arm64_mmu_init(bool is_primary_core)
{
unsigned int flags = 0U;
@ -801,7 +801,7 @@ void z_arm64_mmu_init(void)
/*
* Only booting core setup up the page tables.
*/
if (IS_PRIMARY_CORE()) {
if (is_primary_core) {
kernel_ptables.base_xlat_table = new_table();
setup_page_tables(&kernel_ptables);
}

View file

@ -20,9 +20,9 @@
extern FUNC_NORETURN void z_cstart(void);
#ifdef CONFIG_ARM_MMU
extern void z_arm64_mmu_init(void);
extern void z_arm64_mmu_init(bool is_primary_core);
#else
static inline void z_arm64_mmu_init(void) { }
static inline void z_arm64_mmu_init(bool is_primary_core) { }
#endif
static inline void z_arm64_bss_zero(void)
@ -52,7 +52,7 @@ void z_arm64_prep_c(void)
#ifdef CONFIG_XIP
z_data_copy();
#endif
z_arm64_mmu_init();
z_arm64_mmu_init(true);
z_arm64_interrupt_init();
z_cstart();

View file

@ -68,7 +68,7 @@ void z_arm64_secondary_start(void)
/* Initialize tpidrro_el0 with our struct _cpu instance address */
write_tpidrro_el0((uintptr_t)&_kernel.cpus[cpu_num]);
z_arm64_mmu_init();
z_arm64_mmu_init(false);
#ifdef CONFIG_SMP
arm_gic_secondary_init();

View file

@ -195,7 +195,7 @@ struct arm_mmu_ptables {
extern const struct arm_mmu_config mmu_config;
struct k_thread;
void z_arm64_mmu_init(void);
void z_arm64_mmu_init(bool is_primary_core);
void z_arm64_thread_pt_init(struct k_thread *thread);
void z_arm64_swap_ptables(struct k_thread *thread);