aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-11-02 12:19:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-11-02 12:19:35 -0400
commitb69f9e17a57a50bc34d88975afce4425086e525d (patch)
tree98ffa23074e679c508e1ea1eea42ec0e16080b55 /tools/testing
parent63c6e188f639b5828bf744e675270bb5e2adc139 (diff)
parent1936f094e164cc13ebf17aba1d6b34e033e64188 (diff)
Merge tag 'powerpc-4.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "Some things that I missed due to travel, or that came in late. Two fixes also going to stable: - A revert of a buggy change to the 8xx TLB miss handlers. - Our flushing of SPE (Signal Processing Engine) registers on fork was broken. Other changes: - A change to the KVM decrementer emulation to use proper APIs. - Some cleanups to the way we do code patching in the 8xx code. - Expose the maximum possible memory for the system in /proc/powerpc/lparcfg. - Merge some updates from Scott: "a couple device tree updates, and a fix for a missing prototype warning" A few other minor fixes and a handful of fixes for our selftests. Thanks to: Aravinda Prasad, Breno Leitao, Camelia Groza, Christophe Leroy, Felipe Rechia, Joel Stanley, Naveen N. Rao, Paul Mackerras, Scott Wood, Tyrel Datwyler" * tag 'powerpc-4.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (21 commits) selftests/powerpc: Fix compilation issue due to asm label selftests/powerpc/cache_shape: Fix out-of-tree build selftests/powerpc/switch_endian: Fix out-of-tree build selftests/powerpc/pmu: Link ebb tests with -no-pie selftests/powerpc/signal: Fix out-of-tree build selftests/powerpc/ptrace: Fix out-of-tree build powerpc/xmon: Relax frame size for clang selftests: powerpc: Fix warning for security subdir selftests/powerpc: Relax L1d miss targets for rfi_flush test powerpc/process: Fix flush_all_to_thread for SPE powerpc/pseries: add missing cpumask.h include file selftests/powerpc: Fix ptrace tm failure KVM: PPC: Use exported tb_to_ns() function in decrementer emulation powerpc/pseries: Export maximum memory value powerpc/8xx: Use patch_site for perf counters setup powerpc/8xx: Use patch_site for memory setup patching powerpc/code-patching: Add a helper to get the address of a patch_site Revert "powerpc/8xx: Use L1 entry APG to handle _PAGE_ACCESSED for CONFIG_SWAP" powerpc/8xx: add missing header in 8xx_mmu.c powerpc/8xx: Add DT node for using the SEC engine of the MPC885 ...
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/powerpc/cache_shape/Makefile9
-rw-r--r--tools/testing/selftests/powerpc/pmu/ebb/Makefile3
-rw-r--r--tools/testing/selftests/powerpc/ptrace/Makefile13
-rw-r--r--tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c4
-rw-r--r--tools/testing/selftests/powerpc/security/Makefile1
-rw-r--r--tools/testing/selftests/powerpc/security/rfi_flush.c18
-rw-r--r--tools/testing/selftests/powerpc/signal/Makefile11
-rw-r--r--tools/testing/selftests/powerpc/switch_endian/Makefile1
-rw-r--r--tools/testing/selftests/powerpc/utils.c6
9 files changed, 32 insertions, 34 deletions
diff --git a/tools/testing/selftests/powerpc/cache_shape/Makefile b/tools/testing/selftests/powerpc/cache_shape/Makefile
index ede4d3dae750..689f6c8ebcd8 100644
--- a/tools/testing/selftests/powerpc/cache_shape/Makefile
+++ b/tools/testing/selftests/powerpc/cache_shape/Makefile
@@ -1,12 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2TEST_PROGS := cache_shape 2TEST_GEN_PROGS := cache_shape
3
4all: $(TEST_PROGS)
5
6$(TEST_PROGS): ../harness.c ../utils.c
7 3
8top_srcdir = ../../../../.. 4top_srcdir = ../../../../..
9include ../../lib.mk 5include ../../lib.mk
10 6
11clean: 7$(TEST_GEN_PROGS): ../harness.c ../utils.c
12 rm -f $(TEST_PROGS) *.o
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/Makefile b/tools/testing/selftests/powerpc/pmu/ebb/Makefile
index bd5dfa509272..23f4caf48ffc 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/Makefile
+++ b/tools/testing/selftests/powerpc/pmu/ebb/Makefile
@@ -5,6 +5,9 @@ noarg:
5# The EBB handler is 64-bit code and everything links against it 5# The EBB handler is 64-bit code and everything links against it
6CFLAGS += -m64 6CFLAGS += -m64
7 7
8# Toolchains may build PIE by default which breaks the assembly
9LDFLAGS += -no-pie
10
8TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test \ 11TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test \
9 cycles_with_freeze_test pmc56_overflow_test \ 12 cycles_with_freeze_test pmc56_overflow_test \
10 ebb_vs_cpu_event_test cpu_event_vs_ebb_test \ 13 ebb_vs_cpu_event_test cpu_event_vs_ebb_test \
diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile
index 9b35ca8e8f13..8d3f006c98cc 100644
--- a/tools/testing/selftests/powerpc/ptrace/Makefile
+++ b/tools/testing/selftests/powerpc/ptrace/Makefile
@@ -1,5 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2TEST_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \ 2TEST_GEN_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
3 ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \ 3 ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \
4 ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak ptrace-pkey core-pkey \ 4 ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak ptrace-pkey core-pkey \
5 perf-hwbreak ptrace-syscall 5 perf-hwbreak ptrace-syscall
@@ -7,14 +7,9 @@ TEST_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
7top_srcdir = ../../../../.. 7top_srcdir = ../../../../..
8include ../../lib.mk 8include ../../lib.mk
9 9
10all: $(TEST_PROGS)
11
12CFLAGS += -m64 -I../../../../../usr/include -I../tm -mhtm -fno-pie 10CFLAGS += -m64 -I../../../../../usr/include -I../tm -mhtm -fno-pie
13 11
14ptrace-pkey core-pkey: child.h 12$(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: child.h
15ptrace-pkey core-pkey: LDLIBS += -pthread 13$(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread
16
17$(TEST_PROGS): ../harness.c ../utils.c ../lib/reg.S ptrace.h
18 14
19clean: 15$(TEST_GEN_PROGS): ../harness.c ../utils.c ../lib/reg.S ptrace.h
20 rm -f $(TEST_PROGS) *.o
diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c
index 327fa943c7f3..dbdffa2e2c82 100644
--- a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c
+++ b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c
@@ -67,8 +67,8 @@ trans:
67 "3: ;" 67 "3: ;"
68 : [res] "=r" (result), [texasr] "=r" (texasr) 68 : [res] "=r" (result), [texasr] "=r" (texasr)
69 : [gpr_1]"i"(GPR_1), [gpr_2]"i"(GPR_2), [gpr_4]"i"(GPR_4), 69 : [gpr_1]"i"(GPR_1), [gpr_2]"i"(GPR_2), [gpr_4]"i"(GPR_4),
70 [sprn_texasr] "i" (SPRN_TEXASR), [flt_1] "r" (&a), 70 [sprn_texasr] "i" (SPRN_TEXASR), [flt_1] "b" (&a),
71 [flt_2] "r" (&b), [flt_4] "r" (&d) 71 [flt_4] "b" (&d)
72 : "memory", "r5", "r6", "r7", 72 : "memory", "r5", "r6", "r7",
73 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", 73 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
74 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", 74 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
diff --git a/tools/testing/selftests/powerpc/security/Makefile b/tools/testing/selftests/powerpc/security/Makefile
index 44690f1bb26a..85861c46b445 100644
--- a/tools/testing/selftests/powerpc/security/Makefile
+++ b/tools/testing/selftests/powerpc/security/Makefile
@@ -1,6 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0+ 1# SPDX-License-Identifier: GPL-2.0+
2 2
3TEST_GEN_PROGS := rfi_flush 3TEST_GEN_PROGS := rfi_flush
4top_srcdir = ../../../../..
4 5
5CFLAGS += -I../../../../../usr/include 6CFLAGS += -I../../../../../usr/include
6 7
diff --git a/tools/testing/selftests/powerpc/security/rfi_flush.c b/tools/testing/selftests/powerpc/security/rfi_flush.c
index 564ed45bbf73..0a7d0afb26b8 100644
--- a/tools/testing/selftests/powerpc/security/rfi_flush.c
+++ b/tools/testing/selftests/powerpc/security/rfi_flush.c
@@ -49,6 +49,7 @@ int rfi_flush_test(void)
49 struct perf_event_read v; 49 struct perf_event_read v;
50 __u64 l1d_misses_total = 0; 50 __u64 l1d_misses_total = 0;
51 unsigned long iterations = 100000, zero_size = 24 * 1024; 51 unsigned long iterations = 100000, zero_size = 24 * 1024;
52 unsigned long l1d_misses_expected;
52 int rfi_flush_org, rfi_flush; 53 int rfi_flush_org, rfi_flush;
53 54
54 SKIP_IF(geteuid() != 0); 55 SKIP_IF(geteuid() != 0);
@@ -71,6 +72,12 @@ int rfi_flush_test(void)
71 72
72 iter = repetitions; 73 iter = repetitions;
73 74
75 /*
76 * We expect to see l1d miss for each cacheline access when rfi_flush
77 * is set. Allow a small variation on this.
78 */
79 l1d_misses_expected = iterations * (zero_size / CACHELINE_SIZE - 2);
80
74again: 81again:
75 FAIL_IF(perf_event_reset(fd)); 82 FAIL_IF(perf_event_reset(fd));
76 83
@@ -78,10 +85,9 @@ again:
78 85
79 FAIL_IF(read(fd, &v, sizeof(v)) != sizeof(v)); 86 FAIL_IF(read(fd, &v, sizeof(v)) != sizeof(v));
80 87
81 /* Expect at least zero_size/CACHELINE_SIZE misses per iteration */ 88 if (rfi_flush && v.l1d_misses >= l1d_misses_expected)
82 if (v.l1d_misses >= (iterations * zero_size / CACHELINE_SIZE) && rfi_flush)
83 passes++; 89 passes++;
84 else if (v.l1d_misses < iterations && !rfi_flush) 90 else if (!rfi_flush && v.l1d_misses < (l1d_misses_expected / 2))
85 passes++; 91 passes++;
86 92
87 l1d_misses_total += v.l1d_misses; 93 l1d_misses_total += v.l1d_misses;
@@ -92,13 +98,15 @@ again:
92 if (passes < repetitions) { 98 if (passes < repetitions) {
93 printf("FAIL (L1D misses with rfi_flush=%d: %llu %c %lu) [%d/%d failures]\n", 99 printf("FAIL (L1D misses with rfi_flush=%d: %llu %c %lu) [%d/%d failures]\n",
94 rfi_flush, l1d_misses_total, rfi_flush ? '<' : '>', 100 rfi_flush, l1d_misses_total, rfi_flush ? '<' : '>',
95 rfi_flush ? (repetitions * iterations * zero_size / CACHELINE_SIZE) : iterations, 101 rfi_flush ? repetitions * l1d_misses_expected :
102 repetitions * l1d_misses_expected / 2,
96 repetitions - passes, repetitions); 103 repetitions - passes, repetitions);
97 rc = 1; 104 rc = 1;
98 } else 105 } else
99 printf("PASS (L1D misses with rfi_flush=%d: %llu %c %lu) [%d/%d pass]\n", 106 printf("PASS (L1D misses with rfi_flush=%d: %llu %c %lu) [%d/%d pass]\n",
100 rfi_flush, l1d_misses_total, rfi_flush ? '>' : '<', 107 rfi_flush, l1d_misses_total, rfi_flush ? '>' : '<',
101 rfi_flush ? (repetitions * iterations * zero_size / CACHELINE_SIZE) : iterations, 108 rfi_flush ? repetitions * l1d_misses_expected :
109 repetitions * l1d_misses_expected / 2,
102 passes, repetitions); 110 passes, repetitions);
103 111
104 if (rfi_flush == rfi_flush_org) { 112 if (rfi_flush == rfi_flush_org) {
diff --git a/tools/testing/selftests/powerpc/signal/Makefile b/tools/testing/selftests/powerpc/signal/Makefile
index 1fca25c6ace0..209a958dca12 100644
--- a/tools/testing/selftests/powerpc/signal/Makefile
+++ b/tools/testing/selftests/powerpc/signal/Makefile
@@ -1,15 +1,10 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2TEST_PROGS := signal signal_tm 2TEST_GEN_PROGS := signal signal_tm
3
4all: $(TEST_PROGS)
5
6$(TEST_PROGS): ../harness.c ../utils.c signal.S
7 3
8CFLAGS += -maltivec 4CFLAGS += -maltivec
9signal_tm: CFLAGS += -mhtm 5$(OUTPUT)/signal_tm: CFLAGS += -mhtm
10 6
11top_srcdir = ../../../../.. 7top_srcdir = ../../../../..
12include ../../lib.mk 8include ../../lib.mk
13 9
14clean: 10$(TEST_GEN_PROGS): ../harness.c ../utils.c signal.S
15 rm -f $(TEST_PROGS) *.o
diff --git a/tools/testing/selftests/powerpc/switch_endian/Makefile b/tools/testing/selftests/powerpc/switch_endian/Makefile
index fcd2dcb8972b..bdc081afedb0 100644
--- a/tools/testing/selftests/powerpc/switch_endian/Makefile
+++ b/tools/testing/selftests/powerpc/switch_endian/Makefile
@@ -8,6 +8,7 @@ EXTRA_CLEAN = $(OUTPUT)/*.o $(OUTPUT)/check-reversed.S
8top_srcdir = ../../../../.. 8top_srcdir = ../../../../..
9include ../../lib.mk 9include ../../lib.mk
10 10
11$(OUTPUT)/switch_endian_test: ASFLAGS += -I $(OUTPUT)
11$(OUTPUT)/switch_endian_test: $(OUTPUT)/check-reversed.S 12$(OUTPUT)/switch_endian_test: $(OUTPUT)/check-reversed.S
12 13
13$(OUTPUT)/check-reversed.o: $(OUTPUT)/check.o 14$(OUTPUT)/check-reversed.o: $(OUTPUT)/check.o
diff --git a/tools/testing/selftests/powerpc/utils.c b/tools/testing/selftests/powerpc/utils.c
index 43c342845be0..ed62f4153d3e 100644
--- a/tools/testing/selftests/powerpc/utils.c
+++ b/tools/testing/selftests/powerpc/utils.c
@@ -25,7 +25,6 @@
25#include "utils.h" 25#include "utils.h"
26 26
27static char auxv[4096]; 27static char auxv[4096];
28extern unsigned int dscr_insn[];
29 28
30int read_auxv(char *buf, ssize_t buf_size) 29int read_auxv(char *buf, ssize_t buf_size)
31{ 30{
@@ -247,7 +246,8 @@ static void sigill_handler(int signr, siginfo_t *info, void *unused)
247 ucontext_t *ctx = (ucontext_t *)unused; 246 ucontext_t *ctx = (ucontext_t *)unused;
248 unsigned long *pc = &UCONTEXT_NIA(ctx); 247 unsigned long *pc = &UCONTEXT_NIA(ctx);
249 248
250 if (*pc == (unsigned long)&dscr_insn) { 249 /* mtspr 3,RS to check for move to DSCR below */
250 if ((*((unsigned int *)*pc) & 0xfc1fffff) == 0x7c0303a6) {
251 if (!warned++) 251 if (!warned++)
252 printf("WARNING: Skipping over dscr setup. Consider running 'ppc64_cpu --dscr=1' manually.\n"); 252 printf("WARNING: Skipping over dscr setup. Consider running 'ppc64_cpu --dscr=1' manually.\n");
253 *pc += 4; 253 *pc += 4;
@@ -271,5 +271,5 @@ void set_dscr(unsigned long val)
271 init = 1; 271 init = 1;
272 } 272 }
273 273
274 asm volatile("dscr_insn: mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR)); 274 asm volatile("mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR));
275} 275}