2 * Copyright 2014, Michael Ellerman, IBM Corp.
3 * Licensed under GPLv2.
15 * Test that closing the EBB event clears MMCR0_PMCC, preventing further access
16 * by userspace to the PMU hardware.
19 int close_clears_pmcc(void)
23 event_init_named(&event
, 0x1001e, "cycles");
24 event_leader_ebb_init(&event
);
26 FAIL_IF(event_open(&event
));
28 ebb_enable_pmc_counting(1);
29 setup_ebb_handler(standard_ebb_callee
);
31 FAIL_IF(ebb_event_enable(&event
));
33 mtspr(SPRN_PMC1
, pmc_sample_period(sample_period
));
35 while (ebb_state
.stats
.ebb_count
< 1)
36 FAIL_IF(core_busy_loop());
41 FAIL_IF(ebb_state
.stats
.ebb_count
== 0);
43 /* The real test is here, do we take a SIGILL when writing PMU regs now
44 * that we have closed the event. We expect that we will. */
46 FAIL_IF(catch_sigill(write_pmc1
));
48 /* We should still be able to read EBB regs though */
58 return test_harness(close_clears_pmcc
, "close_clears_pmcc");
This page took 0.0525 seconds and 6 git commands to generate.