arm64:add busy wait flag

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-08-05 18:47:34 +08:00 committed by Xiang Xiao
parent 6dd26a3e68
commit 956d77ba23
3 changed files with 27 additions and 0 deletions

View File

@ -136,6 +136,17 @@ config ARCH_SINGLE_SECURITY_STATE
GIC or other ARM architecture feature will with different GIC or other ARM architecture feature will with different
configure configure
config ARM64_SMP_BUSY_WAIT
bool "Busy wait when SMP boot"
default n
depends on SMP
---help---
Enables busy wait when SMP boot
config ARM64_SMP_BUSY_WAIT_FLAG_ADDR
hex "Busy wait flag address"
depends on ARM64_SMP_BUSY_WAIT
config ARCH_HAVE_EL3 config ARCH_HAVE_EL3
bool bool
default n default n

View File

@ -207,6 +207,12 @@ int up_cpu_start(int cpu)
sched_note_cpu_start(this_task(), cpu); sched_note_cpu_start(this_task(), cpu);
#endif #endif
#ifdef CONFIG_ARM64_SMP_BUSY_WAIT
uint32_t *address = (uint32_t *)CONFIG_ARM64_SMP_BUSY_WAIT_FLAG_ADDR;
*address = 1;
up_flush_dcache((uintptr_t)address, sizeof(address));
#endif
arm64_start_cpu(cpu); arm64_start_cpu(cpu);
return 0; return 0;

View File

@ -144,6 +144,16 @@ real_start:
cmp x1, #0 cmp x1, #0
beq primary_core beq primary_core
/* Wait until cpu0 notify */
#ifdef CONFIG_ARM64_SMP_BUSY_WAIT
ldr x2, =CONFIG_ARM64_SMP_BUSY_WAIT_FLAG_ADDR
1:
ldr x3, [x2, #0]
cmp x3, #0
beq 1b
#endif
/* we can now load our stack pointer value and move on */ /* we can now load our stack pointer value and move on */
ldr x24, =g_cpu_idlestackalloc ldr x24, =g_cpu_idlestackalloc