mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
powerpc fixes for 6.1 #6
- Fix oops in 32-bit BPF tail call tests - Add missing declaration for machine_check_early_boot() Thanks to: Christophe Leroy, Naveen N. Rao. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmOMnI8THG1wZUBlbGxl cm1hbi5pZC5hdQAKCRBR6+o8yOGlgN7mD/9+9S6UugT20o82MtWLuyBMsNC+ILcf op23x6uYXp9aS/1/8ktRFhH3C6r74QvRxvnDs6He/Ai7jz4jlYNLNT2SfJ70WZGy SLlQKJwV1eUz502zCqV0s5/G/77wlrEfCrL3wToa0G6aw8/u1ECtSSXFx/fCAG0K jehHASbGxcyJiNZboMPJ940CXdeQNIK0ICbpi06Qvr4Uc3tybeICzgWGNzBROGIH q+kdOrMN2mF5LQONOKyC2OI94CNWJmBdqTTOle0jqWJT6h23vh4Oys+oO6uHyszU 6+qM1Ze4oLrU/oCaQXA1y4oFB2VL1pkFo2aO1rRot+GuqAIjy7BJlUdSfB6hQto5 JmtU0u7p3gBxU8BhMxufErNYODiXYQ0IVRR1YWHBoRs9aXyyQ/I0Ux46hvMI8qEN HyUt4wPWUt1L0QDP9hlGjSbwz/rs0lyDc+L46+TH45CozSHssWSQo5VRSmuyMuQ1 juQgNvydDdC7S+JIa6ppmNmhLlIm0jGyp7fM5SN4bopcc3bBT6LMIK+Am1O0bWsU petyukpuXD8kjxDazid56JkJNva0nnhScLfTQuvxxkViiVyCcuXSZh8g8/C1iMmk 7apvijphBG3ZwC0JZbwJjQxsi74uzdN8vxJMc7kZilY/qMngjVE3NoI9rPgbwvi+ lYdwu5F1KnxxAA== =Ea1J -----END PGP SIGNATURE----- Merge tag 'powerpc-6.1-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux Pull powerpc fixes from Michael Ellerman: - Fix oops in 32-bit BPF tail call tests - Add missing declaration for machine_check_early_boot() Thanks to Christophe Leroy and Naveen N. Rao. * tag 'powerpc-6.1-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/64s: Add missing declaration for machine_check_early_boot() powerpc/bpf/32: Fix Oops on tail call tests
This commit is contained in:
commit
ae6bb71711
@ -602,6 +602,7 @@ ____##func(struct pt_regs *regs)
|
||||
/* kernel/traps.c */
|
||||
DECLARE_INTERRUPT_HANDLER_NMI(system_reset_exception);
|
||||
#ifdef CONFIG_PPC_BOOK3S_64
|
||||
DECLARE_INTERRUPT_HANDLER_RAW(machine_check_early_boot);
|
||||
DECLARE_INTERRUPT_HANDLER_ASYNC(machine_check_exception_async);
|
||||
#endif
|
||||
DECLARE_INTERRUPT_HANDLER_NMI(machine_check_exception);
|
||||
|
@ -113,23 +113,19 @@ void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Initialize tail_call_cnt, to be skipped if we do tail calls. */
|
||||
EMIT(PPC_RAW_LI(_R4, 0));
|
||||
|
||||
#define BPF_TAILCALL_PROLOGUE_SIZE 4
|
||||
|
||||
EMIT(PPC_RAW_STWU(_R1, _R1, -BPF_PPC_STACKFRAME(ctx)));
|
||||
|
||||
if (ctx->seen & SEEN_TAILCALL)
|
||||
EMIT(PPC_RAW_STW(_R4, _R1, bpf_jit_stack_offsetof(ctx, BPF_PPC_TC)));
|
||||
|
||||
/* First arg comes in as a 32 bits pointer. */
|
||||
EMIT(PPC_RAW_MR(bpf_to_ppc(BPF_REG_1), _R3));
|
||||
EMIT(PPC_RAW_LI(bpf_to_ppc(BPF_REG_1) - 1, 0));
|
||||
EMIT(PPC_RAW_STWU(_R1, _R1, -BPF_PPC_STACKFRAME(ctx)));
|
||||
|
||||
/*
|
||||
* Initialize tail_call_cnt in stack frame if we do tail calls.
|
||||
* Otherwise, put in NOPs so that it can be skipped when we are
|
||||
* invoked through a tail call.
|
||||
*/
|
||||
if (ctx->seen & SEEN_TAILCALL)
|
||||
EMIT(PPC_RAW_STW(bpf_to_ppc(BPF_REG_1) - 1, _R1,
|
||||
bpf_jit_stack_offsetof(ctx, BPF_PPC_TC)));
|
||||
else
|
||||
EMIT(PPC_RAW_NOP());
|
||||
|
||||
#define BPF_TAILCALL_PROLOGUE_SIZE 16
|
||||
|
||||
/*
|
||||
* We need a stack frame, but we don't necessarily need to
|
||||
@ -170,6 +166,16 @@ static void bpf_jit_emit_common_epilogue(u32 *image, struct codegen_context *ctx
|
||||
for (i = BPF_PPC_NVR_MIN; i <= 31; i++)
|
||||
if (bpf_is_seen_register(ctx, i))
|
||||
EMIT(PPC_RAW_LWZ(i, _R1, bpf_jit_stack_offsetof(ctx, i)));
|
||||
|
||||
if (ctx->seen & SEEN_FUNC)
|
||||
EMIT(PPC_RAW_LWZ(_R0, _R1, BPF_PPC_STACKFRAME(ctx) + PPC_LR_STKOFF));
|
||||
|
||||
/* Tear down our stack frame */
|
||||
EMIT(PPC_RAW_ADDI(_R1, _R1, BPF_PPC_STACKFRAME(ctx)));
|
||||
|
||||
if (ctx->seen & SEEN_FUNC)
|
||||
EMIT(PPC_RAW_MTLR(_R0));
|
||||
|
||||
}
|
||||
|
||||
void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
|
||||
@ -178,16 +184,6 @@ void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
|
||||
|
||||
bpf_jit_emit_common_epilogue(image, ctx);
|
||||
|
||||
/* Tear down our stack frame */
|
||||
|
||||
if (ctx->seen & SEEN_FUNC)
|
||||
EMIT(PPC_RAW_LWZ(_R0, _R1, BPF_PPC_STACKFRAME(ctx) + PPC_LR_STKOFF));
|
||||
|
||||
EMIT(PPC_RAW_ADDI(_R1, _R1, BPF_PPC_STACKFRAME(ctx)));
|
||||
|
||||
if (ctx->seen & SEEN_FUNC)
|
||||
EMIT(PPC_RAW_MTLR(_R0));
|
||||
|
||||
EMIT(PPC_RAW_BLR());
|
||||
}
|
||||
|
||||
@ -244,7 +240,6 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o
|
||||
EMIT(PPC_RAW_RLWINM(_R3, b2p_index, 2, 0, 29));
|
||||
EMIT(PPC_RAW_ADD(_R3, _R3, b2p_bpf_array));
|
||||
EMIT(PPC_RAW_LWZ(_R3, _R3, offsetof(struct bpf_array, ptrs)));
|
||||
EMIT(PPC_RAW_STW(_R0, _R1, bpf_jit_stack_offsetof(ctx, BPF_PPC_TC)));
|
||||
|
||||
/*
|
||||
* if (prog == NULL)
|
||||
@ -255,19 +250,14 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o
|
||||
|
||||
/* goto *(prog->bpf_func + prologue_size); */
|
||||
EMIT(PPC_RAW_LWZ(_R3, _R3, offsetof(struct bpf_prog, bpf_func)));
|
||||
|
||||
if (ctx->seen & SEEN_FUNC)
|
||||
EMIT(PPC_RAW_LWZ(_R0, _R1, BPF_PPC_STACKFRAME(ctx) + PPC_LR_STKOFF));
|
||||
|
||||
EMIT(PPC_RAW_ADDIC(_R3, _R3, BPF_TAILCALL_PROLOGUE_SIZE));
|
||||
|
||||
if (ctx->seen & SEEN_FUNC)
|
||||
EMIT(PPC_RAW_MTLR(_R0));
|
||||
|
||||
EMIT(PPC_RAW_MTCTR(_R3));
|
||||
|
||||
EMIT(PPC_RAW_MR(_R3, bpf_to_ppc(BPF_REG_1)));
|
||||
|
||||
/* Put tail_call_cnt in r4 */
|
||||
EMIT(PPC_RAW_MR(_R4, _R0));
|
||||
|
||||
/* tear restore NVRs, ... */
|
||||
bpf_jit_emit_common_epilogue(image, ctx);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user