mbox series

[v3,0/8] Add RISC-V asm/insn.h header

Message ID 20220224152456.493365-1-kernel@esmil.dk (mailing list archive)
Headers show
Series Add RISC-V asm/insn.h header | expand

Message

Emil Renner Berthing Feb. 24, 2022, 3:24 p.m. UTC
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/20220223191257.143694-1-kernel@esmil.dk/

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