arch/arm64: make per-core -mcpu flags reachable in both build systems

Every ARCH_CORTEX_A5x config selects ARCH_ARMV8A, and both
Toolchain.defs and cmake/Toolchain.cmake test CONFIG_ARCH_ARMV8A at
the head of the chain, so the -mcpu=cortex-a53/a55/a57/a72 branches
were unreachable and all Cortex-A targets built with plain
-march=armv8-a, losing per-core scheduling/tuning.

Test the specific cores first so -mcpu wins for them; the generic
ARCH_ARMV8A branch still covers cores without a dedicated entry and
keeps the armv8.5-a/MTE handling. Also add the missing cortex-a55
branch to the cmake toolchain for parity with the makefile.

Signed-off-by: rikaken2004 <244897142+rikaken2004@users.noreply.github.com>
This commit is contained in:
rikaken2004 2026-09-30 16:30:54 +08:00 • committed by GUIDINGLI
parent dfd1bf6738
commit 693513f034
2 changed files with 18 additions and 16 deletions

View file

@ -32,7 +32,15 @@
# reliable code generation.
#
ifeq ($(CONFIG_ARCH_ARMV8A),y)
ifeq ($(CONFIG_ARCH_CORTEX_A53),y)
ARCHCPUFLAGS += -mcpu=cortex-a53
else ifeq ($(CONFIG_ARCH_CORTEX_A55),y)
ARCHCPUFLAGS += -mcpu=cortex-a55
else ifeq ($(CONFIG_ARCH_CORTEX_A57),y)
ARCHCPUFLAGS += -mcpu=cortex-a57
else ifeq ($(CONFIG_ARCH_CORTEX_A72),y)
ARCHCPUFLAGS += -mcpu=cortex-a72
else ifeq ($(CONFIG_ARCH_ARMV8A),y)
ifeq ($(CONFIG_ARCH_AS_HAS_ARMV8_5),y)
OPTION_MARCH = -march=armv8.5-a
else
@ -48,14 +56,6 @@ else ifeq ($(CONFIG_ARCH_ARMV8R),y)
else
ARCHCPUFLAGS += -march=armv8-r+nofp
endif
else ifeq ($(CONFIG_ARCH_CORTEX_A53),y)
ARCHCPUFLAGS += -mcpu=cortex-a53
else ifeq ($(CONFIG_ARCH_CORTEX_A55),y)
ARCHCPUFLAGS += -mcpu=cortex-a55
else ifeq ($(CONFIG_ARCH_CORTEX_A57),y)
ARCHCPUFLAGS += -mcpu=cortex-a57
else ifeq ($(CONFIG_ARCH_CORTEX_A72),y)
ARCHCPUFLAGS += -mcpu=cortex-a72
else ifeq ($(CONFIG_ARCH_CORTEX_R82),y)
ARCHCPUFLAGS += -mcpu=cortex-r82
endif

View file

@ -25,7 +25,15 @@ set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_C_COMPILER_FORCED TRUE)
set(CMAKE_CXX_COMPILER_FORCED TRUE)
if(CONFIG_ARCH_ARMV8A)
if(CONFIG_ARCH_CORTEX_A53)
add_compile_options(-mcpu=cortex-a53)
elseif(CONFIG_ARCH_CORTEX_A55)
add_compile_options(-mcpu=cortex-a55)
elseif(CONFIG_ARCH_CORTEX_A57)
add_compile_options(-mcpu=cortex-a57)
elseif(CONFIG_ARCH_CORTEX_A72)
add_compile_options(-mcpu=cortex-a72)
elseif(CONFIG_ARCH_ARMV8A)
add_compile_options(-march=armv8-a)
elseif(CONFIG_ARCH_ARMV8R)
if(CONFIG_ARCH_FPU)
@ -33,12 +41,6 @@ elseif(CONFIG_ARCH_ARMV8R)
else()
add_compile_options(-march=armv8-r+nofp)
endif()
elseif(CONFIG_ARCH_CORTEX_A53)
add_compile_options(-mcpu=cortex-a53)
elseif(CONFIG_ARCH_CORTEX_A57)
add_compile_options(-mcpu=cortex-a57)
elseif(CONFIG_ARCH_CORTEX_A72)
add_compile_options(-mcpu=cortex-a72)
elseif(CONFIG_ARCH_CORTEX_R82)
add_compile_options(-mcpu=cortex-r82)
endif()