tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c- Extension
.c- Size
- 2278 bytes
- Lines
- 111
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdio.h../event.h../sampling_tests/misc.h
Detected Declarations
function event_alternatives_tests_p10function main
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2022, Athira Rajeev, IBM Corp.
*/
#include <stdio.h>
#include "../event.h"
#include "../sampling_tests/misc.h"
#define PM_RUN_CYC_ALT 0x200f4
#define PM_INST_DISP 0x200f2
#define PM_BR_2PATH 0x20036
#define PM_LD_MISS_L1 0x3e054
#define PM_RUN_INST_CMPL_ALT 0x400fa
#define EventCode_1 0x100fc
#define EventCode_2 0x200fa
#define EventCode_3 0x300fc
#define EventCode_4 0x400fc
/*
* Check for event alternatives.
*/
static int event_alternatives_tests_p10(void)
{
struct event *e, events[5];
int i;
int pvr = PVR_VER(mfspr(SPRN_PVR));
/* Check for platform support for the test */
SKIP_IF(platform_check_for_tests());
/*
* PVR check is used here since PMU specific data like
* alternative events is handled by respective PMU driver
* code and using PVR will work correctly for all cases
* including generic compat mode.
*/
SKIP_IF((pvr != POWER10) && (pvr != POWER11));
SKIP_IF(check_for_generic_compat_pmu());
/*
* Test for event alternative for 0x0001e
* and 0x00002.
*/
e = &events[0];
event_init(e, 0x0001e);
e = &events[1];
event_init(e, EventCode_1);
e = &events[2];
event_init(e, EventCode_2);
e = &events[3];
event_init(e, EventCode_3);
e = &events[4];
event_init(e, EventCode_4);
FAIL_IF(event_open(&events[0]));
/*
* Expected to pass since 0x0001e has alternative event
* 0x600f4 in PMC6. So it can go in with other events
* in PMC1 to PMC4.
*/
for (i = 1; i < 5; i++)
FAIL_IF(event_open_with_group(&events[i], events[0].fd));
for (i = 0; i < 5; i++)
event_close(&events[i]);
e = &events[0];
event_init(e, 0x00002);
e = &events[1];
event_init(e, EventCode_1);
e = &events[2];
event_init(e, EventCode_2);
e = &events[3];
event_init(e, EventCode_3);
e = &events[4];
event_init(e, EventCode_4);
Annotation
- Immediate include surface: `stdio.h`, `../event.h`, `../sampling_tests/misc.h`.
- Detected declarations: `function event_alternatives_tests_p10`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.