1 From: Johan Almbladh <johan.almbladh@anyfinetworks.com>
2 Date: Tue, 5 Oct 2021 18:54:07 +0200
3 Subject: [PATCH] mips: bpf: Enable eBPF JITs
5 This patch enables the new eBPF JITs for 32-bit and 64-bit MIPS. It also
6 disables the old cBPF JIT to so cBPF programs are converted to use the
9 Workarounds for R4000 CPU errata are not implemented by the JIT, so the
10 JIT is disabled if any of those workarounds are configured.
12 Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
17 @@ -3294,6 +3294,7 @@ S: Supported
20 BPF JIT for MIPS (32-BIT AND 64-BIT)
21 +M: Johan Almbladh <johan.almbladh@anyfinetworks.com>
22 M: Paul Burton <paulburton@kernel.org>
23 L: netdev@vger.kernel.org
24 L: bpf@vger.kernel.org
25 --- a/arch/mips/Kconfig
26 +++ b/arch/mips/Kconfig
27 @@ -49,7 +49,6 @@ config MIPS
28 select HAVE_ARCH_TRACEHOOK
29 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES
30 select HAVE_ASM_MODVERSIONS
31 - select HAVE_CBPF_JIT if !64BIT && !CPU_MICROMIPS
32 select HAVE_CONTEXT_TRACKING
34 select HAVE_C_RECORDMCOUNT
35 @@ -57,7 +56,10 @@ config MIPS
36 select HAVE_DEBUG_STACKOVERFLOW
37 select HAVE_DMA_CONTIGUOUS
38 select HAVE_DYNAMIC_FTRACE
39 - select HAVE_EBPF_JIT if 64BIT && !CPU_MICROMIPS && TARGET_ISA_REV >= 2
40 + select HAVE_EBPF_JIT if !CPU_MICROMIPS && \
41 + !CPU_DADDI_WORKAROUNDS && \
42 + !CPU_R4000_WORKAROUNDS && \
43 + !CPU_R4400_WORKAROUNDS
44 select HAVE_EXIT_THREAD
46 select HAVE_FTRACE_MCOUNT_RECORD
47 --- a/arch/mips/net/Makefile
48 +++ b/arch/mips/net/Makefile
50 # MIPS networking code
52 obj-$(CONFIG_MIPS_CBPF_JIT) += bpf_jit.o bpf_jit_asm.o
53 +obj-$(CONFIG_MIPS_EBPF_JIT) += bpf_jit_comp.o
55 ifeq ($(CONFIG_32BIT),y)
56 - obj-$(CONFIG_MIPS_EBPF_JIT) += bpf_jit_comp.o bpf_jit_comp32.o
57 + obj-$(CONFIG_MIPS_EBPF_JIT) += bpf_jit_comp32.o
59 - obj-$(CONFIG_MIPS_EBPF_JIT) += ebpf_jit.o
60 + obj-$(CONFIG_MIPS_EBPF_JIT) += bpf_jit_comp64.o