1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright 2022, Athira Rajeev, IBM Corp.
4 */
5
6#include <stdio.h>
7#include "../event.h"
8#include "../sampling_tests/misc.h"
9
10/*
11 * Testcase for reserved bits in Monitor Mode
12 * Control Register A (MMCRA) thresh_ctl bits.
13 * For MMCRA[48:51]/[52:55]) Threshold Start/Stop,
14 * 0b11110000/0b00001111 is reserved.
15 */
16
17static int reserved_bits_mmcra_thresh_ctl(void)
18{
19 struct event event;
20
21 /* Check for platform support for the test */
22 SKIP_IF(platform_check_for_tests());
23
24 /* Skip for Generic compat PMU */
25 SKIP_IF(check_for_generic_compat_pmu());
26
27 /*
28 * MMCRA[48:51]/[52:55]) Threshold Start/Stop
29 * events Selection. 0b11110000/0b00001111 is reserved.
30 * Expected to fail when using these reserved values.
31 */
32 event_init(e: &event, config: 0xf0340401e0);
33 FAIL_IF(!event_open(e: &event));
34
35 event_init(e: &event, config: 0x0f340401e0);
36 FAIL_IF(!event_open(e: &event));
37
38 return 0;
39}
40
41int main(void)
42{
43 return test_harness(reserved_bits_mmcra_thresh_ctl, "reserved_bits_mmcra_thresh_ctl");
44}
45

source code of linux/tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_thresh_ctl_test.c