Skip to content

Commit dd155d0

Browse files
committed
Revert "LoongArch: BPF: Sign extend kfunc call arguments"
deepin inclusion category: bugfix It cause loongarch build failed. it need merge more depends, such as "LoongArch: Add more instruction opcodes and emit_* helpers" This reverts commit 83aa5d5. Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent cd32794 commit dd155d0

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

arch/loongarch/net/bpf_jit.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -834,22 +834,6 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
834834
if (ret < 0)
835835
return ret;
836836

837-
if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL) {
838-
const struct btf_func_model *m;
839-
int i;
840-
841-
m = bpf_jit_find_kfunc_model(ctx->prog, insn);
842-
if (!m)
843-
return -EINVAL;
844-
845-
for (i = 0; i < m->nr_args; i++) {
846-
u8 reg = regmap[BPF_REG_1 + i];
847-
bool sign = m->arg_flags[i] & BTF_FMODEL_SIGNED_ARG;
848-
849-
emit_abi_ext(ctx, reg, m->arg_size[i], sign);
850-
}
851-
}
852-
853837
move_addr(ctx, t1, func_addr);
854838
emit_insn(ctx, jirl, LOONGARCH_GPR_RA, t1, 0);
855839

arch/loongarch/net/bpf_jit.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,6 @@ static inline void emit_sext_32(struct jit_ctx *ctx, enum loongarch_gpr reg, boo
8787
emit_insn(ctx, addiw, reg, reg, 0);
8888
}
8989

90-
/* Emit proper extension according to ABI requirements.
91-
* Note that it requires a value of size `size` already resides in register `reg`.
92-
*/
93-
static inline void emit_abi_ext(struct jit_ctx *ctx, int reg, u8 size, bool sign)
94-
{
95-
/* ABI requires unsigned char/short to be zero-extended */
96-
if (!sign && (size == 1 || size == 2))
97-
return;
98-
99-
switch (size) {
100-
case 1:
101-
emit_insn(ctx, extwb, reg, reg);
102-
break;
103-
case 2:
104-
emit_insn(ctx, extwh, reg, reg);
105-
break;
106-
case 4:
107-
emit_insn(ctx, addiw, reg, reg, 0);
108-
break;
109-
case 8:
110-
break;
111-
default:
112-
pr_warn("bpf_jit: invalid size %d for extension\n", size);
113-
}
114-
}
115-
11690
static inline void move_addr(struct jit_ctx *ctx, enum loongarch_gpr rd, u64 addr)
11791
{
11892
u64 imm_11_0, imm_31_12, imm_51_32, imm_63_52;

0 commit comments

Comments
 (0)