[PATCH 1/4] sparc32: Add support for specifying -mcpu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add support for selecting the CPU architecture.
The default is leon3 - which is the minimum required as the kernel uses
CAS instructions.

Inspired by (from gaisler-buildroot-2023.02-1.0):
    0001-sparc32-leon-Build-with-mcpu-leon3-for-SPARC_LEON.patch
    0028-sparc32-leon-Make-what-mcpu-to-be-used-configurable-.patch

Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Cc: Andreas Larsson <andreas@xxxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxxxx>
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
---
 arch/sparc/Kconfig  | 24 ++++++++++++++++++++++++
 arch/sparc/Makefile | 13 +++++--------
 2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 1b9cf7f3c500..e94783ceb409 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -161,6 +161,30 @@ config ARCH_SUPPORTS_UPROBES
 
 menu "Processor type and features"
 
+choice
+	prompt "LEON architecture"
+	default SPARC_CPU_LEON3
+	help
+	  Select the architecture the kernel shall be built for
+
+config SPARC_CPU_LEON3
+	prompt "LEON 3"
+	help
+	  Build the kernel for the LEON 3 architecture
+
+config SPARC_CPU_LEON5
+	prompt "LEON 5"
+	help
+	  Build the kernel for the LEON 5 architecture
+
+config SPARC_CPU_DEFAULT
+	bool "Toolchain default"
+	help
+	  Build the kernel with no -mcpu option, getting the default
+	  for the toolchain that is being used.
+
+endchoice
+
 config SMP
 	bool "Symmetric multi-processing support"
 	help
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 5f6035936131..3c3a1fd8c873 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -25,14 +25,11 @@ KBUILD_LDFLAGS := -m elf32_sparc
 export BITS    := 32
 UTS_MACHINE    := sparc
 
-# We are adding -Wa,-Av8 to KBUILD_CFLAGS to deal with a specs bug in some
-# versions of gcc.  Some gcc versions won't pass -Av8 to binutils when you
-# give -mcpu=v8.  This silently worked with older bintutils versions but
-# does not any more.
-KBUILD_CFLAGS  += -m32 -mcpu=v8 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
-KBUILD_CFLAGS  += -Wa,-Av8
-
-KBUILD_AFLAGS  += -m32 -Wa,-Av8
+cpuflags-$(CONFIG_SPARC_CPU_LEON3)	:= -mcpu=leon3
+cpuflags-$(CONFIG_SPARC_CPU_LEON5)	:= -mcpu=leon5
+
+KBUILD_CFLAGS  += -m32 $(cpuflags-y) -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
+KBUILD_AFLAGS  += -m32 $(cpuflags-y)
 
 else
 #####
-- 
2.34.1





[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux