0001
0002
0003
0004
0005
0006 #include <stdio.h>
0007 #include <stdlib.h>
0008
0009 #include "../event.h"
0010 #include "misc.h"
0011 #include "utils.h"
0012
0013 extern void thirty_two_instruction_loop(int loops);
0014
0015
0016 #define EventCode 0x500fa
0017
0018
0019
0020
0021
0022 static int mmcra_bhrb_disable_test(void)
0023 {
0024 struct event event;
0025 u64 *intr_regs;
0026
0027
0028
0029
0030
0031 SKIP_IF(check_pvr_for_sampling_tests());
0032 SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_3_1));
0033
0034
0035 event_init_sampling(&event, EventCode);
0036 event.attr.sample_regs_intr = platform_extended_mask;
0037 event.attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
0038 event.attr.branch_sample_type = PERF_SAMPLE_BRANCH_ANY;
0039 event.attr.exclude_kernel = 1;
0040
0041 FAIL_IF(event_open(&event));
0042 event.mmap_buffer = event_sample_buf_mmap(event.fd, 1);
0043
0044 FAIL_IF(event_enable(&event));
0045
0046
0047 thirty_two_instruction_loop(10000);
0048
0049 FAIL_IF(event_disable(&event));
0050
0051 intr_regs = get_intr_regs(&event, event.mmap_buffer);
0052
0053
0054 FAIL_IF(!intr_regs);
0055
0056
0057 FAIL_IF(get_mmcra_bhrb_disable(get_reg_value(intr_regs, "MMCRA"), 5));
0058
0059 event_close(&event);
0060 return 0;
0061 }
0062
0063 int main(void)
0064 {
0065 return test_harness(mmcra_bhrb_disable_test, "mmcra_bhrb_disable_test");
0066 }