aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/testing/selftests/powerpc/pmu/ebb/Makefile2
-rw-r--r--tools/testing/selftests/powerpc/pmu/ebb/busy_loop.S271
-rw-r--r--tools/testing/selftests/powerpc/pmu/ebb/ebb.c251
-rw-r--r--tools/testing/selftests/powerpc/pmu/ebb/ebb.h1
4 files changed, 272 insertions, 253 deletions
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/Makefile b/tools/testing/selftests/powerpc/pmu/ebb/Makefile
index edbba2affc2c..251447eafe49 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/Makefile
+++ b/tools/testing/selftests/powerpc/pmu/ebb/Makefile
@@ -17,7 +17,7 @@ PROGS := reg_access_test event_attributes_test cycles_test \
17 17
18all: $(PROGS) 18all: $(PROGS)
19 19
20$(PROGS): ../../harness.c ../event.c ../lib.c ebb.c ebb_handler.S trace.c 20$(PROGS): ../../harness.c ../event.c ../lib.c ebb.c ebb_handler.S trace.c busy_loop.S
21 21
22instruction_count_test: ../loop.S 22instruction_count_test: ../loop.S
23 23
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/busy_loop.S b/tools/testing/selftests/powerpc/pmu/ebb/busy_loop.S
new file mode 100644
index 000000000000..c7e4093f1cd3
--- /dev/null
+++ b/tools/testing/selftests/powerpc/pmu/ebb/busy_loop.S
@@ -0,0 +1,271 @@
1/*
2 * Copyright 2014, Michael Ellerman, IBM Corp.
3 * Licensed under GPLv2.
4 */
5
6#include <ppc-asm.h>
7
8 .text
9
10FUNC_START(core_busy_loop)
11 stdu %r1, -168(%r1)
12 std r14, 160(%r1)
13 std r15, 152(%r1)
14 std r16, 144(%r1)
15 std r17, 136(%r1)
16 std r18, 128(%r1)
17 std r19, 120(%r1)
18 std r20, 112(%r1)
19 std r21, 104(%r1)
20 std r22, 96(%r1)
21 std r23, 88(%r1)
22 std r24, 80(%r1)
23 std r25, 72(%r1)
24 std r26, 64(%r1)
25 std r27, 56(%r1)
26 std r28, 48(%r1)
27 std r29, 40(%r1)
28 std r30, 32(%r1)
29 std r31, 24(%r1)
30
31 li r3, 0x3030
32 std r3, -96(%r1)
33 li r4, 0x4040
34 std r4, -104(%r1)
35 li r5, 0x5050
36 std r5, -112(%r1)
37 li r6, 0x6060
38 std r6, -120(%r1)
39 li r7, 0x7070
40 std r7, -128(%r1)
41 li r8, 0x0808
42 std r8, -136(%r1)
43 li r9, 0x0909
44 std r9, -144(%r1)
45 li r10, 0x1010
46 std r10, -152(%r1)
47 li r11, 0x1111
48 std r11, -160(%r1)
49 li r14, 0x1414
50 std r14, -168(%r1)
51 li r15, 0x1515
52 std r15, -176(%r1)
53 li r16, 0x1616
54 std r16, -184(%r1)
55 li r17, 0x1717
56 std r17, -192(%r1)
57 li r18, 0x1818
58 std r18, -200(%r1)
59 li r19, 0x1919
60 std r19, -208(%r1)
61 li r20, 0x2020
62 std r20, -216(%r1)
63 li r21, 0x2121
64 std r21, -224(%r1)
65 li r22, 0x2222
66 std r22, -232(%r1)
67 li r23, 0x2323
68 std r23, -240(%r1)
69 li r24, 0x2424
70 std r24, -248(%r1)
71 li r25, 0x2525
72 std r25, -256(%r1)
73 li r26, 0x2626
74 std r26, -264(%r1)
75 li r27, 0x2727
76 std r27, -272(%r1)
77 li r28, 0x2828
78 std r28, -280(%r1)
79 li r29, 0x2929
80 std r29, -288(%r1)
81 li r30, 0x3030
82 li r31, 0x3131
83
84 li r3, 0
850: addi r3, r3, 1
86 cmpwi r3, 100
87 blt 0b
88
89 /* Return 1 (fail) unless we get through all the checks */
90 li r3, 1
91
92 /* Check none of our registers have been corrupted */
93 cmpwi r4, 0x4040
94 bne 1f
95 cmpwi r5, 0x5050
96 bne 1f
97 cmpwi r6, 0x6060
98 bne 1f
99 cmpwi r7, 0x7070
100 bne 1f
101 cmpwi r8, 0x0808
102 bne 1f
103 cmpwi r9, 0x0909
104 bne 1f
105 cmpwi r10, 0x1010
106 bne 1f
107 cmpwi r11, 0x1111
108 bne 1f
109 cmpwi r14, 0x1414
110 bne 1f
111 cmpwi r15, 0x1515
112 bne 1f
113 cmpwi r16, 0x1616
114 bne 1f
115 cmpwi r17, 0x1717
116 bne 1f
117 cmpwi r18, 0x1818
118 bne 1f
119 cmpwi r19, 0x1919
120 bne 1f
121 cmpwi r20, 0x2020
122 bne 1f
123 cmpwi r21, 0x2121
124 bne 1f
125 cmpwi r22, 0x2222
126 bne 1f
127 cmpwi r23, 0x2323
128 bne 1f
129 cmpwi r24, 0x2424
130 bne 1f
131 cmpwi r25, 0x2525
132 bne 1f
133 cmpwi r26, 0x2626
134 bne 1f
135 cmpwi r27, 0x2727
136 bne 1f
137 cmpwi r28, 0x2828
138 bne 1f
139 cmpwi r29, 0x2929
140 bne 1f
141 cmpwi r30, 0x3030
142 bne 1f
143 cmpwi r31, 0x3131
144 bne 1f
145
146 /* Load junk into all our registers before we reload them from the stack. */
147 li r3, 0xde
148 li r4, 0xad
149 li r5, 0xbe
150 li r6, 0xef
151 li r7, 0xde
152 li r8, 0xad
153 li r9, 0xbe
154 li r10, 0xef
155 li r11, 0xde
156 li r14, 0xad
157 li r15, 0xbe
158 li r16, 0xef
159 li r17, 0xde
160 li r18, 0xad
161 li r19, 0xbe
162 li r20, 0xef
163 li r21, 0xde
164 li r22, 0xad
165 li r23, 0xbe
166 li r24, 0xef
167 li r25, 0xde
168 li r26, 0xad
169 li r27, 0xbe
170 li r28, 0xef
171 li r29, 0xdd
172
173 ld r3, -96(%r1)
174 cmpwi r3, 0x3030
175 bne 1f
176 ld r4, -104(%r1)
177 cmpwi r4, 0x4040
178 bne 1f
179 ld r5, -112(%r1)
180 cmpwi r5, 0x5050
181 bne 1f
182 ld r6, -120(%r1)
183 cmpwi r6, 0x6060
184 bne 1f
185 ld r7, -128(%r1)
186 cmpwi r7, 0x7070
187 bne 1f
188 ld r8, -136(%r1)
189 cmpwi r8, 0x0808
190 bne 1f
191 ld r9, -144(%r1)
192 cmpwi r9, 0x0909
193 bne 1f
194 ld r10, -152(%r1)
195 cmpwi r10, 0x1010
196 bne 1f
197 ld r11, -160(%r1)
198 cmpwi r11, 0x1111
199 bne 1f
200 ld r14, -168(%r1)
201 cmpwi r14, 0x1414
202 bne 1f
203 ld r15, -176(%r1)
204 cmpwi r15, 0x1515
205 bne 1f
206 ld r16, -184(%r1)
207 cmpwi r16, 0x1616
208 bne 1f
209 ld r17, -192(%r1)
210 cmpwi r17, 0x1717
211 bne 1f
212 ld r18, -200(%r1)
213 cmpwi r18, 0x1818
214 bne 1f
215 ld r19, -208(%r1)
216 cmpwi r19, 0x1919
217 bne 1f
218 ld r20, -216(%r1)
219 cmpwi r20, 0x2020
220 bne 1f
221 ld r21, -224(%r1)
222 cmpwi r21, 0x2121
223 bne 1f
224 ld r22, -232(%r1)
225 cmpwi r22, 0x2222
226 bne 1f
227 ld r23, -240(%r1)
228 cmpwi r23, 0x2323
229 bne 1f
230 ld r24, -248(%r1)
231 cmpwi r24, 0x2424
232 bne 1f
233 ld r25, -256(%r1)
234 cmpwi r25, 0x2525
235 bne 1f
236 ld r26, -264(%r1)
237 cmpwi r26, 0x2626
238 bne 1f
239 ld r27, -272(%r1)
240 cmpwi r27, 0x2727
241 bne 1f
242 ld r28, -280(%r1)
243 cmpwi r28, 0x2828
244 bne 1f
245 ld r29, -288(%r1)
246 cmpwi r29, 0x2929
247 bne 1f
248
249 /* Load 0 (success) to return */
250 li r3, 0
251
2521: ld r14, 160(%r1)
253 ld r15, 152(%r1)
254 ld r16, 144(%r1)
255 ld r17, 136(%r1)
256 ld r18, 128(%r1)
257 ld r19, 120(%r1)
258 ld r20, 112(%r1)
259 ld r21, 104(%r1)
260 ld r22, 96(%r1)
261 ld r23, 88(%r1)
262 ld r24, 80(%r1)
263 ld r25, 72(%r1)
264 ld r26, 64(%r1)
265 ld r27, 56(%r1)
266 ld r28, 48(%r1)
267 ld r29, 40(%r1)
268 ld r30, 32(%r1)
269 ld r31, 24(%r1)
270 addi %r1, %r1, 168
271 blr
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
index 1b46be94b64c..b7ee607c0fca 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
+++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
@@ -335,257 +335,6 @@ void event_leader_ebb_init(struct event *e)
335 e->attr.pinned = 1; 335 e->attr.pinned = 1;
336} 336}
337 337
338int core_busy_loop(void)
339{
340 int rc;
341
342 asm volatile (
343 "li 3, 0x3030\n"
344 "std 3, -96(1)\n"
345 "li 4, 0x4040\n"
346 "std 4, -104(1)\n"
347 "li 5, 0x5050\n"
348 "std 5, -112(1)\n"
349 "li 6, 0x6060\n"
350 "std 6, -120(1)\n"
351 "li 7, 0x7070\n"
352 "std 7, -128(1)\n"
353 "li 8, 0x0808\n"
354 "std 8, -136(1)\n"
355 "li 9, 0x0909\n"
356 "std 9, -144(1)\n"
357 "li 10, 0x1010\n"
358 "std 10, -152(1)\n"
359 "li 11, 0x1111\n"
360 "std 11, -160(1)\n"
361 "li 14, 0x1414\n"
362 "std 14, -168(1)\n"
363 "li 15, 0x1515\n"
364 "std 15, -176(1)\n"
365 "li 16, 0x1616\n"
366 "std 16, -184(1)\n"
367 "li 17, 0x1717\n"
368 "std 17, -192(1)\n"
369 "li 18, 0x1818\n"
370 "std 18, -200(1)\n"
371 "li 19, 0x1919\n"
372 "std 19, -208(1)\n"
373 "li 20, 0x2020\n"
374 "std 20, -216(1)\n"
375 "li 21, 0x2121\n"
376 "std 21, -224(1)\n"
377 "li 22, 0x2222\n"
378 "std 22, -232(1)\n"
379 "li 23, 0x2323\n"
380 "std 23, -240(1)\n"
381 "li 24, 0x2424\n"
382 "std 24, -248(1)\n"
383 "li 25, 0x2525\n"
384 "std 25, -256(1)\n"
385 "li 26, 0x2626\n"
386 "std 26, -264(1)\n"
387 "li 27, 0x2727\n"
388 "std 27, -272(1)\n"
389 "li 28, 0x2828\n"
390 "std 28, -280(1)\n"
391 "li 29, 0x2929\n"
392 "std 29, -288(1)\n"
393 "li 30, 0x3030\n"
394 "li 31, 0x3131\n"
395
396 "li 3, 0\n"
397 "0: "
398 "addi 3, 3, 1\n"
399 "cmpwi 3, 100\n"
400 "blt 0b\n"
401
402 /* Return 1 (fail) unless we get through all the checks */
403 "li 0, 1\n"
404
405 /* Check none of our registers have been corrupted */
406 "cmpwi 4, 0x4040\n"
407 "bne 1f\n"
408 "cmpwi 5, 0x5050\n"
409 "bne 1f\n"
410 "cmpwi 6, 0x6060\n"
411 "bne 1f\n"
412 "cmpwi 7, 0x7070\n"
413 "bne 1f\n"
414 "cmpwi 8, 0x0808\n"
415 "bne 1f\n"
416 "cmpwi 9, 0x0909\n"
417 "bne 1f\n"
418 "cmpwi 10, 0x1010\n"
419 "bne 1f\n"
420 "cmpwi 11, 0x1111\n"
421 "bne 1f\n"
422 "cmpwi 14, 0x1414\n"
423 "bne 1f\n"
424 "cmpwi 15, 0x1515\n"
425 "bne 1f\n"
426 "cmpwi 16, 0x1616\n"
427 "bne 1f\n"
428 "cmpwi 17, 0x1717\n"
429 "bne 1f\n"
430 "cmpwi 18, 0x1818\n"
431 "bne 1f\n"
432 "cmpwi 19, 0x1919\n"
433 "bne 1f\n"
434 "cmpwi 20, 0x2020\n"
435 "bne 1f\n"
436 "cmpwi 21, 0x2121\n"
437 "bne 1f\n"
438 "cmpwi 22, 0x2222\n"
439 "bne 1f\n"
440 "cmpwi 23, 0x2323\n"
441 "bne 1f\n"
442 "cmpwi 24, 0x2424\n"
443 "bne 1f\n"
444 "cmpwi 25, 0x2525\n"
445 "bne 1f\n"
446 "cmpwi 26, 0x2626\n"
447 "bne 1f\n"
448 "cmpwi 27, 0x2727\n"
449 "bne 1f\n"
450 "cmpwi 28, 0x2828\n"
451 "bne 1f\n"
452 "cmpwi 29, 0x2929\n"
453 "bne 1f\n"
454 "cmpwi 30, 0x3030\n"
455 "bne 1f\n"
456 "cmpwi 31, 0x3131\n"
457 "bne 1f\n"
458
459 /* Load junk into all our registers before we reload them from the stack. */
460 "li 3, 0xde\n"
461 "li 4, 0xad\n"
462 "li 5, 0xbe\n"
463 "li 6, 0xef\n"
464 "li 7, 0xde\n"
465 "li 8, 0xad\n"
466 "li 9, 0xbe\n"
467 "li 10, 0xef\n"
468 "li 11, 0xde\n"
469 "li 14, 0xad\n"
470 "li 15, 0xbe\n"
471 "li 16, 0xef\n"
472 "li 17, 0xde\n"
473 "li 18, 0xad\n"
474 "li 19, 0xbe\n"
475 "li 20, 0xef\n"
476 "li 21, 0xde\n"
477 "li 22, 0xad\n"
478 "li 23, 0xbe\n"
479 "li 24, 0xef\n"
480 "li 25, 0xde\n"
481 "li 26, 0xad\n"
482 "li 27, 0xbe\n"
483 "li 28, 0xef\n"
484 "li 29, 0xdd\n"
485
486 "ld 3, -96(1)\n"
487 "cmpwi 3, 0x3030\n"
488 "bne 1f\n"
489 "ld 4, -104(1)\n"
490 "cmpwi 4, 0x4040\n"
491 "bne 1f\n"
492 "ld 5, -112(1)\n"
493 "cmpwi 5, 0x5050\n"
494 "bne 1f\n"
495 "ld 6, -120(1)\n"
496 "cmpwi 6, 0x6060\n"
497 "bne 1f\n"
498 "ld 7, -128(1)\n"
499 "cmpwi 7, 0x7070\n"
500 "bne 1f\n"
501 "ld 8, -136(1)\n"
502 "cmpwi 8, 0x0808\n"
503 "bne 1f\n"
504 "ld 9, -144(1)\n"
505 "cmpwi 9, 0x0909\n"
506 "bne 1f\n"
507 "ld 10, -152(1)\n"
508 "cmpwi 10, 0x1010\n"
509 "bne 1f\n"
510 "ld 11, -160(1)\n"
511 "cmpwi 11, 0x1111\n"
512 "bne 1f\n"
513 "ld 14, -168(1)\n"
514 "cmpwi 14, 0x1414\n"
515 "bne 1f\n"
516 "ld 15, -176(1)\n"
517 "cmpwi 15, 0x1515\n"
518 "bne 1f\n"
519 "ld 16, -184(1)\n"
520 "cmpwi 16, 0x1616\n"
521 "bne 1f\n"
522 "ld 17, -192(1)\n"
523 "cmpwi 17, 0x1717\n"
524 "bne 1f\n"
525 "ld 18, -200(1)\n"
526 "cmpwi 18, 0x1818\n"
527 "bne 1f\n"
528 "ld 19, -208(1)\n"
529 "cmpwi 19, 0x1919\n"
530 "bne 1f\n"
531 "ld 20, -216(1)\n"
532 "cmpwi 20, 0x2020\n"
533 "bne 1f\n"
534 "ld 21, -224(1)\n"
535 "cmpwi 21, 0x2121\n"
536 "bne 1f\n"
537 "ld 22, -232(1)\n"
538 "cmpwi 22, 0x2222\n"
539 "bne 1f\n"
540 "ld 23, -240(1)\n"
541 "cmpwi 23, 0x2323\n"
542 "bne 1f\n"
543 "ld 24, -248(1)\n"
544 "cmpwi 24, 0x2424\n"
545 "bne 1f\n"
546 "ld 25, -256(1)\n"
547 "cmpwi 25, 0x2525\n"
548 "bne 1f\n"
549 "ld 26, -264(1)\n"
550 "cmpwi 26, 0x2626\n"
551 "bne 1f\n"
552 "ld 27, -272(1)\n"
553 "cmpwi 27, 0x2727\n"
554 "bne 1f\n"
555 "ld 28, -280(1)\n"
556 "cmpwi 28, 0x2828\n"
557 "bne 1f\n"
558 "ld 29, -288(1)\n"
559 "cmpwi 29, 0x2929\n"
560 "bne 1f\n"
561
562 /* Load 0 (success) to return */
563 "li 0, 0\n"
564
565 "1: mr %0, 0\n"
566
567 : "=r" (rc)
568 : /* no inputs */
569 : "3", "4", "5", "6", "7", "8", "9", "10", "11", "14",
570 "15", "16", "17", "18", "19", "20", "21", "22", "23",
571 "24", "25", "26", "27", "28", "29", "30", "31",
572 "memory"
573 );
574
575 return rc;
576}
577
578int core_busy_loop_with_freeze(void)
579{
580 int rc;
581
582 mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) & ~MMCR0_FC);
583 rc = core_busy_loop();
584 mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) | MMCR0_FC);
585
586 return rc;
587}
588
589int ebb_child(union pipe read_pipe, union pipe write_pipe) 338int ebb_child(union pipe read_pipe, union pipe write_pipe)
590{ 339{
591 struct event event; 340 struct event event;
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.h b/tools/testing/selftests/powerpc/pmu/ebb/ebb.h
index e62bde05bf78..e44eee5d97ca 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.h
+++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.h
@@ -70,7 +70,6 @@ int ebb_check_mmcr0(void);
70extern u64 sample_period; 70extern u64 sample_period;
71 71
72int core_busy_loop(void); 72int core_busy_loop(void);
73int core_busy_loop_with_freeze(void);
74int ebb_child(union pipe read_pipe, union pipe write_pipe); 73int ebb_child(union pipe read_pipe, union pipe write_pipe);
75int catch_sigill(void (*func)(void)); 74int catch_sigill(void (*func)(void));
76void write_pmc1(void); 75void write_pmc1(void);