From a462e4f4c74aa58ced1f0f765766d815e906b4ad Mon Sep 17 00:00:00 2001 From: Xiaochuan Mao Date: Mon, 2 Jan 2023 11:36:56 +0800 Subject: [PATCH] arch:add loongarch support Signed-off-by: Xiaochuan Mao Signed-off-by: loongson Signed-off-by: maoxiaochuan --- arch/Config.in | 13 ++++ arch/Config.in.loongarch | 133 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 arch/Config.in.loongarch diff --git a/arch/Config.in b/arch/Config.in index f39c33ef..9bddf81d 100644 --- a/arch/Config.in +++ b/arch/Config.in @@ -77,6 +77,15 @@ config BR2_i386 Intel i386 architecture compatible microprocessor http://en.wikipedia.org/wiki/I386 +config BR2_loongarch + bool "LoongArch" + select BR2_ARCH_NEEDS_GCC_AT_LEAST_12 + help + LoongArch is a RISC architecture created by Loongson. Little endian. + http://www.loongson.cn/ + http://en.wikipedia.org/wiki/LoongArch + + config BR2_m68k bool "m68k" # MMU support is set by the subarchitecture file, arch/Config.in.m68k @@ -374,6 +383,10 @@ if BR2_arm || BR2_armeb || BR2_aarch64 || BR2_aarch64_be source "arch/Config.in.arm" endif +if BR2_loongarch +source "arch/Config.in.loongarch" +endif + if BR2_m68k source "arch/Config.in.m68k" endif diff --git a/arch/Config.in.loongarch b/arch/Config.in.loongarch new file mode 100644 index 00000000..ac0aa5ff --- /dev/null +++ b/arch/Config.in.loongarch @@ -0,0 +1,133 @@ +# LoongArch CPU ISA extensions. + +config BR2_LOONGARCH_ISA_LSX + bool + +config BR2_LOONGARCH_ISA_LASX + bool + +config BR2_LOONGARCH_EXT + bool "Extension Support" + help + Enable this option if your LoongArch core has a extension (LSX or LASX). + +if BR2_LOONGARCH_EXT + +comment "Instruction Set Extensions" + +config BR2_LOONGARCH_ISA_HAS_LSX + bool "Loongson simd extension(LSX)" + select BR2_LOONGARCH_ISA_LSX + +config BR2_LOONGARCH_ISA_HAS_LASX + bool "Loongson adanvce simd extension(LASX)" + select BR2_LOONGARCH_ISA_LASX + +endif + +choice + prompt "Target Architecture Size" + default BR2_LOONGARCH_64 + +config BR2_LOONGARCH_32 + bool "32-bit" + select BR2_ARCH_IS_32 + +config BR2_LOONGARCH_64 + bool "64-bit" + select BR2_ARCH_IS_64 + +endchoice + +config BR2_LOONGARCH_USE_MMU + bool "MMU support" + default y + depends on BR2_LOONGARCH_64 + select BR2_USE_MMU + help + Enable this option if your LoongArch core has a MMU (Memory + Management Unit). + +config BR2_LOONGARCH_SOFT_FLOAT + bool "Use soft-float" + select BR2_SOFT_FLOAT + help + If your target CPU does not have a Floating Point Unit (FPU) + or a kernel FPU emulator, but you still wish to support + floating point functions, then everything will need to be + compiled with soft floating point support (-msoft-float). + +choice + prompt "FP mode" + default BR2_LOONGARCH_FP32_MODE_64 + depends on !BR2_LOONGARCH_SOFT_FLOAT + help + LoongArch supports different FP modes (32,64). Information + about FP modes can be found here: + https://gcc.gnu.org/onlinedocs/gcc/LoongArch-Options.html + +config BR2_LOONGARCH_FP32_MODE_32 + bool "32" + +config BR2_LOONGARCH_FP32_MODE_64 + bool "64" +endchoice + + +choice + prompt "Target ABI" + default BR2_LOONGARCH_ABI_ILP32D if BR2_ARCH_IS_32 && BR2_LOONGARCH_FP32_MODE_64 + default BR2_LOONGARCH_ABI_ILP32F if BR2_ARCH_IS_32 && BR2_LOONGARCH_FP32_MODE_32 + default BR2_LOONGARCH_ABI_ILP32S if BR2_ARCH_IS_32 + default BR2_LOONGARCH_ABI_LP64D if BR2_ARCH_IS_64 && BR2_LOONGARCH_FP32_MODE_64 + default BR2_LOONGARCH_ABI_LP64F if BR2_ARCH_IS_64 && BR2_LOONGARCH_FP32_MODE_32 + default BR2_LOONGARCH_ABI_LP64S if BR2_ARCH_IS_64 + +config BR2_LOONGARCH_ABI_ILP32S + bool "ilp32s" + depends on !BR2_ARCH_IS_64 + +config BR2_LOONGARCH_ABI_ILP32F + bool "ilp32f" + depends on !BR2_ARCH_IS_64 + +config BR2_LOONGARCH_ABI_ILP32D + bool "ilp32d" + depends on !BR2_ARCH_IS_64 + +config BR2_LOONGARCH_ABI_LP64S + bool "lp64s" + depends on BR2_ARCH_IS_64 + +config BR2_LOONGARCH_ABI_LP64F + bool "lp64f" + depends on BR2_ARCH_IS_64 + +config BR2_LOONGARCH_ABI_LP64D + bool "lp64d" + depends on BR2_ARCH_IS_64 +endchoice + +config BR2_ARCH + default "loongarch32" if !BR2_ARCH_IS_64 + default "loongarch64" if BR2_ARCH_IS_64 + +config BR2_NORMALIZED_ARCH + default "loongarch" + +config BR2_ENDIAN + default "LITTLE" + +config BR2_GCC_TARGET_ABI + default "ilp32s" if BR2_LOONGARCH_ABI_ILP32S + default "ilp32f" if BR2_LOONGARCH_ABI_ILP32F + default "ilp32d" if BR2_LOONGARCH_ABI_ILP32D + default "lp64s" if BR2_LOONGARCH_ABI_LP64S + default "lp64f" if BR2_LOONGARCH_ABI_LP64F + default "lp64d" if BR2_LOONGARCH_ABI_LP64D + +config BR2_READELF_ARCH_NAME + default "LoongArch" + +# vim: ft=kconfig +# -*- mode:kconfig; -*-