|
|
Log in / Subscribe / Register

Add BPF JIT support for LoongArch

From:  Tiezhu Yang <yangtiezhu-AT-loongson.cn>
To:  Huacai Chen <chenhuacai-AT-kernel.org>, Alexei Starovoitov <ast-AT-kernel.org>, Daniel Borkmann <daniel-AT-iogearbox.net>, Andrii Nakryiko <andrii-AT-kernel.org>
Subject:  [RFC PATCH 0/5] Add BPF JIT support for LoongArch
Date:  Tue, 09 Aug 2022 10:52:55 +0800
Message-ID:  <1660013580-19053-1-git-send-email-yangtiezhu@loongson.cn>
Cc:  bpf-AT-vger.kernel.org, loongarch-AT-lists.linux.dev
Archive-link:  Article

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/chenhuaca...

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

-- 
2.1.0



Copyright © 2022, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds