Skip to content

Commit 1c9429d

Browse files
Automatic merge of 'next-test' into merge-test (2025-09-06 16:08)
2 parents 4d5be09 + e7a6475 commit 1c9429d

File tree

17 files changed

+475
-250
lines changed

17 files changed

+475
-250
lines changed

arch/powerpc/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ config PPC
248248
select HAVE_FUNCTION_ERROR_INJECTION
249249
select HAVE_FUNCTION_GRAPH_TRACER
250250
select HAVE_FUNCTION_TRACER if !COMPILE_TEST && (PPC64 || (PPC32 && CC_IS_GCC))
251-
select HAVE_GCC_PLUGINS if GCC_VERSION >= 50200 # plugin support on gcc <= 5.1 is buggy on PPC
251+
select HAVE_GCC_PLUGINS
252252
select HAVE_GENERIC_VDSO
253253
select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC_BOOK3S_64 && SMP
254254
select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI

arch/powerpc/boot/wrapper

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,7 @@ ld_is_lld()
226226

227227
# Do not include PT_INTERP segment when linking pie. Non-pie linking
228228
# just ignores this option.
229-
LD_VERSION=$(${CROSS}ld --version | ld_version)
230-
LD_NO_DL_MIN_VERSION=$(echo 2.26 | ld_version)
231-
if [ "$LD_VERSION" -ge "$LD_NO_DL_MIN_VERSION" ] ; then
232-
nodl="--no-dynamic-linker"
233-
fi
229+
nodl="--no-dynamic-linker"
234230

235231
# suppress some warnings in recent ld versions
236232
nowarn="-z noexecstack"

arch/powerpc/include/asm/ppc-opcode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@
571571
(0x54000001 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH(i) | __PPC_MB(mb) | __PPC_ME(me))
572572
#define PPC_RAW_RLWIMI(d, a, i, mb, me) (0x50000000 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH(i) | __PPC_MB(mb) | __PPC_ME(me))
573573
#define PPC_RAW_RLDICL(d, a, i, mb) (0x78000000 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH64(i) | __PPC_MB64(mb))
574+
#define PPC_RAW_RLDICL_DOT(d, a, i, mb) (0x78000000 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH64(i) | __PPC_MB64(mb) | 0x1)
574575
#define PPC_RAW_RLDICR(d, a, i, me) (0x78000004 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH64(i) | __PPC_ME64(me))
575576

576577
/* slwi = rlwinm Rx, Ry, n, 0, 31-n */

arch/powerpc/kernel/head_8xx.S

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ instruction_counter:
190190
INVALIDATE_ADJACENT_PAGES_CPU15(r10, r11)
191191
mtspr SPRN_MD_EPN, r10
192192
mfspr r10, SPRN_M_TWB /* Get level 1 table */
193-
lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */
193+
lwz r11, 0(r10) /* Get level 1 entry */
194194
mtspr SPRN_MD_TWC, r11
195195
mfspr r10, SPRN_MD_TWC
196196
lwz r10, 0(r10) /* Get the pte */
@@ -233,7 +233,7 @@ instruction_counter:
233233
*/
234234
mfspr r10, SPRN_MD_EPN
235235
mfspr r10, SPRN_M_TWB /* Get level 1 table */
236-
lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */
236+
lwz r11, 0(r10) /* Get level 1 entry */
237237

238238
mtspr SPRN_MD_TWC, r11
239239
mfspr r10, SPRN_MD_TWC
@@ -375,7 +375,7 @@ FixupPGD:
375375
mfspr r10, SPRN_DAR
376376
mtspr SPRN_MD_EPN, r10
377377
mfspr r11, SPRN_M_TWB /* Get level 1 table */
378-
lwz r10, (swapper_pg_dir - PAGE_OFFSET)@l(r11) /* Get the level 1 entry */
378+
lwz r10, 0(r11) /* Get the level 1 entry */
379379
cmpwi cr1, r10, 0
380380
bne cr1, 1f
381381

