[PATCH bpf-next v2 0/2] bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc JITs
From: Nicholas Dudar
Date: Mon Sep 14 2026 - 22:33:11 EST
The parisc BPF JITs emit unsigned divide and remainder for signed
BPF_DIV and BPF_MOD (off == 1), so neither implements signed BPF_SDIV
and BPF_SMOD. Negative operands therefore produce unsigned results.
Patch 1 adds signed support to the parisc64 JIT and shared signed
64-bit helpers. Patch 2 adds support to the parisc32 JIT, using those
helpers for ALU64 and the signed millicode routines for ALU32.
The original series was tested with test_bpf under QEMU on both JITs:
the signed division and remainder cases fail before and pass after.
Helge has also tested the series on physical machines and QEMU.
For this rebase, both JITs and test_bpf.o build with W=1. The source
changes are unchanged from v1; no new runtime run is claimed for v2.
Changes in v2:
- Rebase on current bpf-next; no code changes.
- Add Helge's Acked-by and Tested-by to both patches.
v1: https://lore.kernel.org/bpf/20260717190544.257306-1-main.kalliope@xxxxxxxxx/
Nicholas Dudar (2):
bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc64 JIT
bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc32 JIT
arch/parisc/net/bpf_jit.h | 2 ++
arch/parisc/net/bpf_jit_comp32.c | 29 +++++++++++++++++---------
arch/parisc/net/bpf_jit_comp64.c | 35 ++++++++++++++++++++++++--------
arch/parisc/net/bpf_jit_core.c | 14 +++++++++++++
4 files changed, 61 insertions(+), 19 deletions(-)
base-commit: 5ef40d69b38a93bc9951dadb1a15c85c597e1a40