tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h
Extension
.h
Size
6044 bytes
Lines
237
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.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <sys/stat.h>
#include "../event.h"

#define POWER11 0x82
#define POWER10 0x80
#define POWER9  0x4e
#define PERF_POWER9_MASK        0x7f8ffffffffffff
#define PERF_POWER10_MASK       0x7ffffffffffffff
#define PERF_POWER11_MASK       PERF_POWER10_MASK

#define MMCR0_FC56      0x00000010UL /* freeze counters 5 and 6 */
#define MMCR0_PMCCEXT   0x00000200UL /* PMCCEXT control */
#define MMCR1_RSQ       0x200000000000ULL /* radix scope qual field */
#define BHRB_DISABLE    0x2000000000ULL /* MMCRA BHRB DISABLE bit */

extern int ev_mask_pmcxsel, ev_shift_pmcxsel;
extern int ev_mask_marked, ev_shift_marked;
extern int ev_mask_comb, ev_shift_comb;
extern int ev_mask_unit, ev_shift_unit;
extern int ev_mask_pmc, ev_shift_pmc;
extern int ev_mask_cache, ev_shift_cache;
extern int ev_mask_sample, ev_shift_sample;
extern int ev_mask_thd_sel, ev_shift_thd_sel;
extern int ev_mask_thd_start, ev_shift_thd_start;
extern int ev_mask_thd_stop, ev_shift_thd_stop;
extern int ev_mask_thd_cmp, ev_shift_thd_cmp;
extern int ev_mask_sm, ev_shift_sm;
extern int ev_mask_rsq, ev_shift_rsq;
extern int ev_mask_l2l3, ev_shift_l2l3;
extern int ev_mask_mmcr3_src, ev_shift_mmcr3_src;
extern int pvr;
extern u64 platform_extended_mask;
extern int check_pvr_for_sampling_tests(void);
extern int platform_check_for_tests(void);
extern int check_extended_regs_support(void);
extern u64 perf_get_platform_reg_mask(void);

/*
 * Event code field extraction macro.
 * Raw event code is combination of multiple
 * fields. Macro to extract individual fields
 *
 * x - Raw event code value
 * y - Field to extract
 */
#define EV_CODE_EXTRACT(x, y)   \
	((x >> ev_shift_##y) & ev_mask_##y)

void *event_sample_buf_mmap(int fd, int mmap_pages);
void *__event_read_samples(void *sample_buff, size_t *size, u64 *sample_count);
int collect_samples(void *sample_buff);
u64 *get_intr_regs(struct event *event, void *sample_buff);
u64 get_reg_value(u64 *intr_regs, char *register_name);
int get_thresh_cmp_val(struct event event);
bool check_for_generic_compat_pmu(void);
bool check_for_compat_mode(void);

static inline int get_mmcr0_fc56(u64 mmcr0, int pmc)
{
	return (mmcr0 & MMCR0_FC56);
}

static inline int get_mmcr0_pmccext(u64 mmcr0, int pmc)
{
	return (mmcr0 & MMCR0_PMCCEXT);
}

static inline int get_mmcr0_pmao(u64 mmcr0, int pmc)
{
	return ((mmcr0 >> 7) & 0x1);
}

static inline int get_mmcr0_cc56run(u64 mmcr0, int pmc)
{
	return ((mmcr0 >> 8) & 0x1);
}

static inline int get_mmcr0_pmcjce(u64 mmcr0, int pmc)
{
	return ((mmcr0 >> 14) & 0x1);
}

static inline int get_mmcr0_pmc1ce(u64 mmcr0, int pmc)
{
	return ((mmcr0 >> 15) & 0x1);
}

static inline int get_mmcr0_pmae(u64 mmcr0, int pmc)
{
	return ((mmcr0 >> 27) & 0x1);

Annotation

Implementation Notes