@@ -384,7 +384,7 @@ FixupPGD:
384384
lwz r10, (swapper_pg_dir - PAGE_OFFSET)@l(r10) /* Get the level 1 entry */
385385
cmpwi cr1, r10, 0
386386
beq cr1, 1f
387-
stw r10, (swapper_pg_dir - PAGE_OFFSET)@l(r11) /* Set the level 1 entry */
387+
stw r10, 0(r11) /* Set the level 1 entry */
388388
mfspr r10, SPRN_M_TW
389389
mtcr r10
390390
mfspr r10, SPRN_SPRG_SCRATCH0
@@ -412,9 +412,10 @@ FixupDAR:/* Entry point for dcbx workaround. */
412412
tophys(r11, r10)
413413
mfspr r11, SPRN_M_TWB /* Get level 1 table */
414414
rlwinm r11, r11, 0, 20, 31
415-
oris r11, r11, (swapper_pg_dir - PAGE_OFFSET)@ha
415+
oris r11, r11, (swapper_pg_dir - PAGE_OFFSET)@h
416+
ori r11, r11, (swapper_pg_dir - PAGE_OFFSET)@l
416417
3:
417-
lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */
418+
lwz r11, 0(r11) /* Get the level 1 entry */
418419
rlwinm r11, r11, 0, ~_PMD_PAGE_8M
419420
mtspr SPRN_MD_TWC, r11
420421
mfspr r11, SPRN_MD_TWC
@@ -535,7 +536,8 @@ start_here:
535536
li r0,0
536537
stwu r0,THREAD_SIZE-STACK_FRAME_MIN_SIZE(r1)
537538

538-
lis r6, swapper_pg_dir@ha
539+
lis r6, swapper_pg_dir@h
540+
ori r6, r6, swapper_pg_dir@l
539541
tophys(r6,r6)
540542
mtspr SPRN_M_TWB, r6
541543

arch/powerpc/kernel/vdso.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <vdso/datapage.h>
2222

2323
#include <asm/syscall.h>
24+
#include <asm/syscalls.h>
2425
#include <asm/processor.h>
2526
#include <asm/mmu.h>
2627
#include <asm/mmu_context.h>
@@ -40,8 +41,6 @@ static_assert(__VDSO_PAGES == VDSO_NR_PAGES);
4041
extern char vdso32_start, vdso32_end;
4142
extern char vdso64_start, vdso64_end;
4243

