Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4618225rwb; Mon, 31 Jul 2023 09:28:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlGrUnrvPXkwVdyDX5s1f0REwC9KktlteSaWd8GlIOtH45jUVjEj5BFHSIVZgOYOsTRpVLY4 X-Received: by 2002:a05:6a00:10c1:b0:687:2fa9:532d with SMTP id d1-20020a056a0010c100b006872fa9532dmr4319064pfu.17.1690820935684; Mon, 31 Jul 2023 09:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690820935; cv=none; d=google.com; s=arc-20160816; b=d14RxqZ6GE+TTXdOdaCG3agZLxDPyfJ+OTfNBf4+mOHaD8yQp50YI8emOkgwR13fij xq+FmCqHLsh8TB+/8UE4ofDrK2+C9aRkjCarYJmf3VuYW+Mp+0YydbuYNCCHRrNWrHum yEnu1SnOBPy4byroBdvuPT8VYnlQ40no5FTRDghJi3mITH7e9i4ihC0LYwPfpm+4Ott/ nfSyoKrloOTlpLqHNk7GBj/MuadVOEQy1DFN+EytPFGUs4bVr4XkftAZxKveQ4Zkmxel 3ku13SslhZDxJLq8MGz7Tw6hwKiq/lekehKe5ZSQKZ0PdYRq+jjZSw/O4GMuJLdMFrUS GNWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id; bh=LkyqsatKx6sGzPpKL4uKFeEhwmBCUMVowczbV1WzDvo=; fh=tMvkx44n2T7f7VZvSmj07JsGu6FbmEjHSo102g5qPBQ=; b=AyEe5/RsXKxGv0ofJMeJsrWFOdHq+l1/5aGoprQzoAEn4DW7rqwVkH1/9ZjZ38+Mxj s+st9zDsyKfIlYyF82PUjxObb3aSCkzmTQ3/ldrtvizJPlJCETdtXm6P2sKGbSiK+N0H HKy8j9LhM2YF+f/6x708y5ZdB/bCvdfMAhiWPW8oR/z8CC+yLh2znm3Ecgznm0iEo/ri FHlDE4BJhDMUsxJ8A99FXPslQyBCeVj3XHZ+NwRtE3oK/LwS2oIA5OA9KH1n/oSxVbJs 6TunpCkwGCycHBUq7lHF8apyiZaItOJ3lzfzjO8GmNycuFnpGz6ldhccL1wT79cf0sp6 qQ+w== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ei33-20020a056a0080e100b00687080bf78dsi6249726pfb.284.2023.07.31.09.28.43; Mon, 31 Jul 2023 09:28:55 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232099AbjGaPvy (ORCPT + 99 others); Mon, 31 Jul 2023 11:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbjGaPvw (ORCPT ); Mon, 31 Jul 2023 11:51:52 -0400 Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA9B210D; Mon, 31 Jul 2023 08:51:50 -0700 (PDT) Received: from [192.168.0.107] (unknown [111.197.209.91]) by APP-03 (Coremail) with SMTP id rQCowAC312Re2MdksdyvDw--.16505S2; Mon, 31 Jul 2023 23:50:54 +0800 (CST) Message-ID: Date: Mon, 31 Jul 2023 23:50:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] riscv: Handle zicsr/zifencei issue between gcc and binutils Content-Language: en-US To: Conor Dooley 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, Guo Ren References: <20230731095534.22842-1-xingmingzheng@iscas.ac.cn> <20230731150511.38140-1-xingmingzheng@iscas.ac.cn> <20230731-legume-commend-9aafd84c1fb2@spud> From: Mingzheng Xing Organization: ISCAS In-Reply-To: <20230731-legume-commend-9aafd84c1fb2@spud> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: rQCowAC312Re2MdksdyvDw--.16505S2 X-Coremail-Antispam: 1UD129KBjvJXoWxXw4kuF4rKFyDXr1rXw17Awb_yoW5Gryrpr WfuF1Durs5Kw18J3Z5JF1UX3WYgrZ3G342gF15t34DWrs5GFykKr4S9w43uFn8ZFn2gr1Y vrn29FZYgw1DAaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvCb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwV C2z280aVCY1x0267AKxVWxJr0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xv F2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r 4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwACI402YVCY1x02628vn2kIc2xK xwCYjI0SjxkI62AI1cAE67vIY487MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r 1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CE b7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0x vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAI cVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2Kf nxnUUI43ZEXa7IU56c_DUUUUU== X-Originating-IP: [111.197.209.91] X-CM-SenderInfo: 50lqwzhlqj6xxhqjqxpvfd2hldfou0/1tbiCgkJCmTHu5c2qAAAsR X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 7/31/23 23:24, Conor Dooley wrote: > On Mon, Jul 31, 2023 at 11:05:11PM +0800, Mingzheng Xing wrote: >> Binutils-2.38 and GCC-12.1.0 bumped[0][1] the default ISA spec to the newer >> 20191213 version 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 explicitly specifying Zicsr and Zifencei via -march >> to cope with the new changes. but this only occurs when binutils >= 2.36 >> and GCC >= 11.1.0. It's a different story when binutils < 2.36. >> >> binutils-2.36 supports the Zifencei extension[2] and splits Zifencei and >> Zicsr from I[3]. GCC-11.1.0 is particular[4] because it add support Zicsr >> and Zifencei extension for -march. binutils-2.35 does not support the >> Zifencei extension, and does not need to specify Zicsr and Zifencei when >> working with GCC >= 12.1.0. >> >> To make our lives easier, let's relax the check to binutils >= 2.36 in >> CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. For the other two cases, >> where clang < 17 or GCC < 11.1.0, we will deal with them in >> CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC. >> >> For more information, please refer to: >> commit 6df2a016c0c8 ("riscv: fix build with binutils 2.38") >> commit e89c2e815e76 ("riscv: Handle zicsr/zifencei issues between clang and binutils") >> Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc [0] >> Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd [1] >> Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5a1b31e1e1cee6e9f1c92abff59cdcfff0dddf30 [2] >> Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=729a53530e86972d1143553a415db34e6e01d5d2 [3] >> Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b03be74bad08c382da47e048007a78fa3fb4ef49 [4] >> Link: https://lore.kernel.org/all/20230308220842.1231003-1-conor@kernel.org >> Link: https://lore.kernel.org/all/20230223220546.52879-1-conor@kernel.org >> Cc: >> Signed-off-by: Mingzheng Xing > This looks good to me now, thanks! Hopefully the next time we look at > this code is removing support for binutils 2.35 :) Thank you for the quick reply. Hopefully no more "with weeping and gnashing of teeth". ; > Reviewed-by: Conor Dooley > > Cheers, > Conor.