There is not need to init bootstrap page table in all CPUs, bootstrap page table is only for boot, when jump to C language environment it will use the formal page table instead of bootstrap page table.
Init bootstrap page table in all CPUs will impact hypervisor startup time. Signed-off-by: Dongjiu Geng <[email protected]> --- hypervisor/arch/arm64/entry.S | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/hypervisor/arch/arm64/entry.S b/hypervisor/arch/arm64/entry.S index a9cabf7f..69af05f9 100644 --- a/hypervisor/arch/arm64/entry.S +++ b/hypervisor/arch/arm64/entry.S @@ -22,6 +22,9 @@ #define LINUX_HVC_SET_VECTORS_LEGACY 1 #define LINUX_HVC_SET_VECTORS 0 +#define INITIALIZED_BOOTSTRAP_PT 1 +#define UNINITIALIZED_BOOTSTRAP_PT 0 + .data vmexits_total: .quad CPU_STAT_VMEXITS_TOTAL @@ -29,6 +32,9 @@ vmexits_total: vmexits_smccc: .quad CPU_STAT_VMEXITS_SMCCC +bootstrap_pt_status: + .byte UNINITIALIZED_BOOTSTRAP_PT + /* x11 must contain the virt-to-phys offset */ .macro virt2phys, register add \register, \register, x11 @@ -120,15 +126,24 @@ el2_entry: cmp x1, #0x16 b.ne . /* not hvc */ + adr x0, bootstrap_pt_status + ldaxr w1, [x0] + mov w2, #INITIALIZED_BOOTSTRAP_PT + /* Check whether bootstrap page table is created */ + cmp w1, w2 + b.eq 1f + + /* Set inited status */ + stlxr w1, w2, [x0] /* init bootstrap page tables */ bl init_bootstrap_pt - +1: /* enable temporary mmu mapings for early initialization */ adr x0, bootstrap_pt_l0 - adr x30, 1f /* set lr manually to ensure... */ + adr x30, 2f /* set lr manually to ensure... */ phys2virt x30 /* ...that we return to a virtual address */ b enable_mmu_el2 -1: +2: /* install the final vectors */ adr x1, hyp_vectors msr vbar_el2, x1 -- 2.17.1 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/20210814135557.13135-1-gengdongjiu1%40gmail.com.
