mbox series

[RFC,0/5] Add BPF JIT support for LoongArch

Message ID 1660013580-19053-1-git-send-email-yangtiezhu@loongson.cn (mailing list archive)
Headers show
Series Add BPF JIT support for LoongArch | expand

Message

Tiezhu Yang Aug. 9, 2022, 2:52 a.m. UTC
The basic support for LoongArch has been merged into the upstream Linux
kernel since 5.19-rc1 on June 5, 2022, this patch series adds BPF JIT
support for LoongArch.

Here is the LoongArch documention:
https://www.kernel.org/doc/html/latest/loongarch/index.html

This patch series is based on the loongarch-next branch of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git/

With this patch series, the test cases in lib/test_bpf.ko have passed
on LoongArch.

  # echo 1 > /proc/sys/net/core/bpf_jit_enable
  # modprobe test_bpf
  # dmesg | grep Summary
  test_bpf: Summary: 1026 PASSED, 0 FAILED, [1014/1014 JIT'ed]
  test_bpf: test_tail_calls: Summary: 10 PASSED, 0 FAILED, [10/10 JIT'ed]
  test_bpf: test_skb_segment: Summary: 2 PASSED, 0 FAILED

This version is RFC, I am working on it to do some more optimizations and
looking forward to your feedback, any comments will be much appreciated.
After the merge window, I will rebase and address the review comments.

Tiezhu Yang (5):
  LoongArch: Fix some instruction formats
  LoongArch: Add some instruction opcodes and formats
  LoongArch: Add BPF JIT support
  LoongArch: Update loongson3_defconfig to make it clean
  LoongArch: Enable BPF_JIT and TEST_BPF in loongson3_defconfig

 arch/loongarch/Kbuild                      |    1 +
 arch/loongarch/Kconfig                     |    1 +
 arch/loongarch/configs/loongson3_defconfig |   58 +-
 arch/loongarch/include/asm/inst.h          |  147 +++-
 arch/loongarch/net/Makefile                |    7 +
 arch/loongarch/net/bpf_jit.c               | 1119 ++++++++++++++++++++++++++++
 arch/loongarch/net/bpf_jit.h               |  946 +++++++++++++++++++++++
 7 files changed, 2222 insertions(+), 57 deletions(-)
 create mode 100644 arch/loongarch/net/Makefile
 create mode 100644 arch/loongarch/net/bpf_jit.c
 create mode 100644 arch/loongarch/net/bpf_jit.h