Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1441590rwb; Wed, 26 Jul 2023 12:33:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlHTVwVdWDAzXObdKm+zGH+CQBNFJLfJfQhrOtyWueetyd6UMp1zSCf4eFcwVM4xChIX5Eqx X-Received: by 2002:a17:90a:4547:b0:267:f147:6fe0 with SMTP id r7-20020a17090a454700b00267f1476fe0mr2370539pjm.16.1690399987077; Wed, 26 Jul 2023 12:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690399987; cv=none; d=google.com; s=arc-20160816; b=sG0CBcY8Ag54yeee1j2EjryXZzrhe5lqB9YpHQTzymi8YEzzR0GrlNkiCYLsP9L81c jLl3wypHwdmVK76cs4kOdcskkClOj9AlIkayqao6gE6WPb533KbD06GyeQ+5UCnF1Mcd C4yfrYSmAd7P7EYQbTZFaQ0HW1n+R+biUm+iTI6k+Mw3p4s1vuoGA5X7JcNsM/iPB2fL ZRcaYSG84YD5z13vEKYhN+J0ep+cc9PFHmQEo10EJvKNk1Z162UJODAPko3K1GNaIHUS 7FHfeqMVr1v65tF5LZgrsm9xggPBnoeJLqfNta8ZjMMrbwhBtr5pN1g0D7oZHXYl4CmO I4cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ASLPWY8mmYPYPdaoUp/25lRoO0neQqtF+LkprZS0M0I=; fh=zS+A7qZs79zdVjHVa2CWyX2E3FUP37EDSArE4iNS2Og=; b=OMRoAR8nMjsAZt9BmIo9sV2ugT/CIA0MGIXgYqDYkVeo8N6JyArjUlZEqIzSdEbLAH MFYhYNuSnS8B5hzkgM7vGldz82XlQUxlpTZOrG7aZSid8j5ycoMQZ9KmwpF5g7JBdeQj 6uGCNQ39UiuOTXIPQL+YlJ7IlhI2x1yf3TFo+nlArVbkXpIHMiwuSEQ7zVZoILgS1kAf oG4QrDH1fCNwETSdLwUday9uRIAdP5ehocnP4jWBgF1AxItj5DJ+ZWZgiYBytaPjAdSH 3Oa21jKH7GpLDG8VEytNZYRxEPU9ZoGzB7dLjJzaTh2Pk8S8HlaMj2aEedHq9PGR/R47 EcvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QRZb+vSd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a17090a2b8e00b002680f00f8f3si1471423pjd.17.2023.07.26.12.32.53; Wed, 26 Jul 2023 12:33:07 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QRZb+vSd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbjGZSCp (ORCPT + 99 others); Wed, 26 Jul 2023 14:02:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230000AbjGZSCo (ORCPT ); Wed, 26 Jul 2023 14:02:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4B32269E; Wed, 26 Jul 2023 11:02:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 55CFA61C2A; Wed, 26 Jul 2023 18:02:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4799CC433C7; Wed, 26 Jul 2023 18:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690394561; bh=ZuEBFKvfvWvmo7RjmoDN0IFVptnWEiaCxWHx7e3scdo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QRZb+vSdMaDrEDii2mqaKfhC/axpTjFGGcq/anbalORnGsHk6wpre5hOHR7uDoIc7 fVQLRH3RQZjibGwjweDJJAQI7GBqxNXjoNe2eKK57v5o5lJcuU4QL8aHvUezuWzyZx rJsq3Rdr4RAZJdMyLKtsQyDouD3QDh9sWFsl2PTwcNeG0RGXEVKrFmpv7Ciyhqhphd 5Y3+70q3IVKS4GJ+EpIEF9OfVPMTrvA2/PO1uaTFTgdQMa5pUeW9AWtaHNQSwS80S3 AdwpA1VTAcGbBVVgAV3lwY8mb5k/mAvBS9Exee15tqIbRnpnzFsalAyXf2nGvb3iGt wqJLsyvJkYc8g== Date: Wed, 26 Jul 2023 19:02:36 +0100 From: Conor Dooley To: Mingzheng Xing Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers , Tom Rix , Bin Meng , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, stable@vger.kernel.org Subject: Re: [PATCH v2] riscv: Handle zicsr/zifencei issue between gcc and binutils Message-ID: <20230726-outclass-parade-2ccea9f6688a@spud> References: <20230726174524.340952-1-xingmingzheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UtMXT2cLyqU/RCBj" Content-Disposition: inline In-Reply-To: <20230726174524.340952-1-xingmingzheng@iscas.ac.cn> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 --UtMXT2cLyqU/RCBj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 27, 2023 at 01:45:24AM +0800, Mingzheng Xing wrote: > Binutils-2.38 and GCC-12.1.0 bump[0] default ISA spec to newer version > 20191213 which moves some instructions from the I extension to the > Zicsr and Zifencei extensions. So if one of the binutils and GCC exceeds > that version, we should turn on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI > to cope with the new changes. >=20 > The case of clang is special[1][2], where older clang versions (<17) need > to be rolled back to old ISA spec to fix it. And the less common case, > since older GCC versions (<11.1.0) did not support zicsr and zifencei Can you provide a link to explain why this is 11.1.0 in particular? > extension for -march, also requires a fallback to cope with it. >=20 > For more information, please refer to: > commit 6df2a016c0c8 ("riscv: fix build with binutils 2.38") > commit e89c2e815e76 ("riscv: Handle zicsr/zifencei issues between clang a= nd binutils") > Link: https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3D98416dbb0a62579= d4a7a4a76bab51b5b52fec2cd [0] > Link: https://lore.kernel.org/all/20230308220842.1231003-1-conor@kernel.o= rg [1] > Link: https://lore.kernel.org/all/20230223220546.52879-1-conor@kernel.org= [2] > Link: https://lore.kernel.org/all/20230725170405.251011-1-xingmingzheng@i= scas.ac.cn This shouldn't be here, you don't link to your old patches. > Signed-off-by: Mingzheng Xing This is still broken for: CONFIG_CLANG_VERSION=3D0 CONFIG_AS_IS_GNU=3Dy CONFIG_AS_VERSION=3D23500 CONFIG_LD_IS_BFD=3Dy CONFIG_LD_VERSION=3D23500 Please don't post a v2 while there is still ongoing discussion on the v1. I'll try to reply here tomorrow with a diff you can fold in to fix the problem. Thanks, Conor. > --- >=20 > v2: > - Update the Kconfig help text and commit message. > - Add considerations for low version gcc case. >=20 > Sorry for the formatting error on my mailing list reply. >=20 > arch/riscv/Kconfig | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) >=20 > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > index 4c07b9189c86..08afd47de157 100644 > --- a/arch/riscv/Kconfig > +++ b/arch/riscv/Kconfig > @@ -570,24 +570,27 @@ config TOOLCHAIN_HAS_ZIHINTPAUSE > config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI > def_bool y > # https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3Daed44= 286efa8ae8717a77d94b51ac3614e2ca6dc > - depends on AS_IS_GNU && AS_VERSION >=3D 23800 > + # https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3D98416dbb0a62579d4= a7a4a76bab51b5b52fec2cd > + depends on GCC_VERSION >=3D 120100 || (AS_IS_GNU && AS_VERSION >=3D 238= 00) > help > - Newer binutils versions default to ISA spec version 20191213 which > - moves some instructions from the I extension to the Zicsr and Zifencei > - extensions. > + Binutils-2.38 and GCC-12.1.0 bump default ISA spec to newer version > + 20191213 which moves some instructions from the I extension to the > + Zicsr and Zifencei extensions. > =20 > config TOOLCHAIN_NEEDS_OLD_ISA_SPEC > def_bool y > depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI > # https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4= 498694e15bf8a16 > - depends on CC_IS_CLANG && CLANG_VERSION < 170000 > + # https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3Db03be74bad08c382d= a47e048007a78fa3fb4ef49 > + depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || \ > + (CC_IS_GCC && GCC_VERSION < 110100) > help > - Certain versions of clang do not support zicsr and zifencei via -march > - but newer versions of binutils require it for the reasons noted in the > - help text of CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. This > + Certain versions of clang (or GCC) do not support zicsr and zifencei = via > + -march but newer versions of binutils require it for the reasons noted > + in the help text of CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. T= his > option causes an older ISA spec compatible with these older versions > - of clang to be passed to GAS, which has the same result as passing zi= csr > - and zifencei to -march. > + of clang (or GCC) to be passed to GAS, which has the same result as > + passing zicsr and zifencei to -march. > =20 > config FPU > bool "FPU support" > --=20 > 2.34.1 >=20 >=20 > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv --UtMXT2cLyqU/RCBj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZMFfvAAKCRB4tDGHoIJi 0qoeAQDp3ypoQuZjQevaA9Hr4AFTnPXwwDMwgAo89yt9uZDNRgD/XaPIQrd0555E aPpCSI4Ukz489022i+qI1s80u07U0AI= =UaXr -----END PGP SIGNATURE----- --UtMXT2cLyqU/RCBj--