[PATCH RFC 03/10] riscv: kconfig: Simply arch selection

Charlie Jenkins charlie at rivosinc.com
Wed Dec 10 08:13:40 PST 2025


Separate out the base arch into kconfig so it's reusable as a string
variable.

Signed-off-by: Charlie Jenkins <thecharlesjenkins at gmail.com>
---
 arch/riscv/Kconfig  | 5 +++++
 arch/riscv/Makefile | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 22a6fed0b216..ecf22223962a 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -418,6 +418,11 @@ config ARCH_RV64I
 
 endchoice
 
+config ARCH
+	string
+	default "rv32ima" if ARCH_RV32I
+	default "rv64ima" if ARCH_RV64I
+
 # We must be able to map all physical memory into the kernel, but the compiler
 # is still a bit more efficient when generating code if it's setup in a manner
 # such that it can only map 2GiB of memory.
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 4c6de57f65ef..ef1a7b1bffe8 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -58,8 +58,7 @@ ifeq ($(CONFIG_SHADOW_CALL_STACK),y)
 endif
 
 # ISA string setting
-riscv-march-$(CONFIG_ARCH_RV32I)	:= rv32ima
-riscv-march-$(CONFIG_ARCH_RV64I)	:= rv64ima
+riscv-march-y				:= $(CONFIG_ARCH)
 riscv-march-$(CONFIG_FPU)		:= $(riscv-march-y)fd
 riscv-march-$(CONFIG_RISCV_ISA_C)	:= $(riscv-march-y)c
 riscv-march-$(CONFIG_RISCV_ISA_V)	:= $(riscv-march-y)v

-- 
2.43.0




More information about the linux-riscv mailing list