From patchwork Thu Mar 2 13:16:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 13157324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B859CC678D4 for ; Thu, 2 Mar 2023 13:17:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229621AbjCBNRe (ORCPT ); Thu, 2 Mar 2023 08:17:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjCBNRd (ORCPT ); Thu, 2 Mar 2023 08:17:33 -0500 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E5073B21C for ; Thu, 2 Mar 2023 05:17:23 -0800 (PST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4PSBTp5dcqz4x1d; Fri, 3 Mar 2023 00:17:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1677763038; bh=MifMs1bYypPRVegWJmGbBMcmeEdR8W68yonET0zBtlA=; h=From:To:Cc:Subject:Date:From; b=SvrbGhactm4hGihZSENvYpT3ku+abvNzD3dgrGhh6vKIkL8Wnv71oDhr/TYLiwg/b goLE+dyyzOwo5XJRBybL2yuI3Zc4IgZXnZUYufbUKntx/7UtmnS5oDVH3LCBgxRWoa zz+HNAY4t9PigfOMBHVmu6jo5ueFtRqFQ6XiUrzejuoGZ5j7oMgRqu2eoV5x8kDwQ+ fN7/l9PIa6XVeV9GvcLXDeFMcWvnLLFK8Hv0M9oCbRpfa38OD1INNrsEMCrJDqTKxs kpgL5nMFKYOqXd0hjtQwKNSYQzm9WUTu8jwr0DR1/LX245tAFIucho2aMvZ0wA3GYk B+1Eb3pbxcVwA== From: Michael Ellerman To: Cc: , Subject: [PATCH 1/2] powerpc/64: Move CPU -mtune options into Kconfig Date: Fri, 3 Mar 2023 00:16:55 +1100 Message-Id: <20230302131656.50626-1-mpe@ellerman.id.au> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently the -mtune options are set in the Makefile, depending on what is 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 doing more complicated logic to calculate the correct option gets messy in the Makefile. So move the determination of which -mtune option to use into Kconfig logic. Signed-off-by: Michael Ellerman Reviewed-by: Nathan Chancellor --- arch/powerpc/Makefile | 4 +--- arch/powerpc/platforms/Kconfig.cputype | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 87d6ac27eebd..779956007f0c 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -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) diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index 046b571496b1..7d7477b73951 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -273,6 +273,12 @@ config TARGET_CPU default "e500mc" if E500MC_CPU default "powerpc" if POWERPC_CPU +config TUNE_CPU + string + default "-mtune=power10" if POWERPC64_CPU && CC_IS_GCC && $(cc-option,-mtune=power10) + default "-mtune=power9" if POWERPC64_CPU && CC_IS_GCC && $(cc-option,-mtune=power9) + default "-mtune=power8" if POWERPC64_CPU && CC_IS_GCC && $(cc-option,-mtune=power8) + config PPC_BOOK3S def_bool y depends on PPC_BOOK3S_32 || PPC_BOOK3S_64 From patchwork Thu Mar 2 13:16:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 13157323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E87A3C6FA8E for ; Thu, 2 Mar 2023 13:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229836AbjCBNRd (ORCPT ); Thu, 2 Mar 2023 08:17:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjCBNRb (ORCPT ); Thu, 2 Mar 2023 08:17:31 -0500 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DC5F3B0F5 for ; Thu, 2 Mar 2023 05:17:23 -0800 (PST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4PSBTq2Dr6z4x80; Fri, 3 Mar 2023 00:17:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1677763039; bh=0JIQWJKznz7AtiZOyXNJNdwCGrnZhYEwd8v6MXpZZbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mx3WB01f/BIglEyoyz+c+rctgDHNseoJp9meZk/si0LfJlCdGCBb32q1e/Ju7OZ9c fXqmqO2TeyTW5dj1LmXzJsKsDNHVmNC80eQ5YlYFfXOxIBMVZZaSB1U+0Ql/J0swlZ HpYWMXDdtuuH1WvKQcsjx4DRRY8cSrMlXnL7HX+al/ESHnErySHt/jcQTcTNmJlIeS GVC9R/XgWOd22ZBBJ6fYGZDm5xjhWtTQzVWiAQLA8pHPu4p64HSRTd4gjDsoSY5Z9W Mwiy64D7rMVg/u6kj/lzGJwTsM2wWvU7ouw7MSegeBNawSOrewwjZP4s4IqhHlR48X frBVjzrU/EnoA== From: Michael Ellerman To: Cc: , Subject: [PATCH 2/2] powerpc/64: Use -mtune=pwr10/9/8 for clang Date: Fri, 3 Mar 2023 00:16:56 +1100 Message-Id: <20230302131656.50626-2-mpe@ellerman.id.au> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230302131656.50626-1-mpe@ellerman.id.au> References: <20230302131656.50626-1-mpe@ellerman.id.au> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org For the -mtune option clang doesn't accept power10/9/8, instead it accepts pwr10/9/8. That will be fixed in future versions of clang, but the kernel must support the clang versions in the wild. So add support for the "pwr" spelling if clang is in use. Reported-by: Nathan Chancellor BugLink: https://github.com/ClangBuiltLinux/linux/issues/1799 Signed-off-by: Michael Ellerman Reported-by: Nick Desaulniers Reviewed-by: Nathan Chancellor --- arch/powerpc/platforms/Kconfig.cputype | 4 ++++ 1 file changed, 4 insertions(+) Need to confirm the clang <= 16 statement is correct. diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index 7d7477b73951..e4e0e81be7de 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -278,6 +278,10 @@ config TUNE_CPU default "-mtune=power10" if POWERPC64_CPU && CC_IS_GCC && $(cc-option,-mtune=power10) default "-mtune=power9" if POWERPC64_CPU && CC_IS_GCC && $(cc-option,-mtune=power9) default "-mtune=power8" if POWERPC64_CPU && CC_IS_GCC && $(cc-option,-mtune=power8) + # clang <= 16 only supports the "pwr" names + default "-mtune=pwr10" if POWERPC64_CPU && CC_IS_CLANG && $(cc-option,-mtune=pwr10) + default "-mtune=pwr9" if POWERPC64_CPU && CC_IS_CLANG && $(cc-option,-mtune=pwr9) + default "-mtune=pwr8" if POWERPC64_CPU && CC_IS_CLANG && $(cc-option,-mtune=pwr8) config PPC_BOOK3S def_bool y