Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm64: fix fvp smp faild to boot #14476

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arch/arm64/src/common/arm64_cpustart.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ int up_cpu_start(int cpu)
#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));
up_flush_dcache((uintptr_t)address, (uintptr_t)address + sizeof(address));
#endif

arm64_start_cpu(cpu);
Expand Down
2 changes: 2 additions & 0 deletions boards/arm64/fvp-v8r/fvp-armv8r/configs/nsh_smp/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ CONFIG_ARCH_CHIP_FVP_ARMV8R=y
CONFIG_ARCH_CHIP_FVP_R82=y
CONFIG_ARCH_EARLY_PRINT=y
CONFIG_ARCH_INTERRUPTSTACK=4096
CONFIG_ARM64_SMP_BUSY_WAIT=y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why FVP needs busy wait?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FVP SMP startup has always been using the busywait strategy. Before my modification, it serially waited for a fixed global variable (cpu_ready_flag). After I changed it to parallel startup for CPUs (1 to n), I added a wait address for more generality. However, at that time, the FVP SMP was not configured accordingly, leading to this error.

Additionally, let me mention that the arm64 QEMU SMP startup uses the PSCI method, rather than busywait.

CONFIG_ARM64_SMP_BUSY_WAIT_FLAG_ADDR=0x60000
CONFIG_ARM64_STRING_FUNCTION=y
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y
Expand Down
6 changes: 6 additions & 0 deletions boards/arm64/fvp-v8r/fvp-armv8r/scripts/dramboot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
****************************************************************************/

#include <nuttx/config.h>

OUTPUT_ARCH(aarch64)

ENTRY(__start)
Expand Down Expand Up @@ -93,6 +95,10 @@ SECTIONS
} :text
_edata = .; /* End+1 of .data */

#if defined(CONFIG_SMP) && defined(CONFIG_ARM64_SMP_BUSY_WAIT)
. = CONFIG_ARM64_SMP_BUSY_WAIT_FLAG_ADDR + 4;
#endif

.bss : { /* BSS */
. = ALIGN(8);
_sbss = .;
Expand Down