From patchwork Mon Aug 21 07:27:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 13693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp2837504vqi; Mon, 21 Aug 2023 00:27:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiq+Rurg+ZkE5JdexQ87UiYPOgQmxgUmlZeklZ+yP+r5qGCPollDX/Z+ZM/Xwn62Inf+2Q X-Received: by 2002:a17:906:51c9:b0:9a1:6ae3:90c0 with SMTP id v9-20020a17090651c900b009a16ae390c0mr4603701ejk.42.1692602857990; Mon, 21 Aug 2023 00:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692602857; cv=none; d=google.com; s=arc-20160816; b=OrFRz4kua8tKk40nidS8h6pEvPrV7go8zeUoYr9GDYf8DF23GOXWhH0DTduhFsCSL0 UBmMn3N+qLo4NrNNaTnVJ0BwWtjGNLPx/H985jbVC9n0YOta1tRkXXXRcsp/XT1+cEIl /IXTUiYPVE8XMdAuNNJrsKo1XH8/pNqGB2OU+resEbTdsvxpGMhdOtjkAaqONhBEcbxc 2oVqD4QPyVYhLP8GA8HL86Y8Pdmos0y5KhSulppPvsl06DQLJqojJyVU1FGbk9rEV0yl mCXk8cPWXOgiHvGi7MD8ul1pA9IWkhiybQ37eEcDiimrCq08dXhj41niwIQFlGm5SNN8 zYUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=DI1TOb7/pKotTpu4FhJQGYogsJsFgJ4Y/4w2Q7dnL0A=; fh=oLBbkpKGrMjsAiDUocfN7mW0LEnMJsqDdFE8uCs7/vo=; b=uLsYvN0nN/SQ3zJGdbHLk/khQdLpcTn0Caq0fEqKHgEwgHNqx07nyXqlQWP8OzE5xZ y18Nv+3bqxPT+eJVWJb4hjbjBoSuMOCc2xM3iLUDZxAQPYlwQ8Dc7K9v3MjHWugY0whM wMG1nqHJVA3cqU9FvrmUSj1gd51l5bMS2rm5dPkEf3iLX6iBtLerYsNuDU2A3xjiK4B1 97dMFtMH0MpXdCrklV0xm8PzGNBjjYNn+Se+cQPWdqTB5X+mFRERaQmmaMgKKgl6/eaj CniFS9X4cb1nMtuVx/4gP+EH+LZ9k2GK9bs8kJssLiO/wJ0X7iS4qizpLCYnuQbb5XMC ajXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=UGHiB6aA; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id gu25-20020a170906f29900b0099cc36c6bdcsi5433464ejb.151.2023.08.21.00.27.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 00:27:37 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=UGHiB6aA; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 34074385C301 for ; Mon, 21 Aug 2023 07:27:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34074385C301 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1692602856; bh=DI1TOb7/pKotTpu4FhJQGYogsJsFgJ4Y/4w2Q7dnL0A=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=UGHiB6aAS8AFA7nxEvgtrb3yJFCbwfypAxjr+D3Mt8u6Gne81LKbsWatmicV7xL1u m/cM96NL6OdAdWunVI0KkUQnO3LvhVhMxEy9pF7mO31CI4w0mG7SRiWo9b3NDLc/10 di6eqn6mxhvHJHyKPf5kXw3OcU6pKMFa6u9V0Urk= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 35DF73856967 for ; Mon, 21 Aug 2023 07:27:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 35DF73856967 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id B753D300089; Mon, 21 Aug 2023 07:27:22 +0000 (UTC) To: Tsukasa OI , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Nelson Chu , Kito Cheng Cc: binutils@sourceware.org Subject: [PATCH 0/2] RISC-V: Add support for indirect CSR access extensions Date: Mon, 21 Aug 2023 07:27:04 +0000 Message-ID: In-Reply-To: References: Mime-Version: 1.0 X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KAM_MANYTO, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tsukasa OI via Binutils From: Tsukasa OI Reply-To: Tsukasa OI Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774822734074650369 X-GMAIL-MSGID: 1774822734074650369 Hello, REVIEW ONLY v1: Because the specification got stable and is approved, I once again submit this patch set (pretty much *unchanged* from the previous one except the commit message and the version number per the latest specification status). This patch set implements two extensions ('Smcsrind' and 'Sscsrind') in the Indirect CSR Access Architecture Extension specification: Note that RISC-V AIA and this Indirect CSR Access specifications don't have any strict superset or subset relations. Instead, Indirect CSR Access is based on a subset of RISC-V AIA but with some extensions and intentionally designed *not* to have dependencies to AIA. To implement those extensions (PATCH 2), new CSR handling mechanism will be required because those CSRs are shared with RISC-V AIA ('Smaia' / 'Ssaia'). 1. miselect 2. mireg 3. siselect 4. sireg 5. vsiselect 6. vsireg Complex CSR handling preparation as in PATCH 1 enables separating the "extension" variable (shared for error message) and actual checking. It enables checking like (A && B) and (A || B). In the PATCH 2, the author used this mechanism to check (Smaia || Smcsrind) and (Ssaia || Sscsrind). This approach should work until a kind of combinatorial explosion happens. Thanks, Tsukasa Tsukasa OI (2): RISC-V: Add complex CSR error handling RISC-V: Add indirect CSR Access Extensions and its CSRs bfd/elfxx-riscv.c | 4 + gas/config/tc-riscv.c | 38 ++++++- gas/testsuite/gas/riscv/csr-dw-regnums.d | 15 +++ gas/testsuite/gas/riscv/csr-dw-regnums.s | 17 ++++ gas/testsuite/gas/riscv/csr-version-1p10.d | 30 ++++++ gas/testsuite/gas/riscv/csr-version-1p10.l | 104 +++++++++++++++++--- gas/testsuite/gas/riscv/csr-version-1p11.d | 30 ++++++ gas/testsuite/gas/riscv/csr-version-1p11.l | 104 +++++++++++++++++--- gas/testsuite/gas/riscv/csr-version-1p12.d | 30 ++++++ gas/testsuite/gas/riscv/csr-version-1p12.l | 104 +++++++++++++++++--- gas/testsuite/gas/riscv/csr-version-1p9p1.d | 30 ++++++ gas/testsuite/gas/riscv/csr-version-1p9p1.l | 104 +++++++++++++++++--- gas/testsuite/gas/riscv/csr.s | 19 ++++ include/opcode/riscv-opc.h | 46 +++++++-- 14 files changed, 619 insertions(+), 56 deletions(-) base-commit: 29c0e7512493aa6cdd713024909c352964fe1b1a