From patchwork Sat Apr 2 05:00:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12798949 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9D1EC4332F for ; Sat, 2 Apr 2022 05:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9UeD+goNro8ybUotwkYYA1/ADBd7YeU5DmcMLFdhiNU=; b=RFHK+KTF9cTt5P 8BuCtN8oYAt66AVW/RDhYPsXgn70k1xWYeuXmvfQ5K0rme/xfUYwyNXjIjtcR6+5I8GQX2MizlK5X KALLe98MTgvRNCivQYOSGi/MGVZsj0sVaF7aRv/rG5Vo2ExAnmX0p7xHbuEiG8itwHN5hG1F45YU/ RdfuEwfRZOm6d8woiJ+GkoWFu2Q7I5iKkEsXQgkRL7shTVUl2OO3OImEZv68LlYsYy1vVBtfneOej 0QO7U1CDEyRCiFQddtwVQcY0IiZseyHJfpbeDc9scIQQ9GGV1LyC7hfmPoH4+NUMsVg4wIlySDrSZ 56D5pgxWohIbzpbAgTMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVva-007zdk-JN; Sat, 02 Apr 2022 05:03:58 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVvX-007zbx-9m for linux-riscv@lists.infradead.org; Sat, 02 Apr 2022 05:03:57 +0000 Received: by mail-pj1-x102d.google.com with SMTP id a16-20020a17090a6d9000b001c7d6c1bb13so4262533pjk.4 for ; Fri, 01 Apr 2022 22:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=jMnX9EwDk9B/aw5bO8HVu/sU4kD+BbpBPauEL2qiKx4=; b=ViQw8PLACBP3xKUfrnPxVyLuGlZYQyC8xj1oZnlBSUb7YXlWewI3dNZqJtdcZoL9B+ KhEhDnvodyTLqs8kG986cVw+wV995en7vQ5K8QXbuWGcWxM754A/hkbK95MsSuAaqGtg mp/9ndPxm2y/4vED5DAbcuzPnDglFUmUHc48mxHa7nlhGFwgtSDa6GDEMiIJZwrRKOdM Hoej1k3LHvhIuQMv/tyrN2oeYejcN4VWNPwO3uz8N6P6QsDh/qrbnRj02EadoM8Zr9vj Nc6FoMwuJf4ljNJhGxMAcRrgyuRPL8aORM98amFNLejxWL2+vQ9yRZGl5wegcmpThfRQ 4gPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=jMnX9EwDk9B/aw5bO8HVu/sU4kD+BbpBPauEL2qiKx4=; b=vkE5Q8ekTPvPU1ajwNf/aw+KwEG+TI/4Y+lxAbQexoC+n+3WhA4jRfJ/GdjSZeILWz T996mPh6TSPmuQluleWAnJbHcZzqQkMLEZ8UJVXGzrQtnh4hDx38BGMIXhcex/wXujDg 7OCjgmfG0yNVsqMvCcZXAQTgZ3LV0nQPjrHa8x+klvEsKjIlWmEPocWeDWCoCG6H/MnV O55Z/5WkzKSQbrJhMCtf/rKdIHZYj09qo13k3Oup06cOm3bVYFz5qF5AsAvEW85wyVrp 3dNqyOxVtkgWMqbDYvHYpy1HwmTFei9DpBuPIFzucZ1qxZglWSxIw7oXhFtJ3VyccV2t wCdg== X-Gm-Message-State: AOAM531LSFIKmVU5tbbM1s3ARm0kMgA/UibL8hcJbhnxXYxtV4wGPRqg 28XsaLIQMwPfrHP/+sNFJcyDoQ== X-Google-Smtp-Source: ABdhPJz7SXTBVPKMIoy1/H98gQ1tDFCdG2zxWr503oWcC/rbFVxGf4XiFWtqqRKYYMzaFpyBxmDmVA== X-Received: by 2002:a17:903:244e:b0:155:e4a0:bbf1 with SMTP id l14-20020a170903244e00b00155e4a0bbf1mr38668296pls.47.1648875833478; Fri, 01 Apr 2022 22:03:53 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id gt14-20020a17090af2ce00b001c701e0a129sm14905615pjb.38.2022.04.01.22.03.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 22:03:53 -0700 (PDT) Subject: [PATCH v1 1/6] RISC-V: Respect -Wsparse-error for -march errors Date: Fri, 1 Apr 2022 22:00:36 -0700 Message-Id: <20220402050041.21302-2-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402050041.21302-1-palmer@rivosinc.com> References: <20220402050041.21302-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: Palmer Dabbelt , Linus Torvalds From: Palmer Dabbelt To: linux-sparse@vger.kernel.org, Kito Cheng , linux-riscv@lists.infradead.org, mkl@pengutronix.de, aurelien@aurel32.net, Linus Torvalds X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220401_220355_440804_4708E700 X-CRM114-Status: GOOD ( 17.29 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Parsing RISC-V ISA strings is extremely complicated: there are many extensions, versions of extensions, versions of the ISA string rules, and a bunch of unwritten rules to deal with all the bugs that fell out of that complexity. Rather than forcing users to see an error when the ISA string parsing fails, just stop parsing where we get lost. Changes tend to end up at the end of the ISA string, so that's probably going to work (and if it doesn't there's a warning to true and clue folks in). This does have the oddity in that "-Wsparse-error -march=..." behaves differently than "-march... -Wsparse-error", but that's already the case for "--arch=... -march=..." and "-march=... --arch=...". Both "-Wsparse-error" and "--arch" are sparse-specific arguments, so they're probably both going to be in the same place. Suggested-by: Linus Torvalds Signed-off-by: Palmer Dabbelt --- lib.h | 5 +++++ options.c | 6 ------ target-riscv.c | 16 ++++++++++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib.h b/lib.h index b96e3192..2c0d7116 100644 --- a/lib.h +++ b/lib.h @@ -125,6 +125,11 @@ enum phase { #define PASS_OPTIM (1UL << PASS__OPTIM) #define PASS_FINAL (1UL << PASS__FINAL) +enum flag_type { + FLAG_OFF, + FLAG_ON, + FLAG_FORCE_OFF, +}; extern void add_pre_buffer(const char *fmt, ...) FORMAT_ATTR(1); extern void predefine(const char *name, int weak, const char *fmt, ...) FORMAT_ATTR(3); diff --git a/options.c b/options.c index 6704fc8d..41a98240 100644 --- a/options.c +++ b/options.c @@ -23,12 +23,6 @@ # define __GNUC_PATCHLEVEL__ 0 #endif -enum flag_type { - FLAG_OFF, - FLAG_ON, - FLAG_FORCE_OFF -}; - int die_if_error = 0; int do_output = 1; int gcc_major = __GNUC__; diff --git a/target-riscv.c b/target-riscv.c index 6d9113c1..f5cc6cc3 100644 --- a/target-riscv.c +++ b/target-riscv.c @@ -3,6 +3,7 @@ #include "target.h" #include "machine.h" #include +#include #define RISCV_32BIT (1 << 0) #define RISCV_64BIT (1 << 1) @@ -60,7 +61,18 @@ static void parse_march_riscv(const char *arg) goto ext; } } - die("invalid argument to '-march': '%s'\n", arg); + +unknown: + /* + * This behaves like do_warn() / do_error(), but we don't have a + * position so it's just inline here. + */ + fflush(stdout); + fprintf(stderr, "%s: invalid argument to '-march': '%s'\n", + Wsparse_error == FLAG_ON ? "error" : "warning", arg); + if (Wsparse_error == FLAG_ON) + has_error |= ERROR_CURR_PHASE; + return; ext: for (i = 0; i < ARRAY_SIZE(extensions); i++) { @@ -73,7 +85,7 @@ ext: } } if (arg[0]) - die("invalid argument to '-march': '%s'\n", arg); + goto unknown; } static void init_riscv(const struct target *self) From patchwork Sat Apr 2 05:00:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12798950 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C83BC43217 for ; Sat, 2 Apr 2022 05:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EmxlJ5I2AZTfybRI7T0XAvdsrpfzE58uYgCxBSCfy78=; b=KZVugrcedRCFYC 92HACLOp/9H4cIdP490sPfA9V6NtJv30Wq9A+8khjLCohcFVoBAzIxRdSStbOVM3fVeL9iuTGSPDk 8xBnu94DW7FbN7ZS50OzUh975l2435fokK18XES/FvsiWX9+oX5lLe+1izTYmpvNl5UajiO1AqtTo l9EFFO/aCkD5svY5kQDxcyAwbgm8Gg6XWNSK6VQMHOiP3k0KDrJv+4kaR/LtA1ZX0RJoywIfJiKFq TXguzu0DhPrUhNT7RtmVEQL8EXzkwQ9h03IFUe66J0HbgEIEEHEWWXt9IF5t1VX+DDfbfMQEwuTPr 51jmfYnX9EPaIIe1xgJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVve-007zg8-JE; Sat, 02 Apr 2022 05:04:02 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVvY-007zc3-9G for linux-riscv@lists.infradead.org; Sat, 02 Apr 2022 05:03:58 +0000 Received: by mail-pl1-x633.google.com with SMTP id j13so4092564plj.8 for ; Fri, 01 Apr 2022 22:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=2KqF8ajkBngCMtpzPUC01p5VZ7+wZvwkah/zYpqeQ7Y=; b=jsNsMmae2jOLgaWCtQBOMysvxCiEvJeN3Kqt2gLkzFoNtfya5LhsAFrcOn9mTRKUcG 7QHMl6wtxR1gnHlglQxBLt59F4AVLKRlMsZXCyVK5Sqcf3OMz6RQ2TGbK0mU6MlyYoev qjwn8G+g3hs/D9dXJRYm6BZkCmYzmOECRwYyleE6fMaT6Pb1qffhQ/+N5uqS2PbXGTiY mEjFsG7rEFduksDbrHWg+H7a2SN/GVY0BoSw4i/0+acplxKV91bS0Gz8IkzFosonzMrK WojUMu7DAuiMnRFCaIbsCGNHuWkfaflcR9DTjju4nB3z2/zXOe2x8DwklNo5aMaL1HvC Xx+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=2KqF8ajkBngCMtpzPUC01p5VZ7+wZvwkah/zYpqeQ7Y=; b=C7M2CaxyM7NYs8IngbutuY4eCFL7KkwjE9yA145GvriV1CFLpeCHGwUhYj2cNeEXhM /G0MunRTNAb+z5Z1Lbw36xktBF+BFYZzazNszYIxE/4lQrB8jL1emxWo+VDFcHh7hSoQ urvOhUiVS8hrdJZCRXZiE45GGnbKMMSGvv6CVw57mMvfN3Z9qlWp1gWi+4s9zKTswKWQ QnTo9Uz62zi8anO9XDBghXzzBf65POk5hQ0ZOiyUi7Ig0YOe2eLXCZElgy7ap37iyssU f30abvY7UcbOK52QESNtBxiwRcxy1fXKzZNapXpHIRxw8hvyD+NuswTo89yVeV0I6CFU yCKw== X-Gm-Message-State: AOAM533eS8T26ITKs/ZBs1Dri/0P8jru1iOfLlBh8x0gYd8k/ci7Keyh 3CUhshq9LbuDv+rnv/RompQGiw== X-Google-Smtp-Source: ABdhPJwdkaakkxQ/XfHz+Vtz6Vw/XxCDC2112+bF4XSWnK3bNFCY8bZJf6lZ74ZtFui8xscFnZBM4g== X-Received: by 2002:a17:90b:1bca:b0:1c9:b76f:8d76 with SMTP id oa10-20020a17090b1bca00b001c9b76f8d76mr15609934pjb.46.1648875834815; Fri, 01 Apr 2022 22:03:54 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id p3-20020a056a000b4300b004faee36ea56sm4750517pfo.155.2022.04.01.22.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 22:03:54 -0700 (PDT) Subject: [PATCH v1 2/6] RISC-V: Match GCC's semantics for multiple -march instances Date: Fri, 1 Apr 2022 22:00:37 -0700 Message-Id: <20220402050041.21302-3-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402050041.21302-1-palmer@rivosinc.com> References: <20220402050041.21302-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: Palmer Dabbelt From: Palmer Dabbelt To: linux-sparse@vger.kernel.org, Kito Cheng , linux-riscv@lists.infradead.org, mkl@pengutronix.de, aurelien@aurel32.net, Linus Torvalds X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220401_220356_358999_D27FE2FE X-CRM114-Status: GOOD ( 11.94 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org GCC's semantics for "-march=X -march=Y" are that Y entirely overrides X, but sparse takes the union of these two ISA strings. This fixes the behavior by setting, instead of oring, the flags whenever a base ISA is encountered. RISC-V ISA strings can only have a single base ISA, it's not like x86 where the 64-bit ISA is an extension of the 32-bit ISA. Signed-off-by: Palmer Dabbelt --- target-riscv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-riscv.c b/target-riscv.c index f5cc6cc3..494c08db 100644 --- a/target-riscv.c +++ b/target-riscv.c @@ -56,7 +56,7 @@ static void parse_march_riscv(const char *arg) size_t len = strlen(pat); if (!strncmp(arg, pat, len)) { - riscv_flags |= basic_sets[i].flags; + riscv_flags = basic_sets[i].flags; arg += len; goto ext; } From patchwork Sat Apr 2 05:00:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12798946 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30AD9C433FE for ; Sat, 2 Apr 2022 05:04:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Y/2tm/e/3Hvz0Zuggye5AmhqbzWB/afivep9opj+OdM=; b=uORGDDJ0L3kbhK 1lm2DRt731y89t9G5gi/+pufsELpBXWvl1sQ1CxqBvcPpJMWZ3eROu5VKGbQUgnTEcwmxMRUzBwO6 0w6xxG5i4DqdXXTm+kbQjKfeKtVvlTKHInQNLeryk3TjRvByv/IV/UuX+s8ZqJFsjysgRsxFVb2EF H4qNM9yddHp2exHgr5bI7W0MjqSsh7StRO+cXoP+dCSsLk+luXIhWl3d6bQUikyTZnWI4v5TIr2vZ k8Lfyfn8iaN4cJbX+gsUogfgbswIfDGyqYMQUboah8f2Uv1Gm7MjdWKibO037oxUorRUYhnmoDUjM H6xoROaUky38i/i7FS/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVvg-007zga-DD; Sat, 02 Apr 2022 05:04:04 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVvZ-007zcV-6A for linux-riscv@lists.infradead.org; Sat, 02 Apr 2022 05:03:58 +0000 Received: by mail-pj1-x102e.google.com with SMTP id n18-20020a17090ade9200b001ca699ee462so116714pjv.3 for ; Fri, 01 Apr 2022 22:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=JxE+RWEW+46zWhCkShHjyZUwP7jLdproVcOpdmDQ50o=; b=Cb9ifftuOEg4bNIrtw2PRgGNZ2zu7j48jLZDwdofAi6CqwlcsmMdIa0SaqlgRhbOOq zsIqhzxJ2u4/ygwb7x/QX14/1Gspc9EPZJoLcajTf8Qe9zHhirHZIhy4HlqO6RHVBzgc rk9eJX1QjVcTGG+s4XKQDgZtN0oF81PqWi12GvRAJnSChbE2F/Y0QBm9hN4/u8BMsQqn jCCfmmnN+U9SKeQf5puP9YF8npNbzY2wxmxxLuXugpWdx63XAh0gh7AT2ZZDasBlH+7A jv6LM/DJ7lQsDvtFWuKxYg0MT3fOqtiU/HG9FRAoTf3BOglfLdNnHvfnKH8oohOpTfGW iHHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=JxE+RWEW+46zWhCkShHjyZUwP7jLdproVcOpdmDQ50o=; b=jSaMnlx9sd9j6Kk20FnI9ArCQo11x81kpElN1ktdMGAJLBC6VDFcY35gvxuIDrdtF9 SfcTDHNb+4WqBCG2NKsLeFWoYewvgrOfyQ17Ye69xDN81DDFBIvMQwT+Y66T0risREXW TrwY2RrYI+NnILJVEvyhuA9/sfygS8vB55bYN+Tspf9vHSn4NbaID2uG3EmTlQYi9e7S gsHClw9YUrkr0zn/5ouPP6dcwAvfYBlIbhETIq2rSxuQybvOpxMsgPZ59JO3Ox2K5rpi fAWLXWBzdWe/AcbNyXwxiANITciw0eBbnL+BvgyWqO/9iAt451Yjtr00aq4IBfoZC5W+ ztag== X-Gm-Message-State: AOAM533Y8VpQGiD75m0w9EE5RBglFIqKvvw3FHlSzbC82KC30FK7yc1N ycx5BWvrtni7shPCyOmvhWwucA== X-Google-Smtp-Source: ABdhPJzb7WbfvbooQaPrSRud7psH6IEeYzSpvZX8Dk+vvYhoItvyyDWEmMngwytzbryJWGpSKer4Qg== X-Received: by 2002:a17:902:ef47:b0:156:646b:58e7 with SMTP id e7-20020a170902ef4700b00156646b58e7mr7741339plx.57.1648875835762; Fri, 01 Apr 2022 22:03:55 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id w129-20020a628287000000b004fdc453b49asm4790103pfd.39.2022.04.01.22.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 22:03:55 -0700 (PDT) Subject: [PATCH v1 3/6] RISC-V: Remove the unimplemented ISA extensions Date: Fri, 1 Apr 2022 22:00:38 -0700 Message-Id: <20220402050041.21302-4-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402050041.21302-1-palmer@rivosinc.com> References: <20220402050041.21302-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: Palmer Dabbelt From: Palmer Dabbelt To: linux-sparse@vger.kernel.org, Kito Cheng , linux-riscv@lists.infradead.org, mkl@pengutronix.de, aurelien@aurel32.net, Linus Torvalds X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220401_220357_303515_41E76B45 X-CRM114-Status: UNSURE ( 9.13 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org This made sense when we die()d on unknown ISA extensions, but now that we're just warning it's actually a bit detrimental: users won't see that their unimplemented ISA extensions are silently having the wrong definitions set, which may cause hard to debug failures. Signed-off-by: Palmer Dabbelt --- target-riscv.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/target-riscv.c b/target-riscv.c index 494c08db..924259af 100644 --- a/target-riscv.c +++ b/target-riscv.c @@ -37,17 +37,7 @@ static void parse_march_riscv(const char *arg) { "f", RISCV_FLOAT|RISCV_FDIV }, { "d", RISCV_DOUBLE|RISCV_FDIV }, { "g", RISCV_GENERIC }, - { "q", 0 }, - { "l", 0 }, { "c", RISCV_COMP }, - { "b", 0 }, - { "j", 0 }, - { "t", 0 }, - { "p", 0 }, - { "v", 0 }, - { "n", 0 }, - { "h", 0 }, - { "s", 0 }, }; int i; From patchwork Sat Apr 2 05:00:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12798947 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26A6EC433EF for ; Sat, 2 Apr 2022 05:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sIiG9DrpTeyE8r1h0GEMSaph2BpGL+pcr+NLcjZf9oQ=; b=Qa3+7FD7Dh/Kkg hKDODt4jKLi0m+CtgCc7QsZ+ZBRzy1XDuFeOgVsKfONtlkKIx38jRY5Lz3Na8bloU6vDjar8LAku5 i+WE/DKh4D4xnlciZr9uQKBPeeLPml4PTd1rD27qT4/TkmzYYRYmqpNeDvmSVm6Axqf6GAxftEBy8 RrsFlzOfICiHCsJhQ6wuzSkw7KVgFfGqhIP2JzDeqoeknGQPDEEIRZQsuhhuW8eaSo1KDG6AH/fvQ 1tkha5ew5kbJt7jKXrNdsrFZgNcV2QcdbhibXN5+QnRe2qwCQ1knXR+gaS9JfNOXYJU8UDHxtGvrf HECaIGGEHPXVpq2leZTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVvi-007zh1-K9; Sat, 02 Apr 2022 05:04:06 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVvZ-007zd0-O5 for linux-riscv@lists.infradead.org; Sat, 02 Apr 2022 05:03:59 +0000 Received: by mail-pj1-x102c.google.com with SMTP id l4-20020a17090a49c400b001c6840df4a3so4332309pjm.0 for ; Fri, 01 Apr 2022 22:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=iJ7fDikEqxd3GQyUocX9wfBcccairETEQwPSFnMPpXo=; b=g8LcAt61UEx9yt7MWyScZYveSn/vFYcCGkBunwwIdZQZcamvIemmUr4GO5W9ximu9q 2D2FT4C1o5AuLuNgDZnYDJ3cvndbVlCs2U+YNvMlDM34B3RzGCkDCbaT3WHMXorHdSE2 wvHt1PLakzKy0LfnlLUYzx/OcFAdxRldQI+6L3zJRu+Dqq/P0Zuc4uqdn87EUac9tjA/ RmYM1shl9saPk3MfQ67VZK8b0jG0vqBhzdmlO9GL+kOsKCGueY1N+2MysOjGD31oFdgO s6G60n8XV6AN43A28FU0cuS2kgKZWtbTaolxj//q4EspOOHzV1ejh03himE4uANlF9ue OcDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=iJ7fDikEqxd3GQyUocX9wfBcccairETEQwPSFnMPpXo=; b=nBWraIzW9h2/T1OXPHNjkOK58lwzMXN1B6aM4EUV6WfyT7VNmsf7Np6/1Y70OFVXR8 VfU3s0CSWgnM4z55KRlLu4TDMVBbcA94gTH5kbxxVHFpgJnjYprKEHZQbNp59y/03emI CnKI9hSSKMqobsboyj1jtQnk+fvATUPCVCaXRmI10Dfdqj21sZiwVH/pva8Y8iNnrDiV VGG7ebKyDnaqvSx4OLXXjS9LaQxzXRCv3FJ2ckT5a2kB9AxhgMwd5NySIfEyxrwVZY2j Xe8aIcRtIdjt9AqGL08eJEmPpBkgGngTYdvSz07hLLHdojIAaTpIkKU/8BmdqyiYtQxH iMkA== X-Gm-Message-State: AOAM5312+9DQMTu2pwJn0ftgYpzVkYGMHJEIj332eiwkg3a5g9urGqZq ynPhH79EDsxX6k1v5WUONvirOg== X-Google-Smtp-Source: ABdhPJwm12U+bQZZZiIWlcjUiM4qVbUHU8stSqN84SjntqT6rmw6vuOxTNzZ4EV5HsrEmwJM+5VehQ== X-Received: by 2002:a17:90b:1b10:b0:1c7:3413:87e0 with SMTP id nu16-20020a17090b1b1000b001c7341387e0mr15537870pjb.132.1648875836629; Fri, 01 Apr 2022 22:03:56 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id v189-20020a622fc6000000b004fb72e95806sm4574382pfv.48.2022.04.01.22.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 22:03:56 -0700 (PDT) Subject: [PATCH v1 4/6] RISC-V: Remove "g" from the extension list Date: Fri, 1 Apr 2022 22:00:39 -0700 Message-Id: <20220402050041.21302-5-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402050041.21302-1-palmer@rivosinc.com> References: <20220402050041.21302-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: Palmer Dabbelt From: Palmer Dabbelt To: linux-sparse@vger.kernel.org, Kito Cheng , linux-riscv@lists.infradead.org, mkl@pengutronix.de, aurelien@aurel32.net, Linus Torvalds X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220401_220357_815051_92AFE36F X-CRM114-Status: GOOD ( 11.08 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org "g" goes along with the base ISA, but it was being treated as an extension. This allows for all sorts of odd ISA strings to be accepted by sparse, things like "rv32ig" or "rv32gg". We're still allowing some oddities, like "rv32ga", but this one was easy to catch. Signed-off-by: Palmer Dabbelt --- target-riscv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target-riscv.c b/target-riscv.c index 924259af..5076bbaf 100644 --- a/target-riscv.c +++ b/target-riscv.c @@ -36,7 +36,6 @@ static void parse_march_riscv(const char *arg) { "a", RISCV_ATOMIC }, { "f", RISCV_FLOAT|RISCV_FDIV }, { "d", RISCV_DOUBLE|RISCV_FDIV }, - { "g", RISCV_GENERIC }, { "c", RISCV_COMP }, }; int i; From patchwork Sat Apr 2 05:00:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12798948 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32569C433F5 for ; Sat, 2 Apr 2022 05:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m3QGLFprss1KFMFto5QrogEp8BVRmNdvoJGTcTMyn4w=; b=NQfkeiLZe5QMXm JzRi7NHp0nsPaxU+zjkb3j1YM3/IgfOXTIuvokcuGzq8tARsK/jMm1D9d9mM0ZQUfIHf1dyBn04JM 4wx0uMKah7IQpZg6gCqhmDR9aOOCzjdm6dl6P3SMLyKvMVi9+sVXFuyqg0KcK7N5XID2Lmezm50WS AWBPoxu3ht3EizZoKwj6+Gx5qt9a6jgnRNzC/qM/bAt8dqSjhk8KSecujfvBouThHkp7lLuVbqVCB orMO6Omp8QZ5t+FBVX9sbVKOFvBM1xfg7kQ1IxUurxTdM5N3tY6q5N1xwvfMFGPTsSrU7+gCK7O4S 0C8rkLxePGTE9D6Hh43w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVvk-007zhV-IR; Sat, 02 Apr 2022 05:04:08 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVva-007zda-Ub for linux-riscv@lists.infradead.org; Sat, 02 Apr 2022 05:04:00 +0000 Received: by mail-pf1-x430.google.com with SMTP id z16so4397461pfh.3 for ; Fri, 01 Apr 2022 22:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=MOEc80EVu9LfPpN54gEHoEdN0FMqafE5/jJyB+b2mcQ=; b=jhrejZOdnoC3eyhsTj3pPDaw6LbO/PRUtVHyrItKfu/Hxp9RzGdFirr0W/I0tAJzd0 mMjap3JgxYJgaFwpQ17fzCS+xLQgKSGj9OkIijYfvQaTPIKQmCI2S4gQMYAuKDfgPGvM oaYgqZLnRyyevysIfQO3LAH3EbF5I2NmQhcS5v1asdrgFTZqWb54rMjwGF+azI/uvh/a NLsoHR0z1lwC+C9d1qaN6P2KhMzf1QvrqYa/hK6h/j/96ThM0XZdFtLq7qG6afqM0S+o hx2h6oXYH11QU6oqmg/466YiTwH0MfGR78NXsKNSkH0Y2ovlVXpFRb1+oy0v2yoTjAQb i2fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=MOEc80EVu9LfPpN54gEHoEdN0FMqafE5/jJyB+b2mcQ=; b=KjcJTXcVV6zKm8kQD/jiz2wj8eJhgs7PJRr1TU7Fmr+INoYABNyloMu3ocbiLEaDhz er4MEJwVioHJwm+ZTyIupQAYp5iNQwFrlLCLTMR+ap8n9PSosLWvfp9TCeCv/rIOfhjk SSvwGatwTpcvNEYU3XaxVMPRcQ/tKQLBrqn7VGv9T5dWqC07VKFqB0YaAmPQW5DrY0zy Za6bUNGvBAAuMjDsmkCXZggduzO/+GSJqr+TyTYLLI5po5kW9fz7dj8xDinhMsYQA4f4 gBKWxC/T1qlM/TiCTR8WBtlfPdLd1G8KM6FXF6wqMsOxDIZ3O7A8jv87Iw8Mw3XAGzo8 g7rw== X-Gm-Message-State: AOAM531iTWqurRTc0IfpKXV61JP9UJbdT1hXNLWxyOrgeAWVM/KCq+CU 5+OfB9F+BW1H4RE7pMpS1Cg3DZwmYYUa/PDH X-Google-Smtp-Source: ABdhPJzjE4F5YlDo9VkfroSgEXumyc5+9wPltlUAM1k1EEn2FDmR+A5Gu8mTDmCCERRgBRQ+C5t9IQ== X-Received: by 2002:a63:4c6:0:b0:385:f757:1e65 with SMTP id 189-20020a6304c6000000b00385f7571e65mr17993384pge.453.1648875837535; Fri, 01 Apr 2022 22:03:57 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id y30-20020a056a001c9e00b004fa9246adcbsm4376917pfw.144.2022.04.01.22.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 22:03:57 -0700 (PDT) Subject: [PATCH v1 5/6] RISC-V: Add the Zicsr extension Date: Fri, 1 Apr 2022 22:00:40 -0700 Message-Id: <20220402050041.21302-6-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402050041.21302-1-palmer@rivosinc.com> References: <20220402050041.21302-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: Palmer Dabbelt From: Palmer Dabbelt To: linux-sparse@vger.kernel.org, Kito Cheng , linux-riscv@lists.infradead.org, mkl@pengutronix.de, aurelien@aurel32.net, Linus Torvalds X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220401_220359_060364_B68FFFC5 X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Recent versions of binutils default to an ISA spec version that doesn't include Zicsr as part of I, so Linux has recently started passing this in -march. Signed-off-by: Palmer Dabbelt --- target-riscv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target-riscv.c b/target-riscv.c index 5076bbaf..afd6fafa 100644 --- a/target-riscv.c +++ b/target-riscv.c @@ -17,6 +17,7 @@ #define RISCV_EMBD (1 << 9) #define RISCV_FPU (RISCV_FLOAT|RISCV_DOUBLE|RISCV_FDIV) #define RISCV_GENERIC (RISCV_MUL|RISCV_DIV|RISCV_ATOMIC|RISCV_FPU) +#define RISCV_ZICSR (1 << 10) static unsigned int riscv_flags; @@ -34,9 +35,10 @@ static void parse_march_riscv(const char *arg) }, extensions[] = { { "m", RISCV_MUL|RISCV_DIV }, { "a", RISCV_ATOMIC }, - { "f", RISCV_FLOAT|RISCV_FDIV }, - { "d", RISCV_DOUBLE|RISCV_FDIV }, + { "f", RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR }, + { "d", RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR }, { "c", RISCV_COMP }, + { "_zicsr", RISCV_ZICSR }, }; int i; @@ -128,6 +130,8 @@ static void predefine_riscv(const struct target *self) predefine("__riscv_mul", 1, "1"); if ((riscv_flags & RISCV_MUL) && (riscv_flags & RISCV_DIV)) predefine("__riscv_muldiv", 1, "1"); + if (riscv_flags & RISCV_ZICSR) + predefine("__riscv_zicsr", 1, "1"); if (cmodel) predefine_strong("__riscv_cmodel_%s", cmodel); From patchwork Sat Apr 2 05:00:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12798951 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3F2D4C433F5 for ; Sat, 2 Apr 2022 05:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Cc:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TnQ1oId4aZ7e3ruJVT9YOnM7Tf1HIbA3K3QqaX/5GUA=; b=qt70gKpqtlE0vs 0GHYWr6Kyef0kRxdY1EONdm1LloAD2lJlHdpn2mQynfgXvWPA9x3I0gMq+MPIlXp4bR89kZpIMFSG Fs4HU7RMtixOSSoILrszJcAooJt5wUbeakFGnvV4GPbl/+aE793ODvLk/yOhTbFxPrbSU5U7njF1H 1ACIX3LD7ot2XeQtaiHkN7caGfNZ6fb0rUpf+iTC+wkTAa0ge1FLEZetWsJCmV6+o1/YkH1w3z2zk FxY9qoGUqFEWxg2qbHD6aiGkv87DfOAMPdesgBc9sjf3Y9iwWmgyV3Jun9HbEMXTlnkxrI0Yvknvl HfVQBWryXLxZtsQDQp+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVvn-007zit-Cv; Sat, 02 Apr 2022 05:04:11 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1naVvb-007zdx-If for linux-riscv@lists.infradead.org; Sat, 02 Apr 2022 05:04:01 +0000 Received: by mail-pj1-x1030.google.com with SMTP id nt14-20020a17090b248e00b001ca601046a4so367605pjb.0 for ; Fri, 01 Apr 2022 22:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=/fso4SvqY0T0Qc0lJoOtYLQfWSaSLReduQ9sUe6VaJs=; b=uGosKXDu+hscZuRzge/vediHFAPVq1SdtFOr9eZrABDXdNBO3pgfgBZx3uaSYpNzRp wz/ApkQxH/EQ3IcY8ZFNK7Yl86tb8BPAeLnIkdrpUPE6MhuadxjIX2zpFo649gdl0Vo+ jKsMsnJGU1g9eQz8donGaVhSVWFuVDE4wmf6nSnoAmdqEugZjfK1wl0Asf5wUQoHSwRn xaXNEx+ALURQymZzxaGvkpArTOs/7xFXrZ2LVyyukJmNZZUIP85mHp1aws9F+GDbcPEh nwIuw6dCr4BMYt2EAyITAOsrkWIzDsHVR8kvbGsXbqU1cmjjNVy3ll+C5CMH51m8YxW6 bvFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=/fso4SvqY0T0Qc0lJoOtYLQfWSaSLReduQ9sUe6VaJs=; b=1gzm+hVQ39c0wofhndBEG9lgTabd30dEWdJyltoI9nl21rNBCvCHHgj+4893XfDjIp iEtsB7YfW5yWfrlTEct2FlvBllw65Hu2l7D1LaTekUtokdVz7mr4TgqlHQ5OqCg9kM65 5xAft0PreG3AF3x9mbWMJnl7h8VtXAF2IzPnmM2wumyx7SdlZ83d9sr84Rc15qaG3ijJ ZoNFxEIuCxXa5RICFyjs1EtzKVqgOKWjV9mlu200Er9B4RAR6TKBhSNt9HwK3f6CMO5g 3gwGkGROUxzlMzhOuGTU9q0kPGs5uad02EevXpynnfbKxKy3altLrdmw15w+dNCzXXky G6PA== X-Gm-Message-State: AOAM533ys69PX7XofkWr76YMi7SgAeYPHTTq8F0ogUH9YxmiGoDMS/JS 1oDIn5WXeD1EXdnqcUTc5kukwg== X-Google-Smtp-Source: ABdhPJymdt4noevXnrvhSXtRg7cNfDareVVHTnYVduYX1299M3qBHo5UqJ8QZ4RN5IjJvLAivXOqWQ== X-Received: by 2002:a17:90b:352:b0:1c6:77e:a4f7 with SMTP id fh18-20020a17090b035200b001c6077ea4f7mr15403578pjb.77.1648875838401; Fri, 01 Apr 2022 22:03:58 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id j8-20020a17090a060800b001c7936791d1sm3959110pjj.7.2022.04.01.22.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 22:03:58 -0700 (PDT) Subject: [PATCH v1 6/6] RISC-V: Add the Zifencei extension Date: Fri, 1 Apr 2022 22:00:41 -0700 Message-Id: <20220402050041.21302-7-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402050041.21302-1-palmer@rivosinc.com> References: <20220402050041.21302-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: Palmer Dabbelt From: Palmer Dabbelt To: linux-sparse@vger.kernel.org, Kito Cheng , linux-riscv@lists.infradead.org, mkl@pengutronix.de, aurelien@aurel32.net, Linus Torvalds X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220401_220359_652898_45723354 X-CRM114-Status: GOOD ( 10.62 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Recent versions of binutils default to an ISA spec version that doesn't include Zifencei as part of I, so Linux has recently started passing this in -march. Signed-off-by: Palmer Dabbelt --- target-riscv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-riscv.c b/target-riscv.c index afd6fafa..ff4dfba3 100644 --- a/target-riscv.c +++ b/target-riscv.c @@ -18,6 +18,7 @@ #define RISCV_FPU (RISCV_FLOAT|RISCV_DOUBLE|RISCV_FDIV) #define RISCV_GENERIC (RISCV_MUL|RISCV_DIV|RISCV_ATOMIC|RISCV_FPU) #define RISCV_ZICSR (1 << 10) +#define RISCV_ZIFENCEI (1 << 11) static unsigned int riscv_flags; @@ -39,6 +40,7 @@ static void parse_march_riscv(const char *arg) { "d", RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR }, { "c", RISCV_COMP }, { "_zicsr", RISCV_ZICSR }, + { "_zifencei", RISCV_ZIFENCEI }, }; int i; @@ -132,6 +134,8 @@ static void predefine_riscv(const struct target *self) predefine("__riscv_muldiv", 1, "1"); if (riscv_flags & RISCV_ZICSR) predefine("__riscv_zicsr", 1, "1"); + if (riscv_flags & RISCV_ZIFENCEI) + predefine("__riscv_zifencei", 1, "1"); if (cmodel) predefine_strong("__riscv_cmodel_%s", cmodel);