Sync secondary core bootup.

This commit is contained in:
tuyuyang 2024-07-08 22:04:29 +08:00
parent 8d3af6f6e5
commit e3d3f4845a
2 changed files with 5 additions and 3 deletions

View File

@ -13,7 +13,7 @@ endif
ifeq ($(BOARD), 3568) ifeq ($(BOARD), 3568)
toolchain ?= aarch64-none-elf- toolchain ?= aarch64-none-elf-
user_ldflags = -N -Ttext 0 user_ldflags = -N -Ttext 0
cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie cflags = -Wall -O2 -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie
board_specs = stub.o board_specs = stub.o
endif endif

View File

@ -70,6 +70,7 @@ int main(void)
spinlock_unlock(&whole_kernel_lock); spinlock_unlock(&whole_kernel_lock);
} }
core_init_done |= (1 << cpu_id);
spinlock_lock(&whole_kernel_lock); spinlock_lock(&whole_kernel_lock);
if (cpu_id == 0) { if (cpu_id == 0) {
/* init softkernel */ /* init softkernel */
@ -80,7 +81,9 @@ int main(void)
for (int i = 1; i < NR_CPU; i++) { for (int i = 1; i < NR_CPU; i++) {
// start secondary cpus // start secondary cpus
cpu_start_secondary(i); if (core_init_done & (1 << (i - 1)) != 0) {
cpu_start_secondary(i);
}
} }
/* start first task */ /* start first task */
@ -93,7 +96,6 @@ int main(void)
struct SchedulerRightGroup scheduler_rights; struct SchedulerRightGroup scheduler_rights;
assert(AchieveResourceTag(&scheduler_rights.mmu_driver_tag, &hardkernel_tag, "mmu-ac-resource")); assert(AchieveResourceTag(&scheduler_rights.mmu_driver_tag, &hardkernel_tag, "mmu-ac-resource"));
assert(AchieveResourceTag(&scheduler_rights.intr_driver_tag, &hardkernel_tag, "intr-ac-resource")); assert(AchieveResourceTag(&scheduler_rights.intr_driver_tag, &hardkernel_tag, "intr-ac-resource"));
core_init_done |= (1 << cpu_id);
LOG_PRINTF("CPU %d init done\n", cpu_id); LOG_PRINTF("CPU %d init done\n", cpu_id);
spinlock_unlock(&whole_kernel_lock); spinlock_unlock(&whole_kernel_lock);