ARM64多核CPU启动流程

ARM64多核CPU启动流程


ARM64使用ACPI parking protocol specification


BP核:
start_kernel//开始初始化内核需要的全局变量,硬件资源等
-> setup_arch
    -> setup_processor
-> cpu_init //设定IRQ堆栈
-> rest_init //在最后启动其他核
    -> kernel_thread(kernel_init, NULL, CLONE_FS);


kernel_init
    -> kernel_init_freeable();
-> smp_init
   -> cpu_up()
-> _cpu_up()
   -> __cpu_up()
-> boot_secondary
   -> cpu_ops[cpu]->cpu_boot(cpu);
    -> try_to_run_init_process("/sbin/init")
-> run_init_process
   -> do_execve
    -> try_to_run_init_process("/etc/init")
    -> try_to_run_init_process("/bin/init")




const struct cpu_operations smp_parking_protocol_ops = {
.name = "parking-protocol",
.cpu_init = smp_parking_protocol_cpu_init,
.cpu_prepare = smp_parking_protocol_cpu_prepare,
.cpu_boot = smp_parking_protocol_cpu_boot,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_disable = smp_parking_protocol_cpu_disable,
.cpu_die = smp_parking_protocol_cpu_die,
#endif
};


cpu_ops[cpu]->cpu_boot(cpu); 调用了 smp_parking_protocol_cpu_boot,


smp_parking_protocol_cpu_boot
    -> writeq(__pa(secondary_entry), &mailbox->entry_point);




secondary_entry
    -> secondary_startup
-> __secondary_switched
   -> secondary_start_kernel //正式启动下一个CPU,AP核



你可能感兴趣的:(硬件知识,虚拟化,系统编程,内核,工作)