Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1338532rwb; Thu, 6 Oct 2022 11:32:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM527M9x5/wpOdyT8hjvWjD/dlZj3Q9MinNMI210nvT7RWoMJDkVcALYPhJZUuDwcyfEUmvr X-Received: by 2002:a63:f705:0:b0:44b:796c:bc11 with SMTP id x5-20020a63f705000000b0044b796cbc11mr1006142pgh.206.1665081133599; Thu, 06 Oct 2022 11:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665081133; cv=none; d=google.com; s=arc-20160816; b=fXrQXVgYPQnI3VrTeUz4XgJ00Ul0mKVbpD1oz0PaMkty/UR45PMXwuzmzjx4RnQj1g Lo8KKV5VQdx5UtZPKDuDcjX0+RqsqmSVePF/Ycs4m3vTmu4GHqHYtfk+NyzCrghQJlSf kk0SWbIum0YF5oSE4pe6p7mAsv+NAE/Cq1Z0ew6Mf3Xsd+4VcQ+/Ggi7Ne6q6uL/94mE LrrczwMpJUp3agMPQMqLRmbQtZV7ILpVNYXeWkcQoJ3266upD2m6WmHrZuMQSfr42H/p GEIq24SWEeeayGG1IcfDk969GLGd+g6uV0z+J7BSVui56MiAfy8dluIqEzXG8fculGly txxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5di1mef+s93D06PoGdZpdieC3cihFP4nPet8n7DwROo=; b=n1XLIlH7VJrxBZ2jt5GGWvvzJ/kYwPs9tYFjkTyoDmQ44GQA1BAOdLcz6xb8zgTJiy 4XtGi+vCoVhtO4T3+hZnl6kmw7E7FYNHJSkvqAR2dmCeweD2WruM0Hjw7YLXF40sfxnE StD8522ZWztTxqIycQBckOL+fy4YcnJRc7VuxzrsBiGZYcSiBRM0qcRZ267kN9WWTTh5 hspJ2g4uWz9CB1NHQ3qJhuB73HmSca76/JLVgleFSkgJXnRA++qvEym9dC3W8k/xlgID nWayTGY11LctaZQeAQz8/PHHcdAT9mOD5wpwxpnNrA3bzgl9H3GxuTQM490gidqOhJKJ ErRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020a170903204c00b0017bcea4e6b6si17149540pla.234.2022.10.06.11.31.52; Thu, 06 Oct 2022 11:32:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbiJFRx5 (ORCPT + 99 others); Thu, 6 Oct 2022 13:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbiJFRxy (ORCPT ); Thu, 6 Oct 2022 13:53:54 -0400 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D434F7CABC for ; Thu, 6 Oct 2022 10:53:51 -0700 (PDT) Received: from ip5b412258.dynamic.kabel-deutschland.de ([91.65.34.88] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ogV3x-0001hI-UG; Thu, 06 Oct 2022 19:53:37 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Palmer Dabbelt , Nathan Chancellor , Nick Desaulniers , Conor Dooley Cc: Tom Rix , Conor Dooley , Dao Lu , Guo Ren , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Kevin Hilman Subject: Re: [PATCH 1/2] riscv: fix detection of toolchain Zicbom support Date: Thu, 06 Oct 2022 19:53:36 +0200 Message-ID: <14737143.tv2OnDr8pf@diego> In-Reply-To: <20221006173520.1785507-2-conor@kernel.org> References: <20221006173520.1785507-1-conor@kernel.org> <20221006173520.1785507-2-conor@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Conor, Am Donnerstag, 6. Oktober 2022, 19:35:20 CEST schrieb Conor Dooley: > From: Conor Dooley > > It is not sufficient to check if a toolchain supports a particular > extension without checking if the linker supports that extension too. > For example, Clang 15 supports Zicbom but GNU bintutils 2.35.2 does > not, leading build errors like so: > > riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicbom1p0_zihintpause2p0: Invalid or unknown z ISA extension: 'zicbom' > > Convert CC_HAS_ZICBOM to TOOLCHAIN_HAS_ZICBOM & check if the linker > also supports Zicbom. > > Reported-by: Kevin Hilman > Link: https://github.com/ClangBuiltLinux/linux/issues/1714 > Link: https://storage.kernelci.org/next/master/next-20220920/riscv/defconfig+CONFIG_EFI=n/clang-16/logs/kernel.log > Fixes: 1631ba1259d6 ("riscv: Add support for non-coherent devices using zicbom extension") > Signed-off-by: Conor Dooley > --- > arch/riscv/Kconfig | 10 ++++++---- > arch/riscv/Makefile | 3 +-- > 2 files changed, 7 insertions(+), 6 deletions(-) > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > index d557cc50295d..6da36553158b 100644 > --- a/arch/riscv/Kconfig > +++ b/arch/riscv/Kconfig > @@ -401,14 +401,16 @@ config RISCV_ISA_SVPBMT > > If you don't know what to do here, say Y. > > -config CC_HAS_ZICBOM > +config TOOLCHAIN_HAS_ZICBOM > bool > - default y if 64BIT && $(cc-option,-mabi=lp64 -march=rv64ima_zicbom) > - default y if 32BIT && $(cc-option,-mabi=ilp32 -march=rv32ima_zicbom) > + default y > + depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zicbom) > + depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zicbom) > + depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900 I did needed to look quite closely at the cc-option-voodoo, but it really seems to work out as expected :-) I can't say much to the specific L(L)D_VERSION values but the change itself looks good, so Reviewed-by: Heiko Stuebner > > config RISCV_ISA_ZICBOM > bool "Zicbom extension support for non-coherent DMA operation" > - depends on CC_HAS_ZICBOM > + depends on TOOLCHAIN_HAS_ZICBOM > depends on !XIP_KERNEL && MMU > select RISCV_DMA_NONCOHERENT > select RISCV_ALTERNATIVE > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile > index 3fa8ef336822..3607d38edb4f 100644 > --- a/arch/riscv/Makefile > +++ b/arch/riscv/Makefile > @@ -57,8 +57,7 @@ toolchain-need-zicsr-zifencei := $(call cc-option-yn, -march=$(riscv-march-y)_zi > riscv-march-$(toolchain-need-zicsr-zifencei) := $(riscv-march-y)_zicsr_zifencei > > # Check if the toolchain supports Zicbom extension > -toolchain-supports-zicbom := $(call cc-option-yn, -march=$(riscv-march-y)_zicbom) > -riscv-march-$(toolchain-supports-zicbom) := $(riscv-march-y)_zicbom > +riscv-march-$(CONFIG_TOOLCHAIN_HAS_ZICBOM) := $(riscv-march-y)_zicbom > > # Check if the toolchain supports Zihintpause extension > toolchain-supports-zihintpause := $(call cc-option-yn, -march=$(riscv-march-y)_zihintpause) >