[PATCH 0/2] riscv: Add support for vector misaligned load/store

From: Nylon Chen

Date: Tue Nov 17 2026 - 02:38:54 EST


This series adds emulation support for misaligned RISC-V vector
load/store instructions, which may currently fault/trap without being
handled on hardware that does not provide misaligned vector memory
access support.

Patch 1 implements the trap handler, with emulators for vector
load/store covering unit-stride, strided, indexed (ordered and
unordered), segment, whole-register, and fault-only-first forms, for
both user and kernel mode traps.

Patch 2 adds a kselftest exercising these code paths across the
various vector instruction forms and element widths.

Signed-off-by: Nylon Chen <nylon.chen@xxxxxxxxxx>
---
Nylon Chen (2):
riscv: traps: Add support for vector misalignment handler
selftests/riscv: Add vector misaligned load/store tests

arch/riscv/include/asm/vector.h | 4 +
arch/riscv/kernel/Makefile | 1 +
arch/riscv/kernel/traps_misaligned.c | 39 +-
arch/riscv/kernel/traps_v_misaligned.c | 902 +++++++++++++++++++++
tools/testing/selftests/riscv/vector/Makefile | 5 +-
.../testing/selftests/riscv/vector/v_misaligned.c | 169 ++++
.../testing/selftests/riscv/vector/v_misaligned.h | 530 ++++++++++++
7 files changed, 1647 insertions(+), 3 deletions(-)
---
base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
change-id: 20261109-riscv-vector-misaligned-54773f80ca6b

Best regards,
--
Nylon Chen <nylon.chen@xxxxxxxxxx>