From: "Yicong Yang" <yang.yicong@picoheart.com>
To: <pjw@kernel.org>, <palmer@dabbelt.com>, <aou@eecs.berkeley.edu>,
<linux-riscv@lists.infradead.org>
Cc: <wangruikang@iscas.ac.cn>, <ganboing@gmail.com>, <alex@ghiti.fr>,
<andrew.jones@oss.qualcomm.com>, <cleger@meta.com>,
<geshijian@picoheart.com>, <niehaitao@picoheart.com>,
<cuiyunhui@bytedance.com>, <yang.yicong@picoheart.com>
Subject: [PATCH v3 2/5] riscv: insn: Support decoding of CBO instructions
Date: Mon, 7 Sep 2026 15:21:46 +0800 [thread overview]
Message-ID: <20260907072149.72031-3-yang.yicong@picoheart.com> (raw)
In-Reply-To: <20260907072149.72031-1-yang.yicong@picoheart.com>
Add definitions for decoding CBO instructions. Rename
RVG_OPCODE_FENCE to RVG_OPCODE_MISC_MEM as spec defines
it as MISC-MEM and it's also used by CBO instructions.
Signed-off-by: Yicong Yang <yang.yicong@picoheart.com>
---
arch/riscv/include/asm/insn.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/include/asm/insn.h b/arch/riscv/include/asm/insn.h
index c36d1dfa16c6..f6b32d8d558d 100644
--- a/arch/riscv/include/asm/insn.h
+++ b/arch/riscv/include/asm/insn.h
@@ -12,6 +12,7 @@
#define RV_INSN_FUNCT3_OPOFF 12
#define RV_INSN_OPCODE_MASK GENMASK(6, 0)
#define RV_INSN_OPCODE_OPOFF 0
+#define RV_INSN_FUNCT12_MASK GENMASK(31, 20)
#define RV_INSN_FUNCT12_OPOFF 20
#define RV_ENCODE_FUNCT3(f_) (RVG_FUNCT3_##f_ << RV_INSN_FUNCT3_OPOFF)
@@ -135,7 +136,7 @@
#define RVC_C2_RS1_MASK GENMASK(4, 0)
/* parts of opcode for RVG*/
-#define RVG_OPCODE_FENCE 0x0f
+#define RVG_OPCODE_MISC_MEM 0x0f
#define RVG_OPCODE_AUIPC 0x17
#define RVG_OPCODE_BRANCH 0x63
#define RVG_OPCODE_JALR 0x67
@@ -171,6 +172,7 @@
#define RVG_FUNCT3_JALR 0x0
#define RVG_FUNCT3_BEQ 0x0
#define RVG_FUNCT3_BNE 0x1
+#define RVG_FUNCT3_CBO 0x2
#define RVG_FUNCT3_BLT 0x4
#define RVG_FUNCT3_BGE 0x5
#define RVG_FUNCT3_BLTU 0x6
@@ -186,12 +188,14 @@
#define RVC_FUNCT4_C_EBREAK 0x9
#define RVG_FUNCT12_EBREAK 0x1
+#define RVG_FUNCT12_CBO_CLEAN 0x1
+#define RVG_FUNCT12_CBO_FLUSH 0x2
#define RVG_FUNCT12_SRET 0x102
#define RVG_MATCH_AUIPC (RVG_OPCODE_AUIPC)
#define RVG_MATCH_JALR (RV_ENCODE_FUNCT3(JALR) | RVG_OPCODE_JALR)
#define RVG_MATCH_JAL (RVG_OPCODE_JAL)
-#define RVG_MATCH_FENCE (RVG_OPCODE_FENCE)
+#define RVG_MATCH_FENCE (RVG_OPCODE_MISC_MEM)
#define RVG_MATCH_BEQ (RV_ENCODE_FUNCT3(BEQ) | RVG_OPCODE_BRANCH)
#define RVG_MATCH_BNE (RV_ENCODE_FUNCT3(BNE) | RVG_OPCODE_BRANCH)
#define RVG_MATCH_BLT (RV_ENCODE_FUNCT3(BLT) | RVG_OPCODE_BRANCH)
--
2.50.1 (Apple Git-155)
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-09-07 7:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 7:21 [PATCH v3 0/5] Add workarounds for Picoheart erratas Yicong Yang
2026-09-07 7:21 ` [PATCH v3 1/5] riscv: Make get_insn public for instruction fault handling Yicong Yang
2026-09-07 7:21 ` Yicong Yang [this message]
2026-09-07 7:21 ` [PATCH v3 3/5] riscv: errata: Add init framework for picoheart errata Yicong Yang
2026-09-07 7:21 ` [PATCH v3 4/5] riscv: errata: picoheart: Add workaround for cbo.clean errata Yicong Yang
2026-09-07 7:21 ` [PATCH v3 5/5] riscv: errata: picoheart: Add workaround for AMOCASQ errata Yicong Yang
2026-09-07 15:44 ` Conor Dooley
2026-09-08 11:41 ` Yicong Yang
2026-09-08 13:27 ` Conor Dooley
2026-09-08 14:28 ` Yicong Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260907072149.72031-3-yang.yicong@picoheart.com \
--to=yang.yicong@picoheart.com \
--cc=alex@ghiti.fr \
--cc=andrew.jones@oss.qualcomm.com \
--cc=aou@eecs.berkeley.edu \
--cc=cleger@meta.com \
--cc=cuiyunhui@bytedance.com \
--cc=ganboing@gmail.com \
--cc=geshijian@picoheart.com \
--cc=linux-riscv@lists.infradead.org \
--cc=niehaitao@picoheart.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=wangruikang@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.