14244065bSChristopher Covington /* 24244065bSChristopher Covington * Test the ARM Performance Monitors Unit (PMU). 34244065bSChristopher Covington * 44244065bSChristopher Covington * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. 54244065bSChristopher Covington * Copyright (C) 2016, Red Hat Inc, Wei Huang <wei@redhat.com> 64244065bSChristopher Covington * 74244065bSChristopher Covington * This program is free software; you can redistribute it and/or modify it 84244065bSChristopher Covington * under the terms of the GNU Lesser General Public License version 2.1 and 94244065bSChristopher Covington * only version 2.1 as published by the Free Software Foundation. 104244065bSChristopher Covington * 114244065bSChristopher Covington * This program is distributed in the hope that it will be useful, but WITHOUT 124244065bSChristopher Covington * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 134244065bSChristopher Covington * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 144244065bSChristopher Covington * for more details. 154244065bSChristopher Covington */ 164244065bSChristopher Covington #include "libcflat.h" 174c357610SAndrew Jones #include "errata.h" 184244065bSChristopher Covington #include "asm/barrier.h" 194244065bSChristopher Covington #include "asm/sysreg.h" 204244065bSChristopher Covington #include "asm/processor.h" 214870738cSEric Auger #include <bitops.h> 224ce2a804SEric Auger #include <asm/gic.h> 234244065bSChristopher Covington 24d81bb7a3SChristopher Covington #define PMU_PMCR_E (1 << 0) 254ce2a804SEric Auger #define PMU_PMCR_P (1 << 1) 26d81bb7a3SChristopher Covington #define PMU_PMCR_C (1 << 2) 274ce2a804SEric Auger #define PMU_PMCR_D (1 << 3) 284ce2a804SEric Auger #define PMU_PMCR_X (1 << 4) 294ce2a804SEric Auger #define PMU_PMCR_DP (1 << 5) 30d81bb7a3SChristopher Covington #define PMU_PMCR_LC (1 << 6) 314244065bSChristopher Covington #define PMU_PMCR_N_SHIFT 11 324244065bSChristopher Covington #define PMU_PMCR_N_MASK 0x1f 334244065bSChristopher Covington #define PMU_PMCR_ID_SHIFT 16 344244065bSChristopher Covington #define PMU_PMCR_ID_MASK 0xff 354244065bSChristopher Covington #define PMU_PMCR_IMP_SHIFT 24 364244065bSChristopher Covington #define PMU_PMCR_IMP_MASK 0xff 374244065bSChristopher Covington 38d81bb7a3SChristopher Covington #define PMU_CYCLE_IDX 31 39d81bb7a3SChristopher Covington 40d81bb7a3SChristopher Covington #define NR_SAMPLES 10 41d81bb7a3SChristopher Covington 424870738cSEric Auger /* Some PMU events */ 434870738cSEric Auger #define SW_INCR 0x0 444870738cSEric Auger #define INST_RETIRED 0x8 454870738cSEric Auger #define CPU_CYCLES 0x11 464ce2a804SEric Auger #define MEM_ACCESS 0x13 474870738cSEric Auger #define INST_PREC 0x1B 484870738cSEric Auger #define STALL_FRONTEND 0x23 494870738cSEric Auger #define STALL_BACKEND 0x24 504870738cSEric Auger 514870738cSEric Auger #define COMMON_EVENTS_LOW 0x0 524870738cSEric Auger #define COMMON_EVENTS_HIGH 0x3F 534870738cSEric Auger #define EXT_COMMON_EVENTS_LOW 0x4000 544870738cSEric Auger #define EXT_COMMON_EVENTS_HIGH 0x403F 554870738cSEric Auger 564ce2a804SEric Auger #define ALL_SET 0xFFFFFFFF 574ce2a804SEric Auger #define ALL_CLEAR 0x0 584ce2a804SEric Auger #define PRE_OVERFLOW 0xFFFFFFF0 594ce2a804SEric Auger 608f747a85SEric Auger struct pmu { 618f747a85SEric Auger unsigned int version; 628f747a85SEric Auger unsigned int nb_implemented_counters; 638f747a85SEric Auger uint32_t pmcr_ro; 648f747a85SEric Auger }; 658f747a85SEric Auger 668f747a85SEric Auger static struct pmu pmu; 678f747a85SEric Auger 684244065bSChristopher Covington #if defined(__arm__) 69098add54SAndrew Jones #define ID_DFR0_PERFMON_SHIFT 24 70098add54SAndrew Jones #define ID_DFR0_PERFMON_MASK 0xf 71098add54SAndrew Jones 72784ee933SEric Auger #define ID_DFR0_PMU_NOTIMPL 0b0000 73784ee933SEric Auger #define ID_DFR0_PMU_V1 0b0001 74784ee933SEric Auger #define ID_DFR0_PMU_V2 0b0010 75784ee933SEric Auger #define ID_DFR0_PMU_V3 0b0011 76784ee933SEric Auger #define ID_DFR0_PMU_V3_8_1 0b0100 77784ee933SEric Auger #define ID_DFR0_PMU_V3_8_4 0b0101 78784ee933SEric Auger #define ID_DFR0_PMU_V3_8_5 0b0110 79784ee933SEric Auger #define ID_DFR0_PMU_IMPDEF 0b1111 80784ee933SEric Auger 814244065bSChristopher Covington #define PMCR __ACCESS_CP15(c9, 0, c12, 0) 824244065bSChristopher Covington #define ID_DFR0 __ACCESS_CP15(c0, 0, c1, 2) 83d81bb7a3SChristopher Covington #define PMSELR __ACCESS_CP15(c9, 0, c12, 5) 84d81bb7a3SChristopher Covington #define PMXEVTYPER __ACCESS_CP15(c9, 0, c13, 1) 85d81bb7a3SChristopher Covington #define PMCNTENSET __ACCESS_CP15(c9, 0, c12, 1) 86d81bb7a3SChristopher Covington #define PMCCNTR32 __ACCESS_CP15(c9, 0, c13, 0) 87d81bb7a3SChristopher Covington #define PMCCNTR64 __ACCESS_CP15_64(0, c9) 884244065bSChristopher Covington 894244065bSChristopher Covington static inline uint32_t get_id_dfr0(void) { return read_sysreg(ID_DFR0); } 904244065bSChristopher Covington static inline uint32_t get_pmcr(void) { return read_sysreg(PMCR); } 91d81bb7a3SChristopher Covington static inline void set_pmcr(uint32_t v) { write_sysreg(v, PMCR); } 92d81bb7a3SChristopher Covington static inline void set_pmcntenset(uint32_t v) { write_sysreg(v, PMCNTENSET); } 93d81bb7a3SChristopher Covington 94098add54SAndrew Jones static inline uint8_t get_pmu_version(void) 95098add54SAndrew Jones { 96098add54SAndrew Jones return (get_id_dfr0() >> ID_DFR0_PERFMON_SHIFT) & ID_DFR0_PERFMON_MASK; 97098add54SAndrew Jones } 98098add54SAndrew Jones 99d81bb7a3SChristopher Covington static inline uint64_t get_pmccntr(void) 100d81bb7a3SChristopher Covington { 101d81bb7a3SChristopher Covington return read_sysreg(PMCCNTR32); 102d81bb7a3SChristopher Covington } 103d81bb7a3SChristopher Covington 1048f76a347SChristopher Covington static inline void set_pmccntr(uint64_t value) 1058f76a347SChristopher Covington { 1068f76a347SChristopher Covington write_sysreg(value & 0xffffffff, PMCCNTR32); 1078f76a347SChristopher Covington } 1088f76a347SChristopher Covington 109d81bb7a3SChristopher Covington /* PMCCFILTR is an obsolete name for PMXEVTYPER31 in ARMv7 */ 110d81bb7a3SChristopher Covington static inline void set_pmccfiltr(uint32_t value) 111d81bb7a3SChristopher Covington { 112d81bb7a3SChristopher Covington write_sysreg(PMU_CYCLE_IDX, PMSELR); 113d81bb7a3SChristopher Covington write_sysreg(value, PMXEVTYPER); 114d81bb7a3SChristopher Covington isb(); 115d81bb7a3SChristopher Covington } 1168f76a347SChristopher Covington 1178f76a347SChristopher Covington /* 1188f76a347SChristopher Covington * Extra instructions inserted by the compiler would be difficult to compensate 1198f76a347SChristopher Covington * for, so hand assemble everything between, and including, the PMCR accesses 1208f76a347SChristopher Covington * to start and stop counting. isb instructions were inserted to make sure 1218f76a347SChristopher Covington * pmccntr read after this function returns the exact instructions executed in 1228f76a347SChristopher Covington * the controlled block. Total instrs = isb + mcr + 2*loop = 2 + 2*loop. 1238f76a347SChristopher Covington */ 1248f76a347SChristopher Covington static inline void precise_instrs_loop(int loop, uint32_t pmcr) 1258f76a347SChristopher Covington { 1268f76a347SChristopher Covington asm volatile( 1278f76a347SChristopher Covington " mcr p15, 0, %[pmcr], c9, c12, 0\n" 1288f76a347SChristopher Covington " isb\n" 1298f76a347SChristopher Covington "1: subs %[loop], %[loop], #1\n" 1308f76a347SChristopher Covington " bgt 1b\n" 1318f76a347SChristopher Covington " mcr p15, 0, %[z], c9, c12, 0\n" 1328f76a347SChristopher Covington " isb\n" 1338f76a347SChristopher Covington : [loop] "+r" (loop) 1348f76a347SChristopher Covington : [pmcr] "r" (pmcr), [z] "r" (0) 1358f76a347SChristopher Covington : "cc"); 1368f76a347SChristopher Covington } 1374870738cSEric Auger 1384870738cSEric Auger /* event counter tests only implemented for aarch64 */ 1394870738cSEric Auger static void test_event_introspection(void) {} 1404ce2a804SEric Auger static void test_event_counter_config(void) {} 1414ce2a804SEric Auger static void test_basic_event_count(void) {} 1424ce2a804SEric Auger static void test_mem_access(void) {} 143*bb9a5adcSEric Auger static void test_sw_incr(void) {} 1444870738cSEric Auger 1454244065bSChristopher Covington #elif defined(__aarch64__) 146098add54SAndrew Jones #define ID_AA64DFR0_PERFMON_SHIFT 8 147098add54SAndrew Jones #define ID_AA64DFR0_PERFMON_MASK 0xf 148098add54SAndrew Jones 149784ee933SEric Auger #define ID_DFR0_PMU_NOTIMPL 0b0000 150784ee933SEric Auger #define ID_DFR0_PMU_V3 0b0001 151784ee933SEric Auger #define ID_DFR0_PMU_V3_8_1 0b0100 152784ee933SEric Auger #define ID_DFR0_PMU_V3_8_4 0b0101 153784ee933SEric Auger #define ID_DFR0_PMU_V3_8_5 0b0110 154784ee933SEric Auger #define ID_DFR0_PMU_IMPDEF 0b1111 155784ee933SEric Auger 156098add54SAndrew Jones static inline uint32_t get_id_aa64dfr0(void) { return read_sysreg(id_aa64dfr0_el1); } 1574244065bSChristopher Covington static inline uint32_t get_pmcr(void) { return read_sysreg(pmcr_el0); } 158d81bb7a3SChristopher Covington static inline void set_pmcr(uint32_t v) { write_sysreg(v, pmcr_el0); } 159d81bb7a3SChristopher Covington static inline uint64_t get_pmccntr(void) { return read_sysreg(pmccntr_el0); } 1608f76a347SChristopher Covington static inline void set_pmccntr(uint64_t v) { write_sysreg(v, pmccntr_el0); } 161d81bb7a3SChristopher Covington static inline void set_pmcntenset(uint32_t v) { write_sysreg(v, pmcntenset_el0); } 162d81bb7a3SChristopher Covington static inline void set_pmccfiltr(uint32_t v) { write_sysreg(v, pmccfiltr_el0); } 1638f76a347SChristopher Covington 164098add54SAndrew Jones static inline uint8_t get_pmu_version(void) 165098add54SAndrew Jones { 166098add54SAndrew Jones uint8_t ver = (get_id_aa64dfr0() >> ID_AA64DFR0_PERFMON_SHIFT) & ID_AA64DFR0_PERFMON_MASK; 167784ee933SEric Auger return ver; 168098add54SAndrew Jones } 169098add54SAndrew Jones 1708f76a347SChristopher Covington /* 1718f76a347SChristopher Covington * Extra instructions inserted by the compiler would be difficult to compensate 1728f76a347SChristopher Covington * for, so hand assemble everything between, and including, the PMCR accesses 1738f76a347SChristopher Covington * to start and stop counting. isb instructions are inserted to make sure 1748f76a347SChristopher Covington * pmccntr read after this function returns the exact instructions executed 1758f76a347SChristopher Covington * in the controlled block. Total instrs = isb + msr + 2*loop = 2 + 2*loop. 1768f76a347SChristopher Covington */ 1778f76a347SChristopher Covington static inline void precise_instrs_loop(int loop, uint32_t pmcr) 1788f76a347SChristopher Covington { 1798f76a347SChristopher Covington asm volatile( 1808f76a347SChristopher Covington " msr pmcr_el0, %[pmcr]\n" 1818f76a347SChristopher Covington " isb\n" 1828f76a347SChristopher Covington "1: subs %[loop], %[loop], #1\n" 1838f76a347SChristopher Covington " b.gt 1b\n" 1848f76a347SChristopher Covington " msr pmcr_el0, xzr\n" 1858f76a347SChristopher Covington " isb\n" 1868f76a347SChristopher Covington : [loop] "+r" (loop) 1878f76a347SChristopher Covington : [pmcr] "r" (pmcr) 1888f76a347SChristopher Covington : "cc"); 1898f76a347SChristopher Covington } 1904870738cSEric Auger 1914870738cSEric Auger #define PMCEID1_EL0 sys_reg(3, 3, 9, 12, 7) 1924ce2a804SEric Auger #define PMCNTENSET_EL0 sys_reg(3, 3, 9, 12, 1) 1934ce2a804SEric Auger #define PMCNTENCLR_EL0 sys_reg(3, 3, 9, 12, 2) 1944ce2a804SEric Auger 1954ce2a804SEric Auger #define PMEVTYPER_EXCLUDE_EL1 BIT(31) 1964ce2a804SEric Auger #define PMEVTYPER_EXCLUDE_EL0 BIT(30) 1974870738cSEric Auger 1984870738cSEric Auger static bool is_event_supported(uint32_t n, bool warn) 1994870738cSEric Auger { 2004870738cSEric Auger uint64_t pmceid0 = read_sysreg(pmceid0_el0); 2014870738cSEric Auger uint64_t pmceid1 = read_sysreg_s(PMCEID1_EL0); 2024870738cSEric Auger bool supported; 2034870738cSEric Auger uint64_t reg; 2044870738cSEric Auger 2054870738cSEric Auger /* 2064870738cSEric Auger * The low 32-bits of PMCEID0/1 respectively describe 2074870738cSEric Auger * event support for events 0-31/32-63. Their High 2084870738cSEric Auger * 32-bits describe support for extended events 2094870738cSEric Auger * starting at 0x4000, using the same split. 2104870738cSEric Auger */ 2114870738cSEric Auger assert((n >= COMMON_EVENTS_LOW && n <= COMMON_EVENTS_HIGH) || 2124870738cSEric Auger (n >= EXT_COMMON_EVENTS_LOW && n <= EXT_COMMON_EVENTS_HIGH)); 2134870738cSEric Auger 2144870738cSEric Auger if (n <= COMMON_EVENTS_HIGH) 2154870738cSEric Auger reg = lower_32_bits(pmceid0) | ((u64)lower_32_bits(pmceid1) << 32); 2164870738cSEric Auger else 2174870738cSEric Auger reg = upper_32_bits(pmceid0) | ((u64)upper_32_bits(pmceid1) << 32); 2184870738cSEric Auger 2194870738cSEric Auger supported = reg & (1UL << (n & 0x3F)); 2204870738cSEric Auger 2214870738cSEric Auger if (!supported && warn) 2224870738cSEric Auger report_info("event 0x%x is not supported", n); 2234870738cSEric Auger return supported; 2244870738cSEric Auger } 2254870738cSEric Auger 2264870738cSEric Auger static void test_event_introspection(void) 2274870738cSEric Auger { 2284870738cSEric Auger bool required_events; 2294870738cSEric Auger 2304870738cSEric Auger if (!pmu.nb_implemented_counters) { 2314870738cSEric Auger report_skip("No event counter, skip ..."); 2324870738cSEric Auger return; 2334870738cSEric Auger } 2344870738cSEric Auger 2354870738cSEric Auger /* PMUv3 requires an implementation includes some common events */ 2364870738cSEric Auger required_events = is_event_supported(SW_INCR, true) && 2374870738cSEric Auger is_event_supported(CPU_CYCLES, true) && 2384870738cSEric Auger (is_event_supported(INST_RETIRED, true) || 2394870738cSEric Auger is_event_supported(INST_PREC, true)); 2404870738cSEric Auger 2414870738cSEric Auger if (pmu.version >= ID_DFR0_PMU_V3_8_1) { 2424870738cSEric Auger required_events = required_events && 2434870738cSEric Auger is_event_supported(STALL_FRONTEND, true) && 2444870738cSEric Auger is_event_supported(STALL_BACKEND, true); 2454870738cSEric Auger } 2464870738cSEric Auger 2474870738cSEric Auger report(required_events, "Check required events are implemented"); 2484870738cSEric Auger } 2494870738cSEric Auger 2504ce2a804SEric Auger /* 2514ce2a804SEric Auger * Extra instructions inserted by the compiler would be difficult to compensate 2524ce2a804SEric Auger * for, so hand assemble everything between, and including, the PMCR accesses 2534ce2a804SEric Auger * to start and stop counting. isb instructions are inserted to make sure 2544ce2a804SEric Auger * pmccntr read after this function returns the exact instructions executed 2554ce2a804SEric Auger * in the controlled block. Loads @loop times the data at @address into x9. 2564ce2a804SEric Auger */ 2574ce2a804SEric Auger static void mem_access_loop(void *addr, int loop, uint32_t pmcr) 2584ce2a804SEric Auger { 2594ce2a804SEric Auger asm volatile( 2604ce2a804SEric Auger " msr pmcr_el0, %[pmcr]\n" 2614ce2a804SEric Auger " isb\n" 2624ce2a804SEric Auger " mov x10, %[loop]\n" 2634ce2a804SEric Auger "1: sub x10, x10, #1\n" 2644ce2a804SEric Auger " ldr x9, [%[addr]]\n" 2654ce2a804SEric Auger " cmp x10, #0x0\n" 2664ce2a804SEric Auger " b.gt 1b\n" 2674ce2a804SEric Auger " msr pmcr_el0, xzr\n" 2684ce2a804SEric Auger " isb\n" 2694ce2a804SEric Auger : 2704ce2a804SEric Auger : [addr] "r" (addr), [pmcr] "r" (pmcr), [loop] "r" (loop) 2714ce2a804SEric Auger : "x9", "x10", "cc"); 2724ce2a804SEric Auger } 2734ce2a804SEric Auger 2744ce2a804SEric Auger static void pmu_reset(void) 2754ce2a804SEric Auger { 2764ce2a804SEric Auger /* reset all counters, counting disabled at PMCR level*/ 2774ce2a804SEric Auger set_pmcr(pmu.pmcr_ro | PMU_PMCR_LC | PMU_PMCR_C | PMU_PMCR_P); 2784ce2a804SEric Auger /* Disable all counters */ 2794ce2a804SEric Auger write_sysreg_s(ALL_SET, PMCNTENCLR_EL0); 2804ce2a804SEric Auger /* clear overflow reg */ 2814ce2a804SEric Auger write_sysreg(ALL_SET, pmovsclr_el0); 2824ce2a804SEric Auger /* disable overflow interrupts on all counters */ 2834ce2a804SEric Auger write_sysreg(ALL_SET, pmintenclr_el1); 2844ce2a804SEric Auger isb(); 2854ce2a804SEric Auger } 2864ce2a804SEric Auger 2874ce2a804SEric Auger static void test_event_counter_config(void) 2884ce2a804SEric Auger { 2894ce2a804SEric Auger int i; 2904ce2a804SEric Auger 2914ce2a804SEric Auger if (!pmu.nb_implemented_counters) { 2924ce2a804SEric Auger report_skip("No event counter, skip ..."); 2934ce2a804SEric Auger return; 2944ce2a804SEric Auger } 2954ce2a804SEric Auger 2964ce2a804SEric Auger pmu_reset(); 2974ce2a804SEric Auger 2984ce2a804SEric Auger /* 2994ce2a804SEric Auger * Test setting through PMESELR/PMXEVTYPER and PMEVTYPERn read, 3004ce2a804SEric Auger * select counter 0 3014ce2a804SEric Auger */ 3024ce2a804SEric Auger write_sysreg(1, PMSELR_EL0); 3034ce2a804SEric Auger /* program this counter to count unsupported event */ 3044ce2a804SEric Auger write_sysreg(0xEA, PMXEVTYPER_EL0); 3054ce2a804SEric Auger write_sysreg(0xdeadbeef, PMXEVCNTR_EL0); 3064ce2a804SEric Auger report((read_regn_el0(pmevtyper, 1) & 0xFFF) == 0xEA, 3074ce2a804SEric Auger "PMESELR/PMXEVTYPER/PMEVTYPERn"); 3084ce2a804SEric Auger report((read_regn_el0(pmevcntr, 1) == 0xdeadbeef), 3094ce2a804SEric Auger "PMESELR/PMXEVCNTR/PMEVCNTRn"); 3104ce2a804SEric Auger 3114ce2a804SEric Auger /* try to configure an unsupported event within the range [0x0, 0x3F] */ 3124ce2a804SEric Auger for (i = 0; i <= 0x3F; i++) { 3134ce2a804SEric Auger if (!is_event_supported(i, false)) 3144ce2a804SEric Auger break; 3154ce2a804SEric Auger } 3164ce2a804SEric Auger if (i > 0x3F) { 3174ce2a804SEric Auger report_skip("pmevtyper: all events within [0x0, 0x3F] are supported"); 3184ce2a804SEric Auger return; 3194ce2a804SEric Auger } 3204ce2a804SEric Auger 3214ce2a804SEric Auger /* select counter 0 */ 3224ce2a804SEric Auger write_sysreg(0, PMSELR_EL0); 3234ce2a804SEric Auger /* program this counter to count unsupported event */ 3244ce2a804SEric Auger write_sysreg(i, PMXEVCNTR_EL0); 3254ce2a804SEric Auger /* read the counter value */ 3264ce2a804SEric Auger read_sysreg(PMXEVCNTR_EL0); 3274ce2a804SEric Auger report(read_sysreg(PMXEVCNTR_EL0) == i, 3284ce2a804SEric Auger "read of a counter programmed with unsupported event"); 3294ce2a804SEric Auger } 3304ce2a804SEric Auger 3314ce2a804SEric Auger static bool satisfy_prerequisites(uint32_t *events, unsigned int nb_events) 3324ce2a804SEric Auger { 3334ce2a804SEric Auger int i; 3344ce2a804SEric Auger 3354ce2a804SEric Auger if (pmu.nb_implemented_counters < nb_events) { 3364ce2a804SEric Auger report_skip("Skip test as number of counters is too small (%d)", 3374ce2a804SEric Auger pmu.nb_implemented_counters); 3384ce2a804SEric Auger return false; 3394ce2a804SEric Auger } 3404ce2a804SEric Auger 3414ce2a804SEric Auger for (i = 0; i < nb_events; i++) { 3424ce2a804SEric Auger if (!is_event_supported(events[i], false)) { 3434ce2a804SEric Auger report_skip("Skip test as event 0x%x is not supported", 3444ce2a804SEric Auger events[i]); 3454ce2a804SEric Auger return false; 3464ce2a804SEric Auger } 3474ce2a804SEric Auger } 3484ce2a804SEric Auger return true; 3494ce2a804SEric Auger } 3504ce2a804SEric Auger 3514ce2a804SEric Auger static void test_basic_event_count(void) 3524ce2a804SEric Auger { 3534ce2a804SEric Auger uint32_t implemented_counter_mask, non_implemented_counter_mask; 3544ce2a804SEric Auger uint32_t counter_mask; 3554ce2a804SEric Auger uint32_t events[] = {CPU_CYCLES, INST_RETIRED}; 3564ce2a804SEric Auger 3574ce2a804SEric Auger if (!satisfy_prerequisites(events, ARRAY_SIZE(events))) 3584ce2a804SEric Auger return; 3594ce2a804SEric Auger 3604ce2a804SEric Auger implemented_counter_mask = BIT(pmu.nb_implemented_counters) - 1; 3614ce2a804SEric Auger non_implemented_counter_mask = ~(BIT(31) | implemented_counter_mask); 3624ce2a804SEric Auger counter_mask = implemented_counter_mask | non_implemented_counter_mask; 3634ce2a804SEric Auger 3644ce2a804SEric Auger write_regn_el0(pmevtyper, 0, CPU_CYCLES | PMEVTYPER_EXCLUDE_EL0); 3654ce2a804SEric Auger write_regn_el0(pmevtyper, 1, INST_RETIRED | PMEVTYPER_EXCLUDE_EL0); 3664ce2a804SEric Auger 3674ce2a804SEric Auger /* disable all counters */ 3684ce2a804SEric Auger write_sysreg_s(ALL_SET, PMCNTENCLR_EL0); 3694ce2a804SEric Auger report(!read_sysreg_s(PMCNTENCLR_EL0) && !read_sysreg_s(PMCNTENSET_EL0), 3704ce2a804SEric Auger "pmcntenclr: disable all counters"); 3714ce2a804SEric Auger 3724ce2a804SEric Auger /* 3734ce2a804SEric Auger * clear cycle and all event counters and allow counter enablement 3744ce2a804SEric Auger * through PMCNTENSET. LC is RES1. 3754ce2a804SEric Auger */ 3764ce2a804SEric Auger set_pmcr(pmu.pmcr_ro | PMU_PMCR_LC | PMU_PMCR_C | PMU_PMCR_P); 3774ce2a804SEric Auger isb(); 3784ce2a804SEric Auger report(get_pmcr() == (pmu.pmcr_ro | PMU_PMCR_LC), "pmcr: reset counters"); 3794ce2a804SEric Auger 3804ce2a804SEric Auger /* Preset counter #0 to pre overflow value to trigger an overflow */ 3814ce2a804SEric Auger write_regn_el0(pmevcntr, 0, PRE_OVERFLOW); 3824ce2a804SEric Auger report(read_regn_el0(pmevcntr, 0) == PRE_OVERFLOW, 3834ce2a804SEric Auger "counter #0 preset to pre-overflow value"); 3844ce2a804SEric Auger report(!read_regn_el0(pmevcntr, 1), "counter #1 is 0"); 3854ce2a804SEric Auger 3864ce2a804SEric Auger /* 3874ce2a804SEric Auger * Enable all implemented counters and also attempt to enable 3884ce2a804SEric Auger * not supported counters. Counting still is disabled by !PMCR.E 3894ce2a804SEric Auger */ 3904ce2a804SEric Auger write_sysreg_s(counter_mask, PMCNTENSET_EL0); 3914ce2a804SEric Auger 3924ce2a804SEric Auger /* check only those implemented are enabled */ 3934ce2a804SEric Auger report((read_sysreg_s(PMCNTENSET_EL0) == read_sysreg_s(PMCNTENCLR_EL0)) && 3944ce2a804SEric Auger (read_sysreg_s(PMCNTENSET_EL0) == implemented_counter_mask), 3954ce2a804SEric Auger "pmcntenset: enabled implemented_counters"); 3964ce2a804SEric Auger 3974ce2a804SEric Auger /* Disable all counters but counters #0 and #1 */ 3984ce2a804SEric Auger write_sysreg_s(~0x3, PMCNTENCLR_EL0); 3994ce2a804SEric Auger report((read_sysreg_s(PMCNTENSET_EL0) == read_sysreg_s(PMCNTENCLR_EL0)) && 4004ce2a804SEric Auger (read_sysreg_s(PMCNTENSET_EL0) == 0x3), 4014ce2a804SEric Auger "pmcntenset: just enabled #0 and #1"); 4024ce2a804SEric Auger 4034ce2a804SEric Auger /* clear overflow register */ 4044ce2a804SEric Auger write_sysreg(ALL_SET, pmovsclr_el0); 4054ce2a804SEric Auger report(!read_sysreg(pmovsclr_el0), "check overflow reg is 0"); 4064ce2a804SEric Auger 4074ce2a804SEric Auger /* disable overflow interrupts on all counters*/ 4084ce2a804SEric Auger write_sysreg(ALL_SET, pmintenclr_el1); 4094ce2a804SEric Auger report(!read_sysreg(pmintenclr_el1), 4104ce2a804SEric Auger "pmintenclr_el1=0, all interrupts disabled"); 4114ce2a804SEric Auger 4124ce2a804SEric Auger /* enable overflow interrupts on all event counters */ 4134ce2a804SEric Auger write_sysreg(implemented_counter_mask | non_implemented_counter_mask, 4144ce2a804SEric Auger pmintenset_el1); 4154ce2a804SEric Auger report(read_sysreg(pmintenset_el1) == implemented_counter_mask, 4164ce2a804SEric Auger "overflow interrupts enabled on all implemented counters"); 4174ce2a804SEric Auger 4184ce2a804SEric Auger /* Set PMCR.E, execute asm code and unset PMCR.E */ 4194ce2a804SEric Auger precise_instrs_loop(20, pmu.pmcr_ro | PMU_PMCR_E); 4204ce2a804SEric Auger 4214ce2a804SEric Auger report_info("counter #0 is 0x%lx (CPU_CYCLES)", 4224ce2a804SEric Auger read_regn_el0(pmevcntr, 0)); 4234ce2a804SEric Auger report_info("counter #1 is 0x%lx (INST_RETIRED)", 4244ce2a804SEric Auger read_regn_el0(pmevcntr, 1)); 4254ce2a804SEric Auger 4264ce2a804SEric Auger report_info("overflow reg = 0x%lx", read_sysreg(pmovsclr_el0)); 4274ce2a804SEric Auger report(read_sysreg(pmovsclr_el0) & 0x1, 4284ce2a804SEric Auger "check overflow happened on #0 only"); 4294ce2a804SEric Auger } 4304ce2a804SEric Auger 4314ce2a804SEric Auger static void test_mem_access(void) 4324ce2a804SEric Auger { 4334ce2a804SEric Auger void *addr = malloc(PAGE_SIZE); 4344ce2a804SEric Auger uint32_t events[] = {MEM_ACCESS, MEM_ACCESS}; 4354ce2a804SEric Auger 4364ce2a804SEric Auger if (!satisfy_prerequisites(events, ARRAY_SIZE(events))) 4374ce2a804SEric Auger return; 4384ce2a804SEric Auger 4394ce2a804SEric Auger pmu_reset(); 4404ce2a804SEric Auger 4414ce2a804SEric Auger write_regn_el0(pmevtyper, 0, MEM_ACCESS | PMEVTYPER_EXCLUDE_EL0); 4424ce2a804SEric Auger write_regn_el0(pmevtyper, 1, MEM_ACCESS | PMEVTYPER_EXCLUDE_EL0); 4434ce2a804SEric Auger write_sysreg_s(0x3, PMCNTENSET_EL0); 4444ce2a804SEric Auger isb(); 4454ce2a804SEric Auger mem_access_loop(addr, 20, pmu.pmcr_ro | PMU_PMCR_E); 4464ce2a804SEric Auger report_info("counter #0 is %ld (MEM_ACCESS)", read_regn_el0(pmevcntr, 0)); 4474ce2a804SEric Auger report_info("counter #1 is %ld (MEM_ACCESS)", read_regn_el0(pmevcntr, 1)); 4484ce2a804SEric Auger /* We may measure more than 20 mem access depending on the core */ 4494ce2a804SEric Auger report((read_regn_el0(pmevcntr, 0) == read_regn_el0(pmevcntr, 1)) && 4504ce2a804SEric Auger (read_regn_el0(pmevcntr, 0) >= 20) && !read_sysreg(pmovsclr_el0), 4514ce2a804SEric Auger "Ran 20 mem accesses"); 4524ce2a804SEric Auger 4534ce2a804SEric Auger pmu_reset(); 4544ce2a804SEric Auger 4554ce2a804SEric Auger write_regn_el0(pmevcntr, 0, PRE_OVERFLOW); 4564ce2a804SEric Auger write_regn_el0(pmevcntr, 1, PRE_OVERFLOW); 4574ce2a804SEric Auger write_sysreg_s(0x3, PMCNTENSET_EL0); 4584ce2a804SEric Auger isb(); 4594ce2a804SEric Auger mem_access_loop(addr, 20, pmu.pmcr_ro | PMU_PMCR_E); 4604ce2a804SEric Auger report(read_sysreg(pmovsclr_el0) == 0x3, 4614ce2a804SEric Auger "Ran 20 mem accesses with expected overflows on both counters"); 4624ce2a804SEric Auger report_info("cnt#0 = %ld cnt#1=%ld overflow=0x%lx", 4634ce2a804SEric Auger read_regn_el0(pmevcntr, 0), read_regn_el0(pmevcntr, 1), 4644ce2a804SEric Auger read_sysreg(pmovsclr_el0)); 4654ce2a804SEric Auger } 4664ce2a804SEric Auger 467*bb9a5adcSEric Auger static void test_sw_incr(void) 468*bb9a5adcSEric Auger { 469*bb9a5adcSEric Auger uint32_t events[] = {SW_INCR, SW_INCR}; 470*bb9a5adcSEric Auger int i; 471*bb9a5adcSEric Auger 472*bb9a5adcSEric Auger if (!satisfy_prerequisites(events, ARRAY_SIZE(events))) 473*bb9a5adcSEric Auger return; 474*bb9a5adcSEric Auger 475*bb9a5adcSEric Auger pmu_reset(); 476*bb9a5adcSEric Auger 477*bb9a5adcSEric Auger write_regn_el0(pmevtyper, 0, SW_INCR | PMEVTYPER_EXCLUDE_EL0); 478*bb9a5adcSEric Auger write_regn_el0(pmevtyper, 1, SW_INCR | PMEVTYPER_EXCLUDE_EL0); 479*bb9a5adcSEric Auger /* enable counters #0 and #1 */ 480*bb9a5adcSEric Auger write_sysreg_s(0x3, PMCNTENSET_EL0); 481*bb9a5adcSEric Auger 482*bb9a5adcSEric Auger write_regn_el0(pmevcntr, 0, PRE_OVERFLOW); 483*bb9a5adcSEric Auger 484*bb9a5adcSEric Auger for (i = 0; i < 100; i++) 485*bb9a5adcSEric Auger write_sysreg(0x1, pmswinc_el0); 486*bb9a5adcSEric Auger 487*bb9a5adcSEric Auger report_info("SW_INCR counter #0 has value %ld", read_regn_el0(pmevcntr, 0)); 488*bb9a5adcSEric Auger report(read_regn_el0(pmevcntr, 0) == PRE_OVERFLOW, 489*bb9a5adcSEric Auger "PWSYNC does not increment if PMCR.E is unset"); 490*bb9a5adcSEric Auger 491*bb9a5adcSEric Auger pmu_reset(); 492*bb9a5adcSEric Auger 493*bb9a5adcSEric Auger write_regn_el0(pmevcntr, 0, PRE_OVERFLOW); 494*bb9a5adcSEric Auger write_sysreg_s(0x3, PMCNTENSET_EL0); 495*bb9a5adcSEric Auger set_pmcr(pmu.pmcr_ro | PMU_PMCR_E); 496*bb9a5adcSEric Auger 497*bb9a5adcSEric Auger for (i = 0; i < 100; i++) 498*bb9a5adcSEric Auger write_sysreg(0x3, pmswinc_el0); 499*bb9a5adcSEric Auger 500*bb9a5adcSEric Auger report(read_regn_el0(pmevcntr, 0) == 84, "counter #1 after + 100 SW_INCR"); 501*bb9a5adcSEric Auger report(read_regn_el0(pmevcntr, 1) == 100, 502*bb9a5adcSEric Auger "counter #0 after + 100 SW_INCR"); 503*bb9a5adcSEric Auger report_info("counter values after 100 SW_INCR #0=%ld #1=%ld", 504*bb9a5adcSEric Auger read_regn_el0(pmevcntr, 0), read_regn_el0(pmevcntr, 1)); 505*bb9a5adcSEric Auger report(read_sysreg(pmovsclr_el0) == 0x1, 506*bb9a5adcSEric Auger "overflow reg after 100 SW_INCR"); 507*bb9a5adcSEric Auger } 508*bb9a5adcSEric Auger 5094244065bSChristopher Covington #endif 5104244065bSChristopher Covington 5114244065bSChristopher Covington /* 512d81bb7a3SChristopher Covington * Ensure that the cycle counter progresses between back-to-back reads. 513d81bb7a3SChristopher Covington */ 514d81bb7a3SChristopher Covington static bool check_cycles_increase(void) 515d81bb7a3SChristopher Covington { 516d81bb7a3SChristopher Covington bool success = true; 517d81bb7a3SChristopher Covington 518d81bb7a3SChristopher Covington /* init before event access, this test only cares about cycle count */ 519d81bb7a3SChristopher Covington set_pmcntenset(1 << PMU_CYCLE_IDX); 520d81bb7a3SChristopher Covington set_pmccfiltr(0); /* count cycles in EL0, EL1, but not EL2 */ 521d81bb7a3SChristopher Covington 522d81bb7a3SChristopher Covington set_pmcr(get_pmcr() | PMU_PMCR_LC | PMU_PMCR_C | PMU_PMCR_E); 523d81bb7a3SChristopher Covington 524d81bb7a3SChristopher Covington for (int i = 0; i < NR_SAMPLES; i++) { 525d81bb7a3SChristopher Covington uint64_t a, b; 526d81bb7a3SChristopher Covington 527d81bb7a3SChristopher Covington a = get_pmccntr(); 528d81bb7a3SChristopher Covington b = get_pmccntr(); 529d81bb7a3SChristopher Covington 530d81bb7a3SChristopher Covington if (a >= b) { 531d81bb7a3SChristopher Covington printf("Read %"PRId64" then %"PRId64".\n", a, b); 532d81bb7a3SChristopher Covington success = false; 533d81bb7a3SChristopher Covington break; 534d81bb7a3SChristopher Covington } 535d81bb7a3SChristopher Covington } 536d81bb7a3SChristopher Covington 537d81bb7a3SChristopher Covington set_pmcr(get_pmcr() & ~PMU_PMCR_E); 538d81bb7a3SChristopher Covington 539d81bb7a3SChristopher Covington return success; 540d81bb7a3SChristopher Covington } 541d81bb7a3SChristopher Covington 5428f76a347SChristopher Covington /* 5438f76a347SChristopher Covington * Execute a known number of guest instructions. Only even instruction counts 5448f76a347SChristopher Covington * greater than or equal to 4 are supported by the in-line assembly code. The 5458f76a347SChristopher Covington * control register (PMCR_EL0) is initialized with the provided value (allowing 5468f76a347SChristopher Covington * for example for the cycle counter or event counters to be reset). At the end 5478f76a347SChristopher Covington * of the exact instruction loop, zero is written to PMCR_EL0 to disable 5488f76a347SChristopher Covington * counting, allowing the cycle counter or event counters to be read at the 5498f76a347SChristopher Covington * leisure of the calling code. 5508f76a347SChristopher Covington */ 5518f76a347SChristopher Covington static void measure_instrs(int num, uint32_t pmcr) 5528f76a347SChristopher Covington { 5538f76a347SChristopher Covington int loop = (num - 2) / 2; 5548f76a347SChristopher Covington 5558f76a347SChristopher Covington assert(num >= 4 && ((num - 2) % 2 == 0)); 5568f76a347SChristopher Covington precise_instrs_loop(loop, pmcr); 5578f76a347SChristopher Covington } 5588f76a347SChristopher Covington 5598f76a347SChristopher Covington /* 5608f76a347SChristopher Covington * Measure cycle counts for various known instruction counts. Ensure that the 5618f76a347SChristopher Covington * cycle counter progresses (similar to check_cycles_increase() but with more 5628f76a347SChristopher Covington * instructions and using reset and stop controls). If supplied a positive, 5638f76a347SChristopher Covington * nonzero CPI parameter, it also strictly checks that every measurement matches 5648f76a347SChristopher Covington * it. Strict CPI checking is used to test -icount mode. 5658f76a347SChristopher Covington */ 5668f76a347SChristopher Covington static bool check_cpi(int cpi) 5678f76a347SChristopher Covington { 5688f76a347SChristopher Covington uint32_t pmcr = get_pmcr() | PMU_PMCR_LC | PMU_PMCR_C | PMU_PMCR_E; 5698f76a347SChristopher Covington 5708f76a347SChristopher Covington /* init before event access, this test only cares about cycle count */ 5718f76a347SChristopher Covington set_pmcntenset(1 << PMU_CYCLE_IDX); 5728f76a347SChristopher Covington set_pmccfiltr(0); /* count cycles in EL0, EL1, but not EL2 */ 5738f76a347SChristopher Covington 5748f76a347SChristopher Covington if (cpi > 0) 5758f76a347SChristopher Covington printf("Checking for CPI=%d.\n", cpi); 5768f76a347SChristopher Covington printf("instrs : cycles0 cycles1 ...\n"); 5778f76a347SChristopher Covington 5788f76a347SChristopher Covington for (unsigned int i = 4; i < 300; i += 32) { 5798f76a347SChristopher Covington uint64_t avg, sum = 0; 5808f76a347SChristopher Covington 5818f76a347SChristopher Covington printf("%4d:", i); 5828f76a347SChristopher Covington for (int j = 0; j < NR_SAMPLES; j++) { 5838f76a347SChristopher Covington uint64_t cycles; 5848f76a347SChristopher Covington 5858f76a347SChristopher Covington set_pmccntr(0); 5868f76a347SChristopher Covington measure_instrs(i, pmcr); 5878f76a347SChristopher Covington cycles = get_pmccntr(); 5888f76a347SChristopher Covington printf(" %4"PRId64"", cycles); 5898f76a347SChristopher Covington 5908f76a347SChristopher Covington if (!cycles) { 5918f76a347SChristopher Covington printf("\ncycles not incrementing!\n"); 5928f76a347SChristopher Covington return false; 5938f76a347SChristopher Covington } else if (cpi > 0 && cycles != i * cpi) { 5948f76a347SChristopher Covington printf("\nunexpected cycle count received!\n"); 5958f76a347SChristopher Covington return false; 5968f76a347SChristopher Covington } else if ((cycles >> 32) != 0) { 5978f76a347SChristopher Covington /* The cycles taken by the loop above should 5988f76a347SChristopher Covington * fit in 32 bits easily. We check the upper 5998f76a347SChristopher Covington * 32 bits of the cycle counter to make sure 6008f76a347SChristopher Covington * there is no supprise. */ 6018f76a347SChristopher Covington printf("\ncycle count bigger than 32bit!\n"); 6028f76a347SChristopher Covington return false; 6038f76a347SChristopher Covington } 6048f76a347SChristopher Covington 6058f76a347SChristopher Covington sum += cycles; 6068f76a347SChristopher Covington } 6078f76a347SChristopher Covington avg = sum / NR_SAMPLES; 6088f76a347SChristopher Covington printf(" avg=%-4"PRId64" %s=%-3"PRId64"\n", avg, 6098f76a347SChristopher Covington (avg >= i) ? "cpi" : "ipc", 6108f76a347SChristopher Covington (avg >= i) ? avg / i : i / avg); 6118f76a347SChristopher Covington } 6128f76a347SChristopher Covington 6138f76a347SChristopher Covington return true; 6148f76a347SChristopher Covington } 6158f76a347SChristopher Covington 6164c357610SAndrew Jones static void pmccntr64_test(void) 6174c357610SAndrew Jones { 6184c357610SAndrew Jones #ifdef __arm__ 619784ee933SEric Auger if (pmu.version == ID_DFR0_PMU_V3) { 6204c357610SAndrew Jones if (ERRATA(9e3f7a296940)) { 6214c357610SAndrew Jones write_sysreg(0xdead, PMCCNTR64); 622a299895bSThomas Huth report(read_sysreg(PMCCNTR64) == 0xdead, "pmccntr64"); 6234c357610SAndrew Jones } else 6244c357610SAndrew Jones report_skip("Skipping unsafe pmccntr64 test. Set ERRATA_9e3f7a296940=y to enable."); 6254c357610SAndrew Jones } 6264c357610SAndrew Jones #endif 6274c357610SAndrew Jones } 6284c357610SAndrew Jones 6294244065bSChristopher Covington /* Return FALSE if no PMU found, otherwise return TRUE */ 63023b8916bSThomas Huth static bool pmu_probe(void) 6314244065bSChristopher Covington { 632784ee933SEric Auger uint32_t pmcr = get_pmcr(); 633eff8f161SEric Auger 6348f747a85SEric Auger pmu.version = get_pmu_version(); 635784ee933SEric Auger if (pmu.version == ID_DFR0_PMU_NOTIMPL || pmu.version == ID_DFR0_PMU_IMPDEF) 636eff8f161SEric Auger return false; 637eff8f161SEric Auger 638784ee933SEric Auger report_info("PMU version: 0x%x", pmu.version); 639eff8f161SEric Auger 640eff8f161SEric Auger pmcr = get_pmcr(); 6418f747a85SEric Auger report_info("PMU implementer/ID code: %#x(\"%c\")/%#x", 642eff8f161SEric Auger (pmcr >> PMU_PMCR_IMP_SHIFT) & PMU_PMCR_IMP_MASK, 643eff8f161SEric Auger ((pmcr >> PMU_PMCR_IMP_SHIFT) & PMU_PMCR_IMP_MASK) ? : ' ', 6448f747a85SEric Auger (pmcr >> PMU_PMCR_ID_SHIFT) & PMU_PMCR_ID_MASK); 6458f747a85SEric Auger 6468f747a85SEric Auger /* store read-only and RES0 fields of the PMCR bottom-half*/ 6478f747a85SEric Auger pmu.pmcr_ro = pmcr & 0xFFFFFF00; 6488f747a85SEric Auger pmu.nb_implemented_counters = 6498f747a85SEric Auger (pmcr >> PMU_PMCR_N_SHIFT) & PMU_PMCR_N_MASK; 6508f747a85SEric Auger report_info("Implements %d event counters", 6518f747a85SEric Auger pmu.nb_implemented_counters); 652eff8f161SEric Auger 653eff8f161SEric Auger return true; 6544244065bSChristopher Covington } 6554244065bSChristopher Covington 6568f76a347SChristopher Covington int main(int argc, char *argv[]) 6574244065bSChristopher Covington { 6588f76a347SChristopher Covington int cpi = 0; 6598f76a347SChristopher Covington 6604244065bSChristopher Covington if (!pmu_probe()) { 6614244065bSChristopher Covington printf("No PMU found, test skipped...\n"); 6624244065bSChristopher Covington return report_summary(); 6634244065bSChristopher Covington } 6644244065bSChristopher Covington 66557ec1086SEric Auger if (argc < 2) 66657ec1086SEric Auger report_abort("no test specified"); 66757ec1086SEric Auger 6684244065bSChristopher Covington report_prefix_push("pmu"); 6694244065bSChristopher Covington 67057ec1086SEric Auger if (strcmp(argv[1], "cycle-counter") == 0) { 67157ec1086SEric Auger report_prefix_push(argv[1]); 67257ec1086SEric Auger if (argc > 2) 67357ec1086SEric Auger cpi = atol(argv[2]); 674a299895bSThomas Huth report(check_cycles_increase(), 675a299895bSThomas Huth "Monotonically increasing cycle count"); 676a299895bSThomas Huth report(check_cpi(cpi), "Cycle/instruction ratio"); 6774c357610SAndrew Jones pmccntr64_test(); 67857ec1086SEric Auger report_prefix_pop(); 6794870738cSEric Auger } else if (strcmp(argv[1], "pmu-event-introspection") == 0) { 6804870738cSEric Auger report_prefix_push(argv[1]); 6814870738cSEric Auger test_event_introspection(); 6824870738cSEric Auger report_prefix_pop(); 6834ce2a804SEric Auger } else if (strcmp(argv[1], "pmu-event-counter-config") == 0) { 6844ce2a804SEric Auger report_prefix_push(argv[1]); 6854ce2a804SEric Auger test_event_counter_config(); 6864ce2a804SEric Auger report_prefix_pop(); 6874ce2a804SEric Auger } else if (strcmp(argv[1], "pmu-basic-event-count") == 0) { 6884ce2a804SEric Auger report_prefix_push(argv[1]); 6894ce2a804SEric Auger test_basic_event_count(); 6904ce2a804SEric Auger report_prefix_pop(); 6914ce2a804SEric Auger } else if (strcmp(argv[1], "pmu-mem-access") == 0) { 6924ce2a804SEric Auger report_prefix_push(argv[1]); 6934ce2a804SEric Auger test_mem_access(); 6944ce2a804SEric Auger report_prefix_pop(); 695*bb9a5adcSEric Auger } else if (strcmp(argv[1], "pmu-sw-incr") == 0) { 696*bb9a5adcSEric Auger report_prefix_push(argv[1]); 697*bb9a5adcSEric Auger test_sw_incr(); 698*bb9a5adcSEric Auger report_prefix_pop(); 69957ec1086SEric Auger } else { 70057ec1086SEric Auger report_abort("Unknown sub-test '%s'", argv[1]); 70157ec1086SEric Auger } 7024c357610SAndrew Jones 7034244065bSChristopher Covington return report_summary(); 7044244065bSChristopher Covington } 705