Skip to content

Commit 582b0e5

Browse files
committed
Automatic merge of 'next' into merge (2024-07-12 22:47)
2 parents 840a696 + 90e812a commit 582b0e5

File tree

10 files changed

+106
-77
lines changed

10 files changed

+106
-77
lines changed

Documentation/arch/powerpc/cpu_families.rst

-18
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,6 @@ IBM BookE
128128
- All 32 bit::
129129

130130
+--------------+
131-
| 401 |
132-
+--------------+
133-
|
134-
|
135-
v
136-
+--------------+
137-
| 403 |
138-
+--------------+
139-
|
140-
|
141-
v
142-
+--------------+
143-
| 405 |
144-
+--------------+
145-
|
146-
|
147-
v
148-
+--------------+
149131
| 440 |
150132
+--------------+
151133
|

Documentation/arch/powerpc/elf_hwcaps.rst

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ PPC_FEATURE_HAS_MMU
9191

9292
PPC_FEATURE_HAS_4xxMAC
9393
The processor is 40x or 44x family.
94+
Unused in the kernel since 732b32daef80 ("powerpc: Remove core support for 40x")
9495

9596
PPC_FEATURE_UNIFIED_CACHE
9697
The processor has a unified L1 cache for instructions and data, as

arch/powerpc/boot/wrapper

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ ps3)
337337
make_space=n
338338
pie=
339339
;;
340-
ep88xc|ep405|ep8248e)
340+
ep88xc|ep8248e)
341341
platformo="$object/fixed-head.o $object/$platform.o"
342342
binary=y
343343
;;

