Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/powerpc/pmu: Add selftest for reserved bit check for MMCRA thresh_ctl field

Testcase for reserved bits in Monitor Mode Control Register A (MMCRA)
thresh_ctl bits. For MMCRA[48:51]/[52:55]) Threshold Start/Stop,
0b11110000/0b00001111 is reserved.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220610134113.62991-25-atrajeev@linux.vnet.ibm.com

authored by

Athira Rajeev and committed by
Michael Ellerman
0c902633 5196a279

+45 -1
+1 -1
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile
··· 3 3 4 4 TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \ 5 5 group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \ 6 - group_constraint_mmcra_sample_test invalid_event_code_test 6 + group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test 7 7 8 8 top_srcdir = ../../../../../.. 9 9 include ../../../lib.mk
+44
tools/testing/selftests/powerpc/pmu/event_code_tests/reserved_bits_mmcra_thresh_ctl_test.c
··· 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 + 17 + static 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(&event, 0xf0340401e0); 33 + FAIL_IF(!event_open(&event)); 34 + 35 + event_init(&event, 0x0f340401e0); 36 + FAIL_IF(!event_open(&event)); 37 + 38 + return 0; 39 + } 40 + 41 + int main(void) 42 + { 43 + return test_harness(reserved_bits_mmcra_thresh_ctl, "reserved_bits_mmcra_thresh_ctl"); 44 + }