diff options
Diffstat (limited to 'tools/testing/selftests/powerpc/pmu/ebb/ebb.c')
-rw-r--r-- | tools/testing/selftests/powerpc/pmu/ebb/ebb.c | 261 |
1 files changed, 6 insertions, 255 deletions
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c index 1b46be94b64c..d7a72ce696b5 100644 --- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c +++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c @@ -224,6 +224,7 @@ void dump_ebb_hw_state(void) printf("HW state:\n" \ "MMCR0 0x%016x %s\n" \ + "MMCR2 0x%016lx\n" \ "EBBHR 0x%016lx\n" \ "BESCR 0x%016llx %s\n" \ "PMC1 0x%016lx\n" \ @@ -233,10 +234,11 @@ void dump_ebb_hw_state(void) "PMC5 0x%016lx\n" \ "PMC6 0x%016lx\n" \ "SIAR 0x%016lx\n", - mmcr0, decode_mmcr0(mmcr0), mfspr(SPRN_EBBHR), bescr, - decode_bescr(bescr), mfspr(SPRN_PMC1), mfspr(SPRN_PMC2), - mfspr(SPRN_PMC3), mfspr(SPRN_PMC4), mfspr(SPRN_PMC5), - mfspr(SPRN_PMC6), mfspr(SPRN_SIAR)); + mmcr0, decode_mmcr0(mmcr0), mfspr(SPRN_MMCR2), + mfspr(SPRN_EBBHR), bescr, decode_bescr(bescr), + mfspr(SPRN_PMC1), mfspr(SPRN_PMC2), mfspr(SPRN_PMC3), + mfspr(SPRN_PMC4), mfspr(SPRN_PMC5), mfspr(SPRN_PMC6), + mfspr(SPRN_SIAR)); } void dump_ebb_state(void) @@ -335,257 +337,6 @@ void event_leader_ebb_init(struct event *e) e->attr.pinned = 1; } -int core_busy_loop(void) -{ - int rc; - - asm volatile ( - "li 3, 0x3030\n" - "std 3, -96(1)\n" - "li 4, 0x4040\n" - "std 4, -104(1)\n" - "li 5, 0x5050\n" - "std 5, -112(1)\n" - "li 6, 0x6060\n" - "std 6, -120(1)\n" - "li 7, 0x7070\n" - "std 7, -128(1)\n" - "li 8, 0x0808\n" - "std 8, -136(1)\n" - "li 9, 0x0909\n" - "std 9, -144(1)\n" - "li 10, 0x1010\n" - "std 10, -152(1)\n" - "li 11, 0x1111\n" - "std 11, -160(1)\n" - "li 14, 0x1414\n" - "std 14, -168(1)\n" - "li 15, 0x1515\n" - "std 15, -176(1)\n" - "li 16, 0x1616\n" - "std 16, -184(1)\n" - "li 17, 0x1717\n" - "std 17, -192(1)\n" - "li 18, 0x1818\n" - "std 18, -200(1)\n" - "li 19, 0x1919\n" - "std 19, -208(1)\n" - "li 20, 0x2020\n" - "std 20, -216(1)\n" - "li 21, 0x2121\n" - "std 21, -224(1)\n" - "li 22, 0x2222\n" - "std 22, -232(1)\n" - "li 23, 0x2323\n" - "std 23, -240(1)\n" - "li 24, 0x2424\n" - "std 24, -248(1)\n" - "li 25, 0x2525\n" - "std 25, -256(1)\n" - "li 26, 0x2626\n" - "std 26, -264(1)\n" - "li 27, 0x2727\n" - "std 27, -272(1)\n" - "li 28, 0x2828\n" - "std 28, -280(1)\n" - "li 29, 0x2929\n" - "std 29, -288(1)\n" - "li 30, 0x3030\n" - "li 31, 0x3131\n" - - "li 3, 0\n" - "0: " - "addi 3, 3, 1\n" - "cmpwi 3, 100\n" - "blt 0b\n" - - /* Return 1 (fail) unless we get through all the checks */ - "li 0, 1\n" - - /* Check none of our registers have been corrupted */ - "cmpwi 4, 0x4040\n" - "bne 1f\n" - "cmpwi 5, 0x5050\n" - "bne 1f\n" - "cmpwi 6, 0x6060\n" - "bne 1f\n" - "cmpwi 7, 0x7070\n" - "bne 1f\n" - "cmpwi 8, 0x0808\n" - "bne 1f\n" - "cmpwi 9, 0x0909\n" - "bne 1f\n" - "cmpwi 10, 0x1010\n" - "bne 1f\n" - "cmpwi 11, 0x1111\n" - "bne 1f\n" - "cmpwi 14, 0x1414\n" - "bne 1f\n" - "cmpwi 15, 0x1515\n" - "bne 1f\n" - "cmpwi 16, 0x1616\n" - "bne 1f\n" - "cmpwi 17, 0x1717\n" - "bne 1f\n" - "cmpwi 18, 0x1818\n" - "bne 1f\n" - "cmpwi 19, 0x1919\n" - "bne 1f\n" - "cmpwi 20, 0x2020\n" - "bne 1f\n" - "cmpwi 21, 0x2121\n" - "bne 1f\n" - "cmpwi 22, 0x2222\n" - "bne 1f\n" - "cmpwi 23, 0x2323\n" - "bne 1f\n" - "cmpwi 24, 0x2424\n" - "bne 1f\n" - "cmpwi 25, 0x2525\n" - "bne 1f\n" - "cmpwi 26, 0x2626\n" - "bne 1f\n" - "cmpwi 27, 0x2727\n" - "bne 1f\n" - "cmpwi 28, 0x2828\n" - "bne 1f\n" - "cmpwi 29, 0x2929\n" - "bne 1f\n" - "cmpwi 30, 0x3030\n" - "bne 1f\n" - "cmpwi 31, 0x3131\n" - "bne 1f\n" - - /* Load junk into all our registers before we reload them from the stack. */ - "li 3, 0xde\n" - "li 4, 0xad\n" - "li 5, 0xbe\n" - "li 6, 0xef\n" - "li 7, 0xde\n" - "li 8, 0xad\n" - "li 9, 0xbe\n" - "li 10, 0xef\n" - "li 11, 0xde\n" - "li 14, 0xad\n" - "li 15, 0xbe\n" - "li 16, 0xef\n" - "li 17, 0xde\n" - "li 18, 0xad\n" - "li 19, 0xbe\n" - "li 20, 0xef\n" - "li 21, 0xde\n" - "li 22, 0xad\n" - "li 23, 0xbe\n" - "li 24, 0xef\n" - "li 25, 0xde\n" - "li 26, 0xad\n" - "li 27, 0xbe\n" - "li 28, 0xef\n" - "li 29, 0xdd\n" - - "ld 3, -96(1)\n" - "cmpwi 3, 0x3030\n" - "bne 1f\n" - "ld 4, -104(1)\n" - "cmpwi 4, 0x4040\n" - "bne 1f\n" - "ld 5, -112(1)\n" - "cmpwi 5, 0x5050\n" - "bne 1f\n" - "ld 6, -120(1)\n" - "cmpwi 6, 0x6060\n" - "bne 1f\n" - "ld 7, -128(1)\n" - "cmpwi 7, 0x7070\n" - "bne 1f\n" - "ld 8, -136(1)\n" - "cmpwi 8, 0x0808\n" - "bne 1f\n" - "ld 9, -144(1)\n" - "cmpwi 9, 0x0909\n" - "bne 1f\n" - "ld 10, -152(1)\n" - "cmpwi 10, 0x1010\n" - "bne 1f\n" - "ld 11, -160(1)\n" - "cmpwi 11, 0x1111\n" - "bne 1f\n" - "ld 14, -168(1)\n" - "cmpwi 14, 0x1414\n" - "bne 1f\n" - "ld 15, -176(1)\n" - "cmpwi 15, 0x1515\n" - "bne 1f\n" - "ld 16, -184(1)\n" - "cmpwi 16, 0x1616\n" - "bne 1f\n" - "ld 17, -192(1)\n" - "cmpwi 17, 0x1717\n" - "bne 1f\n" - "ld 18, -200(1)\n" - "cmpwi 18, 0x1818\n" - "bne 1f\n" - "ld 19, -208(1)\n" - "cmpwi 19, 0x1919\n" - "bne 1f\n" - "ld 20, -216(1)\n" - "cmpwi 20, 0x2020\n" - "bne 1f\n" - "ld 21, -224(1)\n" - "cmpwi 21, 0x2121\n" - "bne 1f\n" - "ld 22, -232(1)\n" - "cmpwi 22, 0x2222\n" - "bne 1f\n" - "ld 23, -240(1)\n" - "cmpwi 23, 0x2323\n" - "bne 1f\n" - "ld 24, -248(1)\n" - "cmpwi 24, 0x2424\n" - "bne 1f\n" - "ld 25, -256(1)\n" - "cmpwi 25, 0x2525\n" - "bne 1f\n" - "ld 26, -264(1)\n" - "cmpwi 26, 0x2626\n" - "bne 1f\n" - "ld 27, -272(1)\n" - "cmpwi 27, 0x2727\n" - "bne 1f\n" - "ld 28, -280(1)\n" - "cmpwi 28, 0x2828\n" - "bne 1f\n" - "ld 29, -288(1)\n" - "cmpwi 29, 0x2929\n" - "bne 1f\n" - - /* Load 0 (success) to return */ - "li 0, 0\n" - - "1: mr %0, 0\n" - - : "=r" (rc) - : /* no inputs */ - : "3", "4", "5", "6", "7", "8", "9", "10", "11", "14", - "15", "16", "17", "18", "19", "20", "21", "22", "23", - "24", "25", "26", "27", "28", "29", "30", "31", - "memory" - ); - - return rc; -} - -int core_busy_loop_with_freeze(void) -{ - int rc; - - mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) & ~MMCR0_FC); - rc = core_busy_loop(); - mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) | MMCR0_FC); - - return rc; -} - int ebb_child(union pipe read_pipe, union pipe write_pipe) { struct event event; |