Skip to contentSkip to conversation

riscv: kprobes: Clean up instruction simulation

PATCH Applied Nam Cao 3 participants 15 messages May 14, 2025 – Jul 8, 2025 RISC-V

lore
Share & tools
lore

Nam Cao

author
#0 lore raw

v2 cover riscv: kprobes: Clean up instruction simulation

Hi,

There is some instruction-processing code in kprobes simulate code. These code should be insn.h. In fact, most of them is duplicating insn.h.

This series remove the duplicated bits and make use of macros already defined in insn.h. The non-duplicated bits are moved into insn.h.

v2:
rebase on top of Alex's patches [1]. This means replacing RV_X with RV_X_mask for the first 2 patches. The rest is the same.

[1] https://lore.kernel.org/linux-riscv/[email protected]/

Nam Cao (11):
riscv: kprobes: Move branch_rs2_idx to insn.h
riscv: kprobes: Move branch_funct3 to insn.h
riscv: kprobes: Remove duplication of RV_EXTRACT_JTYPE_IMM
riscv: kprobes: Remove duplication of RV_EXTRACT_RS1_REG
riscv: kprobes: Remove duplication of RV_EXTRACT_BTYPE_IMM
riscv: kproves: Remove duplication of RVC_EXTRACT_JTYPE_IMM
riscv: kprobes: Remove duplication of RVC_EXTRACT_C2_RS1_REG
riscv: kprobes: Remove duplication of RVC_EXTRACT_BTYPE_IMM
riscv: kprobes: Remove duplication of RV_EXTRACT_RD_REG
riscv: kprobes: Remove duplication of RV_EXTRACT_UTYPE_IMM
riscv: kprobes: Remove duplication of RV_EXTRACT_ITYPE_IMM

 arch/riscv/include/asm/insn.h            |  9 +++
 arch/riscv/kernel/probes/simulate-insn.c | 94 +++++-------------------
 2 files changed, 28 insertions(+), 75 deletions(-)
Signature · 1 line
2.39.5
author
#1 lore raw

PATCH v2 1/11 riscv: kprobes: Move branch_rs2_idx to insn.h

Similar to other instruction-processing macros/functions, branch_rs2_idx should be in insn.h.

Move it into insn.h as RV_EXTRACT_RS2_REG. This new name matches the style in insn.h.

---
 arch/riscv/include/asm/insn.h            | 5 +++++
 arch/riscv/kernel/probes/simulate-insn.c | 5 +----
 2 files changed, 6 insertions(+), 4 deletions(-)
arch/riscv/include/asm/insn.h +5 -0
index 7c65fc8baeed..4a26cef3b5c0 100644
@@ -64,6 +64,7 @@
 #define RVG_RS2_OPOFF		20
 #define RVG_RD_OPOFF		7
 #define RVG_RS1_MASK		GENMASK(4, 0)
+#define RVG_RS2_MASK		GENMASK(4, 0)
 #define RVG_RD_MASK		GENMASK(4, 0)
 
 /* The bit field of immediate value in RVC J instruction */
@@ -450,6 +451,10 @@ static __always_inline bool riscv_insn_is_c_jalr(u32 code)
 	({typeof(x) x_ = (x); \
 	(RV_X_mask(x_, RVG_RS1_OPOFF, RVG_RS1_MASK)); })
 
+#define RV_EXTRACT_RS2_REG(x) \
+	({typeof(x) x_ = (x); \
+	(RV_X_mask(x_, RVG_RS2_OPOFF, RVG_RS2_MASK)); })
+
 #define RV_EXTRACT_RD_REG(x) \
 	({typeof(x) x_ = (x); \
 	(RV_X_mask(x_, RVG_RD_OPOFF, RVG_RD_MASK)); })