43-
long sys_ni_syscall(void);
44-
4544
static int vdso_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma,
4645
unsigned long text_size)
4746
{

arch/powerpc/mm/nohash/mmu_context.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,7 @@ static unsigned int steal_context_up(unsigned int id)
203203
static void set_context(unsigned long id, pgd_t *pgd)
204204
{
205205
if (IS_ENABLED(CONFIG_PPC_8xx)) {
206-
s16 offset = (s16)(__pa(swapper_pg_dir));
207-
208-
/*
209-
* Register M_TWB will contain base address of level 1 table minus the
210-
* lower part of the kernel PGDIR base address, so that all accesses to
211-
* level 1 table are done relative to lower part of kernel PGDIR base
212-
* address.
213-
*/
214-
mtspr(SPRN_M_TWB, __pa(pgd) - offset);
206+
mtspr(SPRN_M_TWB, __pa(pgd));
215207

216208
/* Update context */
217209
mtspr(SPRN_M_CASID, id - 1);

arch/powerpc/net/bpf_jit.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ struct codegen_context {
161161
unsigned int seen;
162162
unsigned int idx;
163163
unsigned int stack_size;
164-
int b2p[MAX_BPF_JIT_REG + 2];
164+
int b2p[MAX_BPF_JIT_REG + 3];
165165
unsigned int exentry_idx;
166166
unsigned int alt_exit_addr;
167+
u64 arena_vm_start;
168+
u64 user_vm_start;
167169
};
168170

169171
#define bpf_to_ppc(r) (ctx->b2p[r])
@@ -201,7 +203,7 @@ int bpf_jit_emit_exit_insn(u32 *image, struct codegen_context *ctx, int tmp_reg,
201203

202204
int bpf_add_extable_entry(struct bpf_prog *fp, u32 *image, u32 *fimage, int pass,
203205
struct codegen_context *ctx, int insn_idx,
204-
int jmp_off, int dst_reg);
206+
int jmp_off, int dst_reg, u32 code);
205207

206208
#endif
207209

arch/powerpc/net/bpf_jit_comp.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
204204

205205
/* Make sure that the stack is quadword aligned. */
206206
cgctx.stack_size = round_up(fp->aux->stack_depth, 16);
207+
cgctx.arena_vm_start = bpf_arena_get_kern_vm_start(fp->aux->arena);
208+
cgctx.user_vm_start = bpf_arena_get_user_vm_start(fp->aux->arena);
207209

208210
/* Scouting faux-generate pass 0 */
209211
if (bpf_jit_build_body(fp, NULL, NULL, &cgctx, addrs, 0, false)) {
@@ -326,7 +328,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
326328
*/
327329
int bpf_add_extable_entry(struct bpf_prog *fp, u32 *image, u32 *fimage, int pass,
328330
struct codegen_context *ctx, int insn_idx, int jmp_off,
329-
int dst_reg)
331+
int dst_reg, u32 code)
330332
{
331333
off_t offset;
332334
unsigned long pc;
@@ -355,6 +357,9 @@ int bpf_add_extable_entry(struct bpf_prog *fp, u32 *image, u32 *fimage, int pass
355357
(ctx->exentry_idx * BPF_FIXUP_LEN * 4);
356358

357359
fixup[0] = PPC_RAW_LI(dst_reg, 0);
360+
if (BPF_CLASS(code) == BPF_ST || BPF_CLASS(code) == BPF_STX)
361+
fixup[0] = PPC_RAW_NOP();
362+
358363
if (IS_ENABLED(CONFIG_PPC32))
359364
fixup[1] = PPC_RAW_LI(dst_reg - 1, 0); /* clear higher 32-bit register too */
360365

@@ -435,11 +440,32 @@ bool bpf_jit_supports_kfunc_call(void)
435440
return true;
436441
}
437442

443+
bool bpf_jit_supports_arena(void)
444+
{
445+
return IS_ENABLED(CONFIG_PPC64);
446+
}
447+
438448
bool bpf_jit_supports_far_kfunc_call(void)
439449
{
440450
return IS_ENABLED(CONFIG_PPC64);
441451
}
442452

453+
bool bpf_jit_supports_insn(struct bpf_insn *insn, bool in_arena)
454+
{
455+
if (!in_arena)
456+
return true;
457+
switch (insn->code) {
458+
case BPF_STX | BPF_ATOMIC | BPF_H:
459+
case BPF_STX | BPF_ATOMIC | BPF_B:
460+
case BPF_STX | BPF_ATOMIC | BPF_W:
461+
case BPF_STX | BPF_ATOMIC | BPF_DW:
462+
if (bpf_atomic_is_load_store(insn))
463+
return false;
464+
return IS_ENABLED(CONFIG_PPC64);
465+
}
466+
return true;
467+
}
468+
443469
void *arch_alloc_bpf_trampoline(unsigned int size)
444470
{
445471
return bpf_prog_pack_alloc(size, bpf_jit_fill_ill_insns);
@@ -579,7 +605,7 @@ static void bpf_trampoline_setup_tail_call_cnt(u32 *image, struct codegen_contex
579605
{
580606
if (IS_ENABLED(CONFIG_PPC64)) {
581607
/* See bpf_jit_stack_tailcallcnt() */
582-
int tailcallcnt_offset = 6 * 8;
608+
int tailcallcnt_offset = 7 * 8;
583609

584610
EMIT(PPC_RAW_LL(_R3, _R1, func_frame_offset - tailcallcnt_offset));
585611
EMIT(PPC_RAW_STL(_R3, _R1, -tailcallcnt_offset));
@@ -594,7 +620,7 @@ static void bpf_trampoline_restore_tail_call_cnt(u32 *image, struct codegen_cont
594620
{
595621
if (IS_ENABLED(CONFIG_PPC64)) {
596622
/* See bpf_jit_stack_tailcallcnt() */
597-
int tailcallcnt_offset = 6 * 8;
623+
int tailcallcnt_offset = 7 * 8;
598624

599625
EMIT(PPC_RAW_LL(_R3, _R1, -tailcallcnt_offset));
600626
EMIT(PPC_RAW_STL(_R3, _R1, func_frame_offset - tailcallcnt_offset));

arch/powerpc/net/bpf_jit_comp32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
10871087
}
10881088

10891089
ret = bpf_add_extable_entry(fp, image, fimage, pass, ctx, insn_idx,
1090-
jmp_off, dst_reg);
1090+
jmp_off, dst_reg, code);
10911091
if (ret)
10921092
return ret;
10931093
}

0 commit comments

Comments
 (0)