Skip to contentSkip to conversation

powerpc/64s: Move CPU -mtune options into Kconfig

PATCH Applied Michael Ellerman 2 participants 2 messages Mar 29, 2023 – Aug 31, 2023 PowerPC

lore
Share & tools
lore

Michael Ellerman

author reviewer
#0 lore raw

PATCH 1/1 powerpc/64s: Move CPU -mtune options into Kconfig

Currently the -mtune options are set in the Makefile, depending on what the compiler supports.

One downside of doing it that way is that the chosen -mtune option is not recorded in the .config.

Another downside is that if there's ever a need to do more complicated logic to calculate the correct option, that gets messy in the Makefile.

So move the determination of which -mtune option to use into Kconfig logic.

---
 arch/powerpc/Makefile                  | 4 +---
 arch/powerpc/platforms/Kconfig.cputype | 7 +++++++
 2 files changed, 8 insertions(+), 3 deletions(-)
arch/powerpc/Makefile +1 -3
index 87d6ac27eebd..779956007f0c 100644
@@ -156,9 +156,7 @@ endif
 CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
 AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
 
-CFLAGS-$(CONFIG_POWERPC64_CPU) += $(call cc-option,-mtune=power10,	\
-				  $(call cc-option,-mtune=power9,	\
-				  $(call cc-option,-mtune=power8)))
+CFLAGS-y += $(CONFIG_TUNE_CPU)
 
 asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
 
arch/powerpc/platforms/Kconfig.cputype +7 -0
index 046b571496b1..76d6daa6c79d 100644
@@ -273,6 +273,13 @@ config TARGET_CPU
 	default "e500mc" if E500MC_CPU
 	default "powerpc" if POWERPC_CPU
 
+config TUNE_CPU
+	string
+	depends on POWERPC64_CPU
+	default "-mtune=power10" if $(cc-option,-mtune=power10)
+	default "-mtune=power9"  if $(cc-option,-mtune=power9)
+	default "-mtune=power8"  if $(cc-option,-mtune=power8)
+
 config PPC_BOOK3S
 	def_bool y
 	depends on PPC_BOOK3S_32 || PPC_BOOK3S_64
Signature · 1 line
2.39.2
#1 lore raw
Quoted 10 lines · Michael Ellerman

Currently the -mtune options are set in the Makefile, depending on what the compiler supports.

One downside of doing it that way is that the chosen -mtune option is not recorded in the .config.

Another downside is that if there's ever a need to do more complicated logic to calculate the correct option, that gets messy in the Makefile.

[...]

Applied to powerpc/next.

[1/1] powerpc/64s: Move CPU -mtune options into Kconfig

      https://git.kernel.org/powerpc/c/50832720ec54c39ab189cd5e057aec1c514978ce

cheers