powerpc/64s: Move CPU -mtune options into Kconfig
authorMichael Ellerman <mpe@ellerman.id.au>
Wed, 29 Mar 2023 23:43:08 +0000 (10:43 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 24 Aug 2023 22:39:29 +0000 (08:39 +1000)
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.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230329234308.2215833-1-mpe@ellerman.id.au
arch/powerpc/Makefile
arch/powerpc/platforms/Kconfig.cputype

index cbd34459cce086a958a2d726a834cf2687cc331e..f19dbaa1d54136a8f28f8b2d6fd39df91741e36a 100644 (file)
@@ -157,9 +157,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)
 
index 45fd975ef5212a2f0e65bef984f546a322aea912..db39eca3b1be7e38c16716a1b698b455f7e55346 100644 (file)
@@ -275,6 +275,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