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
0017
0018
0019 static int mmcr0_cc56run(void)
0020 {
0021 struct event event;
0022 u64 *intr_regs;
0023
0024
0025 SKIP_IF(check_pvr_for_sampling_tests());
0026 SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_3_1));
0027
0028
0029 event_init_sampling(&event, 0x500fa);
0030 event.attr.sample_regs_intr = platform_extended_mask;
0031 FAIL_IF(event_open(&event));
0032 event.mmap_buffer = event_sample_buf_mmap(event.fd, 1);
0033
0034 FAIL_IF(event_enable(&event));
0035
0036
0037 thirty_two_instruction_loop(10000);
0038
0039 FAIL_IF(event_disable(&event));
0040
0041
0042 FAIL_IF(!collect_samples(event.mmap_buffer));
0043
0044 intr_regs = get_intr_regs(&event, event.mmap_buffer);
0045
0046
0047 FAIL_IF(!intr_regs);
0048
0049
0050 FAIL_IF(!get_mmcr0_cc56run(get_reg_value(intr_regs, "MMCR0"), 5));
0051
0052 event_close(&event);
0053 return 0;
0054 }
0055
0056 int main(void)
0057 {
0058 return test_harness(mmcr0_cc56run, "mmcr0_cc56run");
0059 }