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: 12798939 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 2A978C433F5 for ; Sat, 2 Apr 2022 05:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237837AbiDBFFq (ORCPT ); Sat, 2 Apr 2022 01:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231346AbiDBFFp (ORCPT ); Sat, 2 Apr 2022 01:05:45 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 051AB1400B for ; Fri, 1 Apr 2022 22:03:54 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id i10-20020a17090a2aca00b001ca56c9ab16so553014pjg.1 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=f2BHFjFQmSzVmEA13qflJXq9UaTIf23+A/Mk52BnHI5xIlu631EK68a9QdSSOSORTV Hcs3Ea5saaYEF6FPASerHFAp/9GJCZBt7ItwqHD3ta29ZaBBVCtyrspwbInkeMzn9AlI vLOT8QNER6HFb65lSKebECjbJrUnD/031X8HpjdwhCZawfcrI1qdZTd6FL4t3izM1g1R tGAYmtvI83jjHkBGYmRh181btVGah6EPUt+f9a4QUmL1gHYfqauG4aNuWm/vdxzyccQk 6va3KV19f7cfIfwtTPhJbwDbKUNHtcEvXCVRctU5mWWQ6y/iJNxYgMjspEJw2LXtfOcE LpzQ== X-Gm-Message-State: AOAM5326XWtLLZ65QwvHRmdnf3X7nsR6s5Hb+EiMk37lSrOqvukEkR4Y KpTr7sRjQReSatjEw631YQSvQA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.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: 12798940 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 66F9EC433F5 for ; Sat, 2 Apr 2022 05:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343741AbiDBFFt (ORCPT ); Sat, 2 Apr 2022 01:05:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243565AbiDBFFq (ORCPT ); Sat, 2 Apr 2022 01:05:46 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B3571401D for ; Fri, 1 Apr 2022 22:03:55 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id n18-20020a17090ade9200b001ca699ee462so116690pjv.3 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=Gi2sHQ4F0T8H4l7V/ZHhJS8wHxdwrBD/WPxSWAUnv5Zkr3EUUs6ZeJ7pvdrxT6gxIG ttLysSo+rw70318/iS/UbJPEo4dK8QMn/FLI64HoF/1/oIQapg/Rv/fgSYu4cf8CEo7j nU9MWIJXIoCm9xiXtjr7ELJbf1NRKmod9fBcWPkQTc/uIFPdyskHB3EcmEgn1ROOw6v9 L1+vlv9i/SZCudfONs/5yt3kc603F4r+YkC0JCqw4HAD0PLhRLDSA0maebLBCom5SWUC /2rE61qMmFR+x4O1VyZ6yG4i0d6QxxjICGTayaSBfSo6dJQ7m4zqeKMejGGpnKzqE/RM menQ== X-Gm-Message-State: AOAM531ROPhg8rht/PbhRvg/rdTZJioRCasO1MLNdlsbM7rdMhUKffhY CddVF68xw2vbdxkVW3KAysJOL/XZXRZ130CX 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 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.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: 12798941 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 E5835C433EF for ; Sat, 2 Apr 2022 05:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243565AbiDBFFu (ORCPT ); Sat, 2 Apr 2022 01:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231346AbiDBFFr (ORCPT ); Sat, 2 Apr 2022 01:05:47 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C6561400B for ; Fri, 1 Apr 2022 22:03:56 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id i11so4077294plg.12 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=BtAb4pltpAQyPYdYBO0uxxX1f8djaIgdyjf8N8gtLODbkapJzYvO+7bTt9/VU7AvSq aOVrL475Qleg3MFia8pKEhj+a9rbBCH9Xr+XPTt6/8gHjPBgX+JSNUPBWiEEm7EGZPzd hBLAhRHKxBeQtv0wkvleD1GgW1bDn+T0Epp6ia5EEGoep1O4ED0sCHoCk4wJU1bNByW+ z/HVvpqoaepRlGMgTBvLMw7jf3htftLFSOVcPEwpDIr7dV2i/ymoGGWDB234EtPAxkvP lVhe8JeIIl9UNJHzbByuE3yR9eQWYS5xoguzskj1xUfZA/wJEWM0WJgVLpx0Vsx0sTi8 eHgQ== X-Gm-Message-State: AOAM533+ExzXPdBJy4TA20+uW3FovUHnTPsdTdc6ElUb7wDmJ7Sysk0y RiGbjp5jb15fwmbHW3/pnYL9dg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.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: 12798942 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 EE40BC433FE for ; Sat, 2 Apr 2022 05:04:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245246AbiDBFF7 (ORCPT ); Sat, 2 Apr 2022 01:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245704AbiDBFFr (ORCPT ); Sat, 2 Apr 2022 01:05:47 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2712C47569 for ; Fri, 1 Apr 2022 22:03:57 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id i11so4077311plg.12 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=nget31aAy5BOpL7P6MqL3eZ/JS0KpmztiOD1SUgpfOVD+qQClnLJTW/J3QgKTWQbWi vdrEtXjbbu3yS9NdJQDTqFobKSuzCGQ4fTRIw9uZHKQkL9GkT9S1URWDosyTwAalTGQc 2rf0n7fYTeReqkWrhnEAtXf+hdg6V2dKBztiJHn0m7VBhyOeWPx9q6fIWIThmqS7wPRa wEYJ/W/XQmlvkUe7xU7wXbA0Yb6pDll/tsNuCSQHv0OJu06snuf7B95xSjwK6UOYTY2D 6/pPS0jULSfDc3jNGCYziLpQVMkS+DmNrb+rY6Mh/mB/Z0Dj18/g/Az4sXnYzPsTRzpy 1+Og== X-Gm-Message-State: AOAM533yPE58mxJo4Si2JvHhAxVByWB+70Pkf0W4fths9lnYknJucgpF q2OIZXPVI0PGuLGCZzmHJs/Cjg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.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: 12798943 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 6329FC433F5 for ; Sat, 2 Apr 2022 05:04:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231346AbiDBFGB (ORCPT ); Sat, 2 Apr 2022 01:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343814AbiDBFFt (ORCPT ); Sat, 2 Apr 2022 01:05:49 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E69717FD09 for ; Fri, 1 Apr 2022 22:03:59 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id b130so3845684pga.13 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=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=jL7w9NAL7VIJGEtGvjHyuFLOnnBkf6P88UnYMkftRtk/9Rp/604ZtxNXVafUGVPC8I 2D+QUa2pxoR7V4vZilf2SSKhKeILsAvhCqrmGrT42dsUx9YKO68YcikFsIiAzdV3tlBS 4WKSBN/mxl+aEZUrYDQSOhKBm7oPcoPxgUKH76eSgO0nTh+vRKT0zq/901myhiTaem73 LKhdU6A3zCibUnAf6HrRdwHC/ikwi3ciz3eLMSso+ztcn+5kby5/Piril01sMRtfBRed hN5DujqGBVwkhX6rTQE29ILyiOX8/dt+jKLt5zIWc19QSxj6mPg7G+QykiWuIiVHXB71 XdRw== X-Gm-Message-State: AOAM5314ty2BeMiNIEigYETC1tVXYDMZuOCPQDfEt7+WHVUNJwY63Ygc MtqQxZSa7tYGopfMhDpL2quJlQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.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: 12798944 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 B0D6CC433EF for ; Sat, 2 Apr 2022 05:04:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245704AbiDBFGE (ORCPT ); Sat, 2 Apr 2022 01:06:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345658AbiDBFFt (ORCPT ); Sat, 2 Apr 2022 01:05:49 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E771B17E340 for ; Fri, 1 Apr 2022 22:03:58 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id h23-20020a17090a051700b001c9c1dd3acbso4274373pjh.3 for ; Fri, 01 Apr 2022 22:03:58 -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=cZQ2GGJX7FOu9bqsEXGSESSeHphzn8hKjAotO6m5kU0WfNqjSAPGcEmOCxi4YDR6gw OAzW+erxXghTkJbKz3hxmqmgb/bMz/gdgMy6lRBojLB+/PtmsKj5YWzoTvo1AzLdgX1I iqwG5AKbhqpIFf+zsNR9HLdHAAucZYu5E/4ZBZMJtEootn2t/noPnsEyObXW7KztVmQL HadkwrpCz2jNkHgC3iaKfJFlAMvHR/fMD3/TxHo1FqIZlve3NbeUySXdfIlRlpETD/qX vPPer2kXVSgSZzDvBW3wxO2nn2HW6TYQjXYS7Yt3k5/VE/X371pVoasCgpNZE7FXDFGl nrkw== X-Gm-Message-State: AOAM5316i3Z92IQJhNZckkFOiNzViKTK+R+c0rD+1GXm2DGtN7wRqovs aQrM0Ns9ce7w5ZFkDNOGFLqLwCPTLPpxTA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.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);