Skip to content

Commit dbf44da

Browse files
borkmannAlexei Starovoitov
authored andcommitted
bpf, ppc64: remove ld_abs/ld_ind
Since LD_ABS/LD_IND instructions are now removed from the core and reimplemented through a combination of inlined BPF instructions and a slow-path helper, we can get rid of the complexity from ppc64 JIT. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Tested-by: Sandipan Das <sandipan@linux.vnet.ibm.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 4db25cc commit dbf44da

File tree

4 files changed

+11
-317
lines changed

4 files changed

+11
-317
lines changed

arch/powerpc/net/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Arch-specific network modules
44
#
55
ifeq ($(CONFIG_PPC64),y)
6-
obj-$(CONFIG_BPF_JIT) += bpf_jit_asm64.o bpf_jit_comp64.o
6+
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp64.o
77
else
88
obj-$(CONFIG_BPF_JIT) += bpf_jit_asm.o bpf_jit_comp.o
99
endif

arch/powerpc/net/bpf_jit64.h

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
* with our redzone usage.
2121
*
2222
* [ prev sp ] <-------------
23-
* [ nv gpr save area ] 8*8 |
23+
* [ nv gpr save area ] 6*8 |
2424
* [ tail_call_cnt ] 8 |
2525
* [ local_tmp_var ] 8 |
2626
* fp (r31) --> [ ebpf stack space ] upto 512 |
2727
* [ frame header ] 32/112 |
2828
* sp (r1) ---> [ stack pointer ] --------------
2929
*/
3030

31-
/* for gpr non volatile registers BPG_REG_6 to 10, plus skb cache registers */
32-
#define BPF_PPC_STACK_SAVE (8*8)
31+
/* for gpr non volatile registers BPG_REG_6 to 10 */
32+
#define BPF_PPC_STACK_SAVE (6*8)
3333
/* for bpf JIT code internal usage */
3434
#define BPF_PPC_STACK_LOCALS 16
3535
/* stack frame excluding BPF stack, ensure this is quadword aligned */
@@ -39,10 +39,8 @@
3939
#ifndef __ASSEMBLY__
4040

4141
/* BPF register usage */
42-
#define SKB_HLEN_REG (MAX_BPF_JIT_REG + 0)
43-
#define SKB_DATA_REG (MAX_BPF_JIT_REG + 1)
44-
#define TMP_REG_1 (MAX_BPF_JIT_REG + 2)
45-
#define TMP_REG_2 (MAX_BPF_JIT_REG + 3)
42+
#define TMP_REG_1 (MAX_BPF_JIT_REG + 0)
43+
#define TMP_REG_2 (MAX_BPF_JIT_REG + 1)
4644

4745
/* BPF to ppc register mappings */
4846
static const int b2p[] = {
@@ -63,40 +61,23 @@ static const int b2p[] = {
6361
[BPF_REG_FP] = 31,
6462
/* eBPF jit internal registers */
6563
[BPF_REG_AX] = 2,
66-
[SKB_HLEN_REG] = 25,
67-
[SKB_DATA_REG] = 26,
6864
[TMP_REG_1] = 9,
6965
[TMP_REG_2] = 10
7066
};
7167

72-
/* PPC NVR range -- update this if we ever use NVRs below r24 */
73-
#define BPF_PPC_NVR_MIN 24
74-
75-
/* Assembly helpers */
76-
#define DECLARE_LOAD_FUNC(func) u64 func(u64 r3, u64 r4); \
77-
u64 func##_negative_offset(u64 r3, u64 r4); \
78-
u64 func##_positive_offset(u64 r3, u64 r4);
79-
80-
DECLARE_LOAD_FUNC(sk_load_word);
81-
DECLARE_LOAD_FUNC(sk_load_half);
82-
DECLARE_LOAD_FUNC(sk_load_byte);
83-
84-
#define CHOOSE_LOAD_FUNC(imm, func) \
85-
(imm < 0 ? \
86-
(imm >= SKF_LL_OFF ? func##_negative_offset : func) : \
87-
func##_positive_offset)
68+
/* PPC NVR range -- update this if we ever use NVRs below r27 */
69+
#define BPF_PPC_NVR_MIN 27
8870

8971
#define SEEN_FUNC 0x1000 /* might call external helpers */
9072
#define SEEN_STACK 0x2000 /* uses BPF stack */
91-
#define SEEN_SKB 0x4000 /* uses sk_buff */
92-
#define SEEN_TAILCALL 0x8000 /* uses tail calls */
73+
#define SEEN_TAILCALL 0x4000 /* uses tail calls */
9374

9475
struct codegen_context {
9576
/*
9677
* This is used to track register usage as well
9778
* as calls to external helpers.
9879
* - register usage is tracked with corresponding
99-
* bits (r3-r10 and r25-r31)
80+
* bits (r3-r10 and r27-r31)
10081
* - rest of the bits can be used to track other
10182
* things -- for now, we use bits 16 to 23
10283
* encoded in SEEN_* macros above

arch/powerpc/net/bpf_jit_asm64.S

Lines changed: 0 additions & 180 deletions
This file was deleted.

0 commit comments

Comments
 (0)