arch/powerpc/include/asm/cpu_has_feature.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ static __always_inline bool cpu_has_feature(unsigned long feature)
2424
{
2525
int i;
2626

27-
#ifndef __clang__ /* clang can't cope with this */
2827
BUILD_BUG_ON(!__builtin_constant_p(feature));
29-
#endif
28+
BUILD_BUG_ON(__builtin_popcountl(feature) > 1);
3029

3130
#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
3231
if (!static_key_feature_checks_initialized) {

arch/powerpc/include/asm/mmu.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,8 @@ static __always_inline bool mmu_has_feature(unsigned long feature)
239239
{
240240
int i;
241241

242-
#ifndef __clang__ /* clang can't cope with this */
243242
BUILD_BUG_ON(!__builtin_constant_p(feature));
244-
#endif
243+
BUILD_BUG_ON(__builtin_popcountl(feature) > 1);
245244

246245
#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
247246
if (!static_key_feature_checks_initialized) {

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

+2
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@
471471
#define PPC_RAW_VCMPEQUB_RC(vrt, vra, vrb) \
472472
(0x10000006 | ___PPC_RT(vrt) | ___PPC_RA(vra) | ___PPC_RB(vrb) | __PPC_RC21)
473473
#define PPC_RAW_LD(r, base, i) (0xe8000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_DS(i))
474+
#define PPC_RAW_LWA(r, base, i) (0xe8000002 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_DS(i))
474475
#define PPC_RAW_LWZ(r, base, i) (0x80000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_L(i))
475476
#define PPC_RAW_LWZX(t, a, b) (0x7c00002e | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b))
476477
#define PPC_RAW_STD(r, base, i) (0xf8000000 | ___PPC_RS(r) | ___PPC_RA(base) | IMM_DS(i))
@@ -535,6 +536,7 @@
535536
#define PPC_RAW_MULI(d, a, i) (0x1c000000 | ___PPC_RT(d) | ___PPC_RA(a) | IMM_L(i))
536537
#define PPC_RAW_DIVW(d, a, b) (0x7c0003d6 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b))
537538
#define PPC_RAW_DIVWU(d, a, b) (0x7c000396 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b))
539+
#define PPC_RAW_DIVD(d, a, b) (0x7c0003d2 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b))
538540
#define PPC_RAW_DIVDU(d, a, b) (0x7c000392 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b))
539541
#define PPC_RAW_DIVDE(t, a, b) (0x7c000352 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b))
540542
#define PPC_RAW_DIVDE_DOT(t, a, b) (0x7c000352 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | 0x1)

arch/powerpc/net/bpf_jit_comp64.c

+88-30
Original file line numberDiff line numberDiff line change
@@ -510,20 +510,33 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
510510
case BPF_ALU | BPF_DIV | BPF_X: /* (u32) dst /= (u32) src */
511511
case BPF_ALU | BPF_MOD | BPF_X: /* (u32) dst %= (u32) src */
512512
if (BPF_OP(code) == BPF_MOD) {
513-
EMIT(PPC_RAW_DIVWU(tmp1_reg, dst_reg, src_reg));
513+
if (off)
514+
EMIT(PPC_RAW_DIVW(tmp1_reg, dst_reg, src_reg));
515+
else
516+
EMIT(PPC_RAW_DIVWU(tmp1_reg, dst_reg, src_reg));
517+
514518
EMIT(PPC_RAW_MULW(tmp1_reg, src_reg, tmp1_reg));
515519
EMIT(PPC_RAW_SUB(dst_reg, dst_reg, tmp1_reg));
516520
} else
517-
EMIT(PPC_RAW_DIVWU(dst_reg, dst_reg, src_reg));
521+
if (off)
522+
EMIT(PPC_RAW_DIVW(dst_reg, dst_reg, src_reg));
523+
else
524+
EMIT(PPC_RAW_DIVWU(dst_reg, dst_reg, src_reg));
518525
goto bpf_alu32_trunc;
519526
case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /= src */
520527
case BPF_ALU64 | BPF_MOD | BPF_X: /* dst %= src */
521528
if (BPF_OP(code) == BPF_MOD) {
522-
EMIT(PPC_RAW_DIVDU(tmp1_reg, dst_reg, src_reg));
529+
if (off)
530+
EMIT(PPC_RAW_DIVD(tmp1_reg, dst_reg, src_reg));
531+
else
532+
EMIT(PPC_RAW_DIVDU(tmp1_reg, dst_reg, src_reg));
523533
EMIT(PPC_RAW_MULD(tmp1_reg, src_reg, tmp1_reg));
524534
EMIT(PPC_RAW_SUB(dst_reg, dst_reg, tmp1_reg));
525535
} else
526-
EMIT(PPC_RAW_DIVDU(dst_reg, dst_reg, src_reg));
536+
if (off)
537+
EMIT(PPC_RAW_DIVD(dst_reg, dst_reg, src_reg));
538+
else
539+
EMIT(PPC_RAW_DIVDU(dst_reg, dst_reg, src_reg));
527540
break;
528541
case BPF_ALU | BPF_MOD | BPF_K: /* (u32) dst %= (u32) imm */
529542
case BPF_ALU | BPF_DIV | BPF_K: /* (u32) dst /= (u32) imm */
@@ -544,19 +557,31 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
544557
switch (BPF_CLASS(code)) {
545558
case BPF_ALU:
546559
if (BPF_OP(code) == BPF_MOD) {
547-
EMIT(PPC_RAW_DIVWU(tmp2_reg, dst_reg, tmp1_reg));
560+
if (off)
561+
EMIT(PPC_RAW_DIVW(tmp2_reg, dst_reg, tmp1_reg));
562+
else
563+
EMIT(PPC_RAW_DIVWU(tmp2_reg, dst_reg, tmp1_reg));
548564
EMIT(PPC_RAW_MULW(tmp1_reg, tmp1_reg, tmp2_reg));
549565
EMIT(PPC_RAW_SUB(dst_reg, dst_reg, tmp1_reg));
550566
} else
551-
EMIT(PPC_RAW_DIVWU(dst_reg, dst_reg, tmp1_reg));
567+
if (off)
568+
EMIT(PPC_RAW_DIVW(dst_reg, dst_reg, tmp1_reg));
569+
else
570+
EMIT(PPC_RAW_DIVWU(dst_reg, dst_reg, tmp1_reg));
552571
break;
553572
case BPF_ALU64:
554573
if (BPF_OP(code) == BPF_MOD) {
555-
EMIT(PPC_RAW_DIVDU(tmp2_reg, dst_reg, tmp1_reg));
574+
if (off)
575+
EMIT(PPC_RAW_DIVD(tmp2_reg, dst_reg, tmp1_reg));
576+
else
577+
EMIT(PPC_RAW_DIVDU(tmp2_reg, dst_reg, tmp1_reg));
556578
EMIT(PPC_RAW_MULD(tmp1_reg, tmp1_reg, tmp2_reg));
557579
EMIT(PPC_RAW_SUB(dst_reg, dst_reg, tmp1_reg));
558580
} else
559-
EMIT(PPC_RAW_DIVDU(dst_reg, dst_reg, tmp1_reg));
581+
if (off)
582+
EMIT(PPC_RAW_DIVD(dst_reg, dst_reg, tmp1_reg));
583+
else
584+
EMIT(PPC_RAW_DIVDU(dst_reg, dst_reg, tmp1_reg));
560585
break;
561586
}
562587
goto bpf_alu32_trunc;
@@ -676,8 +701,14 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
676701
/* special mov32 for zext */
677702
EMIT(PPC_RAW_RLWINM(dst_reg, dst_reg, 0, 0, 31));
678703
break;
679-
}
680-
EMIT(PPC_RAW_MR(dst_reg, src_reg));
704+
} else if (off == 8) {
705+
EMIT(PPC_RAW_EXTSB(dst_reg, src_reg));
706+
} else if (off == 16) {
707+
EMIT(PPC_RAW_EXTSH(dst_reg, src_reg));
708+
} else if (off == 32) {
709+
EMIT(PPC_RAW_EXTSW(dst_reg, src_reg));
710+
} else if (dst_reg != src_reg)
711+
EMIT(PPC_RAW_MR(dst_reg, src_reg));
681712
goto bpf_alu32_trunc;
682713
case BPF_ALU | BPF_MOV | BPF_K: /* (u32) dst = imm */
683714
case BPF_ALU64 | BPF_MOV | BPF_K: /* dst = (s64) imm */
@@ -699,11 +730,12 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
699730
*/
700731
case BPF_ALU | BPF_END | BPF_FROM_LE:
701732
case BPF_ALU | BPF_END | BPF_FROM_BE:
733+
case BPF_ALU64 | BPF_END | BPF_FROM_LE:
702734
#ifdef __BIG_ENDIAN__
703735
if (BPF_SRC(code) == BPF_FROM_BE)
704736
goto emit_clear;
705737
#else /* !__BIG_ENDIAN__ */
706-
if (BPF_SRC(code) == BPF_FROM_LE)
738+
if (BPF_CLASS(code) == BPF_ALU && BPF_SRC(code) == BPF_FROM_LE)
707739
goto emit_clear;
708740
#endif
709741
switch (imm) {
@@ -936,13 +968,19 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
936968
*/
937969
/* dst = *(u8 *)(ul) (src + off) */
938970
case BPF_LDX | BPF_MEM | BPF_B:
971+
case BPF_LDX | BPF_MEMSX | BPF_B:
939972
case BPF_LDX | BPF_PROBE_MEM | BPF_B:
973+
case BPF_LDX | BPF_PROBE_MEMSX | BPF_B:
940974
/* dst = *(u16 *)(ul) (src + off) */
941975
case BPF_LDX | BPF_MEM | BPF_H:
976+
case BPF_LDX | BPF_MEMSX | BPF_H:
942977
case BPF_LDX | BPF_PROBE_MEM | BPF_H:
978+
case BPF_LDX | BPF_PROBE_MEMSX | BPF_H:
943979
/* dst = *(u32 *)(ul) (src + off) */
944980
case BPF_LDX | BPF_MEM | BPF_W:
981+
case BPF_LDX | BPF_MEMSX | BPF_W:
945982
case BPF_LDX | BPF_PROBE_MEM | BPF_W:
983+
case BPF_LDX | BPF_PROBE_MEMSX | BPF_W:
946984
/* dst = *(u64 *)(ul) (src + off) */
947985
case BPF_LDX | BPF_MEM | BPF_DW:
948986
case BPF_LDX | BPF_PROBE_MEM | BPF_DW:
@@ -952,7 +990,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
952990
* load only if addr is kernel address (see is_kernel_addr()), otherwise
953991
* set dst_reg=0 and move on.
954992
*/
955-
if (BPF_MODE(code) == BPF_PROBE_MEM) {
993+
if (BPF_MODE(code) == BPF_PROBE_MEM || BPF_MODE(code) == BPF_PROBE_MEMSX) {
956994
EMIT(PPC_RAW_ADDI(tmp1_reg, src_reg, off));
957995
if (IS_ENABLED(CONFIG_PPC_BOOK3E_64))
958996
PPC_LI64(tmp2_reg, 0x8000000000000000ul);
@@ -965,30 +1003,47 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
9651003
* Check if 'off' is word aligned for BPF_DW, because
9661004
* we might generate two instructions.
9671005
*/
968-
if (BPF_SIZE(code) == BPF_DW && (off & 3))
1006+
if ((BPF_SIZE(code) == BPF_DW ||
1007+
(BPF_SIZE(code) == BPF_B && BPF_MODE(code) == BPF_PROBE_MEMSX)) &&
1008+
(off & 3))
9691009
PPC_JMP((ctx->idx + 3) * 4);
9701010
else
9711011
PPC_JMP((ctx->idx + 2) * 4);
9721012
}
9731013

974-
switch (size) {
975-
case BPF_B:
976-
EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
977-
break;
978-
case BPF_H:
979-
EMIT(PPC_RAW_LHZ(dst_reg, src_reg, off));
980-
break;
981-
case BPF_W:
982-
EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off));
983-
break;
984-
case BPF_DW:
985-
if (off % 4) {
986-
EMIT(PPC_RAW_LI(tmp1_reg, off));
987-
EMIT(PPC_RAW_LDX(dst_reg, src_reg, tmp1_reg));
988-
} else {
989-
EMIT(PPC_RAW_LD(dst_reg, src_reg, off));
1014+
if (BPF_MODE(code) == BPF_MEMSX || BPF_MODE(code) == BPF_PROBE_MEMSX) {
1015+
switch (size) {
1016+
case BPF_B:
1017+
EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
1018+
EMIT(PPC_RAW_EXTSB(dst_reg, dst_reg));
1019+
break;
1020+
case BPF_H:
1021+
EMIT(PPC_RAW_LHA(dst_reg, src_reg, off));
1022+
break;
1023+
case BPF_W:
1024+
EMIT(PPC_RAW_LWA(dst_reg, src_reg, off));
1025+
break;
1026+
}
1027+
} else {
1028+
switch (size) {
1029+
case BPF_B:
1030+
EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
1031+
break;
1032+
case BPF_H:
1033+
EMIT(PPC_RAW_LHZ(dst_reg, src_reg, off));
1034+
break;
1035+
case BPF_W:
1036+
EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off));
1037+
break;
1038+
case BPF_DW:
1039+
if (off % 4) {
1040+
EMIT(PPC_RAW_LI(tmp1_reg, off));
1041+
EMIT(PPC_RAW_LDX(dst_reg, src_reg, tmp1_reg));
1042+
} else {
1043+
EMIT(PPC_RAW_LD(dst_reg, src_reg, off));
1044+
}
1045+
break;
9901046
}
991-
break;
9921047
}
9931048

9941049
if (size != BPF_DW && insn_is_zext(&insn[i + 1]))
@@ -1065,6 +1120,9 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
10651120
case BPF_JMP | BPF_JA:
10661121
PPC_JMP(addrs[i + 1 + off]);
10671122
break;
1123+
case BPF_JMP32 | BPF_JA:
1124+
PPC_JMP(addrs[i + 1 + imm]);
1125+
break;
10681126

10691127
case BPF_JMP | BPF_JGT | BPF_K:
10701128
case BPF_JMP | BPF_JGT | BPF_X:

arch/powerpc/platforms/Kconfig.cputype

-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ config TARGET_CPU
250250
default "e6500" if E6500_CPU
251251
default "power4" if POWERPC64_CPU && !CPU_LITTLE_ENDIAN
252252
default "power8" if POWERPC64_CPU && CPU_LITTLE_ENDIAN
253-
default "405" if 405_CPU
254253
default "440" if 440_CPU
255254
default "464" if 464_CPU
256255
default "476" if 476_CPU

arch/powerpc/xmon/ppc-dis.c

+11-22
Original file line numberDiff line numberDiff line change
@@ -122,32 +122,21 @@ int print_insn_powerpc (unsigned long insn, unsigned long memaddr)
122122
bool insn_is_short;
123123
ppc_cpu_t dialect;
124124

125-
dialect = PPC_OPCODE_PPC | PPC_OPCODE_COMMON
126-
| PPC_OPCODE_64 | PPC_OPCODE_POWER4 | PPC_OPCODE_ALTIVEC;
125+
dialect = PPC_OPCODE_PPC | PPC_OPCODE_COMMON;
127126

128-
if (cpu_has_feature(CPU_FTRS_POWER5))
129-
dialect |= PPC_OPCODE_POWER5;
127+
if (IS_ENABLED(CONFIG_PPC64))
128+
dialect |= PPC_OPCODE_64 | PPC_OPCODE_POWER4 | PPC_OPCODE_CELL |
129+
PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_POWER7 | PPC_OPCODE_POWER8 |
130+
PPC_OPCODE_POWER9;
130131

131-
if (cpu_has_feature(CPU_FTRS_CELL))
132-
dialect |= (PPC_OPCODE_CELL | PPC_OPCODE_ALTIVEC);
132+
if (cpu_has_feature(CPU_FTR_TM))
133+
dialect |= PPC_OPCODE_HTM;
133134

134-
if (cpu_has_feature(CPU_FTRS_POWER6))
135-
dialect |= (PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_ALTIVEC);
135+
if (cpu_has_feature(CPU_FTR_ALTIVEC))
136+
dialect |= PPC_OPCODE_ALTIVEC | PPC_OPCODE_ALTIVEC2;
136137

137-
if (cpu_has_feature(CPU_FTRS_POWER7))
138-
dialect |= (PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_POWER7
139-
| PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX);
140-
141-
if (cpu_has_feature(CPU_FTRS_POWER8))
142-
dialect |= (PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_POWER7
143-
| PPC_OPCODE_POWER8 | PPC_OPCODE_HTM
144-
| PPC_OPCODE_ALTIVEC | PPC_OPCODE_ALTIVEC2 | PPC_OPCODE_VSX);
145-
146-
if (cpu_has_feature(CPU_FTRS_POWER9))
147-
dialect |= (PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_POWER7
148-
| PPC_OPCODE_POWER8 | PPC_OPCODE_POWER9 | PPC_OPCODE_HTM
149-
| PPC_OPCODE_ALTIVEC | PPC_OPCODE_ALTIVEC2
150-
| PPC_OPCODE_VSX | PPC_OPCODE_VSX3);
138+
if (cpu_has_feature(CPU_FTR_VSX))
139+
dialect |= PPC_OPCODE_VSX | PPC_OPCODE_VSX3;
151140

152141
/* Get the major opcode of the insn. */
153142
opcode = NULL;

drivers/macintosh/therm_windtunnel.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ g4fan_exit( void )
549549
platform_driver_unregister( &therm_of_driver );
550550

551551
if( x.of_dev )
552-
of_device_unregister( x.of_dev );
552+
of_platform_device_destroy(&x.of_dev->dev, NULL);
553553
}
554554

555555
module_init(g4fan_init);

0 commit comments

Comments
 (0)