Skip to content

Add RISC-V asm/insn.h header

Emil Renner Berthing linux-riscv lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest8 patches 2 repliesIn review
  2. v27 patches 2 repliesSuperseded
  3. v17 patches 0 repliesSuperseded

Changes in v3 from the cover letter

- Split the range check fix out and send it separately.
- Convert "if (IS_DEFINED(CONFIG_32BIT))" to #ifdef to avoid compiler warning on rv32. Thanks kernel test robot!
- Add sp register, load/store instructions and RISCV_INSN_REG_L, RISCV_INSN_REG_S and RISC_INSN_SZREG macros to work on both rv32 and rv64 to the asm/insn.h header.
- Add patch moving unneded definitions out of out asm/ftrace.h and a patch converting kernel/ftrace.c to use the header.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8riscv: Avoid unaligned access when relocating modulesarch/riscv/kernel/module.c+76 -752 replies
2/8riscv: Remove unneeded definitions from asm/module.harch/riscv/include/asm/module.h arch/riscv/kernel/module-sections.c+90 -870 replies
3/8riscv: Remove unneeded definitions from asm/ftrace.harch/riscv/include/asm/ftrace.h arch/riscv/kernel/ftrace.c+36 -340 replies
4/8riscv: Add asm/insn.h headerarch/riscv/include/asm/insn.h+151 -00 replies
5/8riscv: Use asm/insn.h for module relocationsarch/riscv/kernel/module.c+56 -830 replies
6/8riscv: Use asm/insn.h to generate plt entriesarch/riscv/kernel/module-sections.c+4 -230 replies
7/8riscv: Use asm/insn.h for jump labelsarch/riscv/kernel/jump_label.c+3 -90 replies
8/8riscv: Use asm/insn.h for dynamic ftracearch/riscv/kernel/ftrace.c+22 -470 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/8] Add RISC-V asm/insn.h header

This series adds a RISC-V asm/insn.h header to consolidate instruction generation and manipulation similar to arm64's asm/insn.h.

The first three patches are preparatory patches fixing unaligned access in module relocations and moving unneded definitions out of asm/module.h and asm/ftrace.h.
Patch 4 adds the header and the remaining patches converts module relocation, plt entry, jump label and dynamic ftrace code to use it.

The only obvious code left to convert is the BPF JIT(s).

This series depends on the module relocation range check fix here:
https://lore.kernel.org/linux-riscv/[email protected]/

Changes since v2:
- Split the range check fix out and send it separately.
- Convert "if (IS_DEFINED(CONFIG_32BIT))" to #ifdef to avoid compiler warning on rv32. Thanks kernel test robot!
- Add sp register, load/store instructions and RISCV_INSN_REG_L, RISCV_INSN_REG_S and RISC_INSN_SZREG macros to work on both rv32 and rv64 to the asm/insn.h header.
- Add patch moving unneded definitions out of out asm/ftrace.h and a patch converting kernel/ftrace.c to use the header.

Changes since v1:
- Send the right patches.

Emil Renner Berthing (8):
riscv: Avoid unaligned access when relocating modules
riscv: Remove unneeded definitions from asm/module.h
riscv: Remove unneeded definitions from asm/ftrace.h
riscv: Add asm/insn.h header
riscv: Use asm/insn.h for module relocations
riscv: Use asm/insn.h to generate plt entries
riscv: Use asm/insn.h for jump labels
riscv: Use asm/insn.h for dynamic ftrace

 arch/riscv/include/asm/ftrace.h     |  35 +----
 arch/riscv/include/asm/insn.h       | 151 ++++++++++++++++++
 arch/riscv/include/asm/module.h     |  87 ----------
 arch/riscv/kernel/ftrace.c          |  56 ++++---
 arch/riscv/kernel/jump_label.c      |  12 +-
 arch/riscv/kernel/module-sections.c |  71 +++++++++
 arch/riscv/kernel/module.c          | 236 +++++++++++++---------------
 7 files changed, 364 insertions(+), 284 deletions(-)
 create mode 100644 arch/riscv/include/asm/insn.h
Signature · 1 line
2.35.1