arch/riscv/kernel/probes/simulate-insn.c +1 -4
index 6c166029079c..77be381bb8b4 100644
@@ -121,9 +121,6 @@ bool __kprobes simulate_auipc(u32 opcode, unsigned long addr, struct pt_regs *re
 #define branch_rs1_idx(opcode) \
 	(((opcode) >> 15) & 0x1f)
 
-#define branch_rs2_idx(opcode) \
-	(((opcode) >> 20) & 0x1f)
-
 #define branch_funct3(opcode) \
 	(((opcode) >> 12) & 0x7)
 
@@ -157,7 +154,7 @@ bool __kprobes simulate_branch(u32 opcode, unsigned long addr, struct pt_regs *r
 	unsigned long rs2_val;
 
 	if (!rv_insn_reg_get_val(regs, branch_rs1_idx(opcode), &rs1_val) ||
-	    !rv_insn_reg_get_val(regs, branch_rs2_idx(opcode), &rs2_val))
+	    !rv_insn_reg_get_val(regs, RV_EXTRACT_RS2_REG(opcode), &rs2_val))
 		return false;
 
 	offset_tmp = branch_offset(opcode);
Signature · 1 line
2.39.5
author
#2 lore raw

PATCH v2 2/11 riscv: kprobes: Move branch_funct3 to insn.h

In reply to Nam Cao

Similar to other instruction-processing macros/functions, branch_funct3 should be in insn.h.

Move it into insn.h as RV_EXTRACT_FUNCT3. This new name matches the style in insn.h.

---
 arch/riscv/include/asm/insn.h            | 4 ++++
 arch/riscv/kernel/probes/simulate-insn.c | 5 +----
 2 files changed, 5 insertions(+), 4 deletions(-)
arch/riscv/include/asm/insn.h +4 -0
index 4a26cef3b5c0..ca9628c61885 100644
@@ -447,6 +447,10 @@ static __always_inline bool riscv_insn_is_c_jalr(u32 code)
 #define RVC_RS2(insn)		RV_X(insn, SH_RS2C, 5)
 #define RVC_X(X, s, mask)	RV_X_mask(X, s, mask)
 
+#define RV_EXTRACT_FUNCT3(x) \
+	({typeof(x) x_ = (x); \
+	(RV_X_mask(x_, RV_INSN_FUNCT3_OPOFF, RV_INSN_FUNCT3_MASK >> RV_INSN_FUNCT3_OPOFF)); })
+
 #define RV_EXTRACT_RS1_REG(x) \
 	({typeof(x) x_ = (x); \
 	(RV_X_mask(x_, RVG_RS1_OPOFF, RVG_RS1_MASK)); })
arch/riscv/kernel/probes/simulate-insn.c +1 -4
index 77be381bb8b4..d5f74fadbc3a 100644
@@ -121,9 +121,6 @@ bool __kprobes simulate_auipc(u32 opcode, unsigned long addr, struct pt_regs *re
 #define branch_rs1_idx(opcode) \
 	(((opcode) >> 15) & 0x1f)
 
-#define branch_funct3(opcode) \
-	(((opcode) >> 12) & 0x7)
-
 #define branch_imm(opcode) \
 	(((((opcode) >>  8) & 0xf ) <<  1) | \
 	 ((((opcode) >> 25) & 0x3f) <<  5) | \
@@ -158,7 +155,7 @@ bool __kprobes simulate_branch(u32 opcode, unsigned long addr, struct pt_regs *r
 		return false;
 
 	offset_tmp = branch_offset(opcode);
-	switch (branch_funct3(opcode)) {
+	switch (RV_EXTRACT_FUNCT3(opcode)) {
 	case RVG_FUNCT3_BEQ:
 		offset = (rs1_val == rs2_val) ? offset_tmp : 4;
 		break;
Signature · 1 line
2.39.5
author
#3 lore raw

PATCH v2 3/11 riscv: kprobes: Remove duplication of RV_EXTRACT_JTYPE_IMM

In reply to Nam Cao

Use RV_EXTRACT_JTYPE_IMM, instead of reimplementing it in simulate_jal().

---
 arch/riscv/kernel/probes/simulate-insn.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/riscv/kernel/probes/simulate-insn.c +3 -6
index d5f74fadbc3a..b76a691d0d9a 100644
@@ -41,19 +41,16 @@ bool __kprobes simulate_jal(u32 opcode, unsigned long addr, struct pt_regs *regs
 	 *     1         10          1           8       5    JAL/J
 	 */
 	bool ret;
-	u32 imm;
+	s32 imm;
 	u32 index = (opcode >> 7) & 0x1f;
 
 	ret = rv_insn_reg_set_val(regs, index, addr + 4);
 	if (!ret)
 		return ret;
 
-	imm  = ((opcode >> 21) & 0x3ff) << 1;
-	imm |= ((opcode >> 20) & 0x1)   << 11;
-	imm |= ((opcode >> 12) & 0xff)  << 12;
-	imm |= ((opcode >> 31) & 0x1)   << 20;
+	imm = RV_EXTRACT_JTYPE_IMM(opcode);
 
-	instruction_pointer_set(regs, addr + sign_extend32((imm), 20));
+	instruction_pointer_set(regs, addr + imm);
 
 	return ret;
 }
Signature · 1 line
2.39.5
author
#4 lore raw

PATCH v2 4/11 riscv: kprobes: Remove duplication of RV_EXTRACT_RS1_REG

In reply to Nam Cao

Use RV_EXTRACT_RS1_REG instead of reimplementing its code.

---
 arch/riscv/kernel/probes/simulate-insn.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
arch/riscv/kernel/probes/simulate-insn.c +2 -5
index b76a691d0d9a..625d514c4ada 100644
@@ -66,7 +66,7 @@ bool __kprobes simulate_jalr(u32 opcode, unsigned long addr, struct pt_regs *reg
 	unsigned long base_addr;
 	u32 imm = (opcode >> 20) & 0xfff;
 	u32 rd_index = (opcode >> 7) & 0x1f;
-	u32 rs1_index = (opcode >> 15) & 0x1f;
+	u32 rs1_index = RV_EXTRACT_RS1_REG(opcode);
 
 	ret = rv_insn_reg_get_val(regs, rs1_index, &base_addr);
 	if (!ret)
@@ -115,9 +115,6 @@ bool __kprobes simulate_auipc(u32 opcode, unsigned long addr, struct pt_regs *re
 	return true;
 }
 
-#define branch_rs1_idx(opcode) \
-	(((opcode) >> 15) & 0x1f)
-
 #define branch_imm(opcode) \
 	(((((opcode) >>  8) & 0xf ) <<  1) | \
 	 ((((opcode) >> 25) & 0x3f) <<  5) | \
@@ -147,7 +144,7 @@ bool __kprobes simulate_branch(u32 opcode, unsigned long addr, struct pt_regs *r
 	unsigned long rs1_val;
 	unsigned long rs2_val;
 
-	if (!rv_insn_reg_get_val(regs, branch_rs1_idx(opcode), &rs1_val) ||
+	if (!rv_insn_reg_get_val(regs, RV_EXTRACT_RS1_REG(opcode), &rs1_val) ||
 	    !rv_insn_reg_get_val(regs, RV_EXTRACT_RS2_REG(opcode), &rs2_val))
 		return false;
 
Signature · 1 line
2.39.5
author
#5 lore raw

PATCH v2 5/11 riscv: kprobes: Remove duplication of RV_EXTRACT_BTYPE_IMM

In reply to Nam Cao

Use RV_EXTRACT_BTYPE_IMM, instead of reimplementing it in simulate_branch().

---
 arch/riscv/kernel/probes/simulate-insn.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
arch/riscv/kernel/probes/simulate-insn.c +1 -10
index 625d514c4ada..3ba97e79a2a3 100644
@@ -115,15 +115,6 @@ bool __kprobes simulate_auipc(u32 opcode, unsigned long addr, struct pt_regs *re
 	return true;
 }
 
-#define branch_imm(opcode) \
-	(((((opcode) >>  8) & 0xf ) <<  1) | \
-	 ((((opcode) >> 25) & 0x3f) <<  5) | \
-	 ((((opcode) >>  7) & 0x1 ) << 11) | \
-	 ((((opcode) >> 31) & 0x1 ) << 12))
-
-#define branch_offset(opcode) \
-	sign_extend32((branch_imm(opcode)), 12)
-
 bool __kprobes simulate_branch(u32 opcode, unsigned long addr, struct pt_regs *regs)
 {
 	/*
@@ -148,7 +139,7 @@ bool __kprobes simulate_branch(u32 opcode, unsigned long addr, struct pt_regs *r
 	    !rv_insn_reg_get_val(regs, RV_EXTRACT_RS2_REG(opcode), &rs2_val))
 		return false;
 
-	offset_tmp = branch_offset(opcode);
+	offset_tmp = RV_EXTRACT_BTYPE_IMM(opcode);
 	switch (RV_EXTRACT_FUNCT3(opcode)) {
 	case RVG_FUNCT3_BEQ:
 		offset = (rs1_val == rs2_val) ? offset_tmp : 4;
Signature · 1 line
2.39.5
author
#6 lore raw

PATCH v2 6/11 riscv: kproves: Remove duplication of RVC_EXTRACT_JTYPE_IMM

In reply to Nam Cao

Use RVC_EXTRACT_JTYPE_IMM, instead of reimplementing it in simulate_c_j().

---
 arch/riscv/kernel/probes/simulate-insn.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
arch/riscv/kernel/probes/simulate-insn.c +2 -17
index 3ba97e79a2a3..5defbde4dd50 100644
@@ -170,24 +170,9 @@ bool __kprobes simulate_branch(u32 opcode, unsigned long addr, struct pt_regs *r
 
 bool __kprobes simulate_c_j(u32 opcode, unsigned long addr, struct pt_regs *regs)
 {
-	/*
-	 *  15    13 12                            2 1      0
-	 * | funct3 | offset[11|4|9:8|10|6|7|3:1|5] | opcode |
-	 *     3                   11                    2
-	 */
-
-	s32 offset;
-
-	offset  = ((opcode >> 3)  & 0x7) << 1;
-	offset |= ((opcode >> 11) & 0x1) << 4;
-	offset |= ((opcode >> 2)  & 0x1) << 5;
-	offset |= ((opcode >> 7)  & 0x1) << 6;
-	offset |= ((opcode >> 6)  & 0x1) << 7;
-	offset |= ((opcode >> 9)  & 0x3) << 8;
-	offset |= ((opcode >> 8)  & 0x1) << 10;
-	offset |= ((opcode >> 12) & 0x1) << 11;
+	s32 offset = RVC_EXTRACT_JTYPE_IMM(opcode);
 
-	instruction_pointer_set(regs, addr + sign_extend32(offset, 11));
+	instruction_pointer_set(regs, addr + offset);
 
 	return true;
 }
Signature · 1 line
2.39.5
author
#7 lore raw

PATCH v2 7/11 riscv: kprobes: Remove duplication of RVC_EXTRACT_C2_RS1_REG

In reply to Nam Cao

Use RVC_EXTRACT_C2_RS1_REG, instead of reimplementing it in simulate_c_jr_jalr().

---
 arch/riscv/kernel/probes/simulate-insn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/probes/simulate-insn.c +1 -1
index 5defbde4dd50..f5d64613dab5 100644
@@ -188,7 +188,7 @@ static bool __kprobes simulate_c_jr_jalr(u32 opcode, unsigned long addr, struct
 
 	unsigned long jump_addr;
 
-	u32 rs1 = (opcode >> 7) & 0x1f;
+	u32 rs1 = RVC_EXTRACT_C2_RS1_REG(opcode);
 
 	if (rs1 == 0) /* C.JR is only valid when rs1 != x0 */
 		return false;
Signature · 1 line
2.39.5
author
#8 lore raw

PATCH v2 8/11 riscv: kprobes: Remove duplication of RVC_EXTRACT_BTYPE_IMM

In reply to Nam Cao

Use RVC_EXTRACT_BTYPE_IMM, instead of reimplementing it in simulate_c_bnez_beqz().

---
 arch/riscv/kernel/probes/simulate-insn.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
arch/riscv/kernel/probes/simulate-insn.c +3 -9
index f5d64613dab5..e670e55954d2 100644
@@ -232,16 +232,10 @@ static bool __kprobes simulate_c_bnez_beqz(u32 opcode, unsigned long addr, struc
 	if (!rv_insn_reg_get_val(regs, rs1, &rs1_val))
 		return false;
 
-	if ((rs1_val != 0 && is_bnez) || (rs1_val == 0 && !is_bnez)) {
-		offset =  ((opcode >> 3)  & 0x3) << 1;
-		offset |= ((opcode >> 10) & 0x3) << 3;
-		offset |= ((opcode >> 2)  & 0x1) << 5;
-		offset |= ((opcode >> 5)  & 0x3) << 6;
-		offset |= ((opcode >> 12) & 0x1) << 8;
-		offset = sign_extend32(offset, 8);
-	} else {
+	if ((rs1_val != 0 && is_bnez) || (rs1_val == 0 && !is_bnez))
+		offset = RVC_EXTRACT_BTYPE_IMM(opcode);
+	else
 		offset = 2;
-	}
 
 	instruction_pointer_set(regs, addr + offset);
 
Signature · 1 line
2.39.5
author
#9 lore raw

PATCH v2 9/11 riscv: kprobes: Remove duplication of RV_EXTRACT_RD_REG

In reply to Nam Cao

Use RV_EXTRACT_RD_REG, instead of reimplementing its code.

---
 arch/riscv/kernel/probes/simulate-insn.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/riscv/kernel/probes/simulate-insn.c +3 -6
index e670e55954d2..1717df780409 100644
@@ -42,7 +42,7 @@ bool __kprobes simulate_jal(u32 opcode, unsigned long addr, struct pt_regs *regs
 	 */
 	bool ret;
 	s32 imm;
-	u32 index = (opcode >> 7) & 0x1f;
+	u32 index = RV_EXTRACT_RD_REG(opcode);
 
 	ret = rv_insn_reg_set_val(regs, index, addr + 4);
 	if (!ret)
@@ -65,7 +65,7 @@ bool __kprobes simulate_jalr(u32 opcode, unsigned long addr, struct pt_regs *reg
 	bool ret;
 	unsigned long base_addr;
 	u32 imm = (opcode >> 20) & 0xfff;
-	u32 rd_index = (opcode >> 7) & 0x1f;
+	u32 rd_index = RV_EXTRACT_RD_REG(opcode);
 	u32 rs1_index = RV_EXTRACT_RS1_REG(opcode);
 
 	ret = rv_insn_reg_get_val(regs, rs1_index, &base_addr);
@@ -81,9 +81,6 @@ bool __kprobes simulate_jalr(u32 opcode, unsigned long addr, struct pt_regs *reg
 	return ret;
 }
 
-#define auipc_rd_idx(opcode) \
-	((opcode >> 7) & 0x1f)
-
 #define auipc_imm(opcode) \
 	((((opcode) >> 12) & 0xfffff) << 12)
 
@@ -104,7 +101,7 @@ bool __kprobes simulate_auipc(u32 opcode, unsigned long addr, struct pt_regs *re
 	 *        20       5     7
 	 */
 
-	u32 rd_idx = auipc_rd_idx(opcode);
+	u32 rd_idx = RV_EXTRACT_RD_REG(opcode);
 	unsigned long rd_val = addr + auipc_offset(opcode);
 
 	if (!rv_insn_reg_set_val(regs, rd_idx, rd_val))
Signature · 1 line
2.39.5
author
#10 lore raw

PATCH v2 10/11 riscv: kprobes: Remove duplication of RV_EXTRACT_UTYPE_IMM

In reply to Nam Cao

Use RV_EXTRACT_UTYPE_IMM, instead of reimplementing it in simulate_auipc().

---
 arch/riscv/kernel/probes/simulate-insn.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
arch/riscv/kernel/probes/simulate-insn.c +1 -12
index 1717df780409..2b3cd69d6f8e 100644
@@ -81,17 +81,6 @@ bool __kprobes simulate_jalr(u32 opcode, unsigned long addr, struct pt_regs *reg
 	return ret;
 }
 
-#define auipc_imm(opcode) \
-	((((opcode) >> 12) & 0xfffff) << 12)
-
-#if __riscv_xlen == 64
-#define auipc_offset(opcode)	sign_extend64(auipc_imm(opcode), 31)
-#elif __riscv_xlen == 32
-#define auipc_offset(opcode)	auipc_imm(opcode)
-#else
-#error "Unexpected __riscv_xlen"
-#endif
-
 bool __kprobes simulate_auipc(u32 opcode, unsigned long addr, struct pt_regs *regs)
 {
 	/*
@@ -102,7 +91,7 @@ bool __kprobes simulate_auipc(u32 opcode, unsigned long addr, struct pt_regs *re
 	 */
 
 	u32 rd_idx = RV_EXTRACT_RD_REG(opcode);
-	unsigned long rd_val = addr + auipc_offset(opcode);
+	unsigned long rd_val = addr + (s32)RV_EXTRACT_UTYPE_IMM(opcode);
 
 	if (!rv_insn_reg_set_val(regs, rd_idx, rd_val))
 		return false;
Signature · 1 line
2.39.5
author
#11 lore raw

PATCH v2 11/11 riscv: kprobes: Remove duplication of RV_EXTRACT_ITYPE_IMM

In reply to Nam Cao

Use RV_EXTRACT_ITYPE_IMM, instead of re-implementing it in simulate_jalr().

---
 arch/riscv/kernel/probes/simulate-insn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/probes/simulate-insn.c +1 -1
index 2b3cd69d6f8e..fa581590c1f8 100644
@@ -64,7 +64,7 @@ bool __kprobes simulate_jalr(u32 opcode, unsigned long addr, struct pt_regs *reg
 	 */
 	bool ret;
 	unsigned long base_addr;
-	u32 imm = (opcode >> 20) & 0xfff;
+	u32 imm = RV_EXTRACT_ITYPE_IMM(opcode);
 	u32 rd_index = RV_EXTRACT_RD_REG(opcode);
 	u32 rs1_index = RV_EXTRACT_RS1_REG(opcode);
 
Signature · 1 line
2.39.5
#12 lore raw
In reply to Nam Cao
This series was applied to riscv/linux.git (for-next) by Alexandre Ghiti <[email protected]>:

Hello:

This series was applied to riscv/linux.git (for-next) by Alexandre Ghiti <[email protected]>:

Quoted 9 lines · On Wed, 14 May 2025 11:38:39 +0200 you wrote:

Hi,

There is some instruction-processing code in kprobes simulate code. These code should be insn.h. In fact, most of them is duplicating insn.h.

This series remove the duplicated bits and make use of macros already defined in insn.h. The non-duplicated bits are moved into insn.h.

[...]

Here is the summary with links:
- [v2,01/11] riscv: kprobes: Move branch_rs2_idx to insn.h

    https://git.kernel.org/riscv/c/d29656bab74c
  - [v2,02/11] riscv: kprobes: Move branch_funct3 to insn.h
    https://git.kernel.org/riscv/c/da6de46c2eed
  - [v2,03/11] riscv: kprobes: Remove duplication of RV_EXTRACT_JTYPE_IMM
    https://git.kernel.org/riscv/c/6d47d903b18f
  - [v2,04/11] riscv: kprobes: Remove duplication of RV_EXTRACT_RS1_REG
    https://git.kernel.org/riscv/c/5cefc323f32a
  - [v2,05/11] riscv: kprobes: Remove duplication of RV_EXTRACT_BTYPE_IMM
    https://git.kernel.org/riscv/c/a285674909ae
  - [v2,06/11] riscv: kproves: Remove duplication of RVC_EXTRACT_JTYPE_IMM
    https://git.kernel.org/riscv/c/c7196c136e29
  - [v2,07/11] riscv: kprobes: Remove duplication of RVC_EXTRACT_C2_RS1_REG
    https://git.kernel.org/riscv/c/768007ca3fe8
  - [v2,08/11] riscv: kprobes: Remove duplication of RVC_EXTRACT_BTYPE_IMM
    https://git.kernel.org/riscv/c/f2c715fff676
  - [v2,09/11] riscv: kprobes: Remove duplication of RV_EXTRACT_RD_REG
    https://git.kernel.org/riscv/c/284ca2a100de
  - [v2,10/11] riscv: kprobes: Remove duplication of RV_EXTRACT_UTYPE_IMM
    https://git.kernel.org/riscv/c/a60c2933ec74
  - [v2,11/11] riscv: kprobes: Remove duplication of RV_EXTRACT_ITYPE_IMM
    https://git.kernel.org/riscv/c/ee4c45f5cbeb

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
author
#13 lore raw
Quoted 31 lines · On Wed, Jun 04, 2025 at 02:33:06PM +0000, [email protected]…

Hello:

This series was applied to riscv/linux.git (for-next) by Alexandre Ghiti <[email protected]>:

Quoted 9 lines · On Wed, 14 May 2025 11:38:39 +0200 you wrote:

Hi,

There is some instruction-processing code in kprobes simulate code. These code should be insn.h. In fact, most of them is duplicating insn.h.

This series remove the duplicated bits and make use of macros already defined in insn.h. The non-duplicated bits are moved into insn.h.

[...]

Here is the summary with links:
- [v2,01/11] riscv: kprobes: Move branch_rs2_idx to insn.h

    https://git.kernel.org/riscv/c/d29656bab74c
  - [v2,02/11] riscv: kprobes: Move branch_funct3 to insn.h
    https://git.kernel.org/riscv/c/da6de46c2eed
  - [v2,03/11] riscv: kprobes: Remove duplication of RV_EXTRACT_JTYPE_IMM
    https://git.kernel.org/riscv/c/6d47d903b18f
  - [v2,04/11] riscv: kprobes: Remove duplication of RV_EXTRACT_RS1_REG
    https://git.kernel.org/riscv/c/5cefc323f32a
  - [v2,05/11] riscv: kprobes: Remove duplication of RV_EXTRACT_BTYPE_IMM
    https://git.kernel.org/riscv/c/a285674909ae
  - [v2,06/11] riscv: kproves: Remove duplication of RVC_EXTRACT_JTYPE_IMM
    https://git.kernel.org/riscv/c/c7196c136e29
  - [v2,07/11] riscv: kprobes: Remove duplication of RVC_EXTRACT_C2_RS1_REG
    https://git.kernel.org/riscv/c/768007ca3fe8
Quoted 8 lines

- [v2,08/11] riscv: kprobes: Remove duplication of RVC_EXTRACT_BTYPE_IMM

    https://git.kernel.org/riscv/c/f2c715fff676
  - [v2,09/11] riscv: kprobes: Remove duplication of RV_EXTRACT_RD_REG
    https://git.kernel.org/riscv/c/284ca2a100de
  - [v2,10/11] riscv: kprobes: Remove duplication of RV_EXTRACT_UTYPE_IMM
    https://git.kernel.org/riscv/c/a60c2933ec74
  - [v2,11/11] riscv: kprobes: Remove duplication of RV_EXTRACT_ITYPE_IMM
    https://git.kernel.org/riscv/c/ee4c45f5cbeb

This series was dropped from 6.16 due to conflict. Can it be re-applied? It applies cleanly to riscv/for-next.

The same story for:
https://lore.kernel.org/linux-riscv/174904758974.2309006.8809303189389627595.git-patchwork-notify@kernel.org/

Best regards,
Nam

#14 lore raw

Hi Nam,

Quoted 39 lines · Nam Cao
Quoted 30 lines · On Wed, Jun 04, 2025 at 02:33:06PM +0000, [email protected]…

Hello:

This series was applied to riscv/linux.git (for-next) by Alexandre Ghiti <[email protected]>:

Quoted 9 lines · On Wed, 14 May 2025 11:38:39 +0200 you wrote:

Hi,

There is some instruction-processing code in kprobes simulate code. These code should be insn.h. In fact, most of them is duplicating insn.h.

This series remove the duplicated bits and make use of macros already defined in insn.h. The non-duplicated bits are moved into insn.h.

[...]

Here is the summary with links:
- [v2,01/11] riscv: kprobes: Move branch_rs2_idx to insn.h

     https://git.kernel.org/riscv/c/d29656bab74c
   - [v2,02/11] riscv: kprobes: Move branch_funct3 to insn.h
     https://git.kernel.org/riscv/c/da6de46c2eed
   - [v2,03/11] riscv: kprobes: Remove duplication of RV_EXTRACT_JTYPE_IMM
     https://git.kernel.org/riscv/c/6d47d903b18f
   - [v2,04/11] riscv: kprobes: Remove duplication of RV_EXTRACT_RS1_REG
     https://git.kernel.org/riscv/c/5cefc323f32a
   - [v2,05/11] riscv: kprobes: Remove duplication of RV_EXTRACT_BTYPE_IMM
     https://git.kernel.org/riscv/c/a285674909ae
   - [v2,06/11] riscv: kproves: Remove duplication of RVC_EXTRACT_JTYPE_IMM
     https://git.kernel.org/riscv/c/c7196c136e29
   - [v2,07/11] riscv: kprobes: Remove duplication of RVC_EXTRACT_C2_RS1_REG
     https://git.kernel.org/riscv/c/768007ca3fe8
Quoted 8 lines

- [v2,08/11] riscv: kprobes: Remove duplication of RVC_EXTRACT_BTYPE_IMM

     https://git.kernel.org/riscv/c/f2c715fff676
   - [v2,09/11] riscv: kprobes: Remove duplication of RV_EXTRACT_RD_REG
     https://git.kernel.org/riscv/c/284ca2a100de
   - [v2,10/11] riscv: kprobes: Remove duplication of RV_EXTRACT_UTYPE_IMM
     https://git.kernel.org/riscv/c/a60c2933ec74
   - [v2,11/11] riscv: kprobes: Remove duplication of RV_EXTRACT_ITYPE_IMM
     https://git.kernel.org/riscv/c/ee4c45f5cbeb
Quoted 5 lines

This series was dropped from 6.16 due to conflict. Can it be re-applied? It applies cleanly to riscv/for-next.

The same story for:
https://lore.kernel.org/linux-riscv/174904758974.2309006.8809303189389627595.git-patchwork-notify@kernel.org/

Yes, I have both in my for-next branch, sorry I did not advertise that (I'm working on it).

FYI, I have enabled kunit tests in the upstream kernel CI: https://github.com/linux-riscv/linux/actions/runs/15967114709/job/45030410210?pr=571#step:5:625

Thanks,

Alex

Quoted 8 lines

Best regards,
Nam

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv