Blame src/libpfm-3.y/include/perfmon/pfmlib_gen_ia32.h

Packit Service a1973e
/*
Packit Service a1973e
 * Intel architectural PMU v1, v2, v3
Packit Service a1973e
 *
Packit Service a1973e
 * Copyright (c) 2006-2007 Hewlett-Packard Development Company, L.P.
Packit Service a1973e
 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
Packit Service a1973e
 *
Packit Service a1973e
 * Permission is hereby granted, free of charge, to any person obtaining a copy
Packit Service a1973e
 * of this software and associated documentation files (the "Software"), to deal
Packit Service a1973e
 * in the Software without restriction, including without limitation the rights
Packit Service a1973e
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
Packit Service a1973e
 * of the Software, and to permit persons to whom the Software is furnished to do so,
Packit Service a1973e
 * subject to the following conditions:
Packit Service a1973e
 *
Packit Service a1973e
 * The above copyright notice and this permission notice shall be included in all
Packit Service a1973e
 * copies or substantial portions of the Software.
Packit Service a1973e
 *
Packit Service a1973e
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
Packit Service a1973e
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
Packit Service a1973e
 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
Packit Service a1973e
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Packit Service a1973e
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
Packit Service a1973e
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit Service a1973e
 */
Packit Service a1973e
#ifndef __PFMLIB_GEN_IA32_H__
Packit Service a1973e
#define __PFMLIB_GEN_IA32_H__
Packit Service a1973e
Packit Service a1973e
#include <perfmon/pfmlib.h>
Packit Service a1973e
/*
Packit Service a1973e
 * privilege level mask usage for architected PMU:
Packit Service a1973e
 *
Packit Service a1973e
 * PFM_PLM0 = OS (kernel, hypervisor, ..)
Packit Service a1973e
 * PFM_PLM1 = unused (ignored)
Packit Service a1973e
 * PFM_PLM2 = unused (ignored)
Packit Service a1973e
 * PFM_PLM3 = USR (user level)
Packit Service a1973e
 */
Packit Service a1973e
Packit Service a1973e
#ifdef __cplusplus
Packit Service a1973e
extern "C" {
Packit Service a1973e
#endif
Packit Service a1973e
Packit Service a1973e
/* 
Packit Service a1973e
 * upper limit, actual number determined dynamically
Packit Service a1973e
 */
Packit Service a1973e
#define PMU_GEN_IA32_MAX_COUNTERS PFMLIB_MAX_PMCS
Packit Service a1973e
Packit Service a1973e
/*
Packit Service a1973e
 * Even though, CPUID 0xa returns in eax the actual counter
Packit Service a1973e
 * width, the architecture specifies that writes are limited
Packit Service a1973e
 * to lower 32-bits. As such, only the lower 32-bit have full
Packit Service a1973e
 * degree of freedom. That is the "useable" counter width.
Packit Service a1973e
 */
Packit Service a1973e
#define PMU_GEN_IA32_COUNTER_WIDTH       32
Packit Service a1973e
Packit Service a1973e
typedef union {
Packit Service a1973e
	unsigned long long val;			/* complete register value */
Packit Service a1973e
	struct {
Packit Service a1973e
		unsigned long sel_event_select:8;	/* event mask */
Packit Service a1973e
		unsigned long sel_unit_mask:8;		/* unit mask */
Packit Service a1973e
		unsigned long sel_usr:1;		/* user level */
Packit Service a1973e
		unsigned long sel_os:1;			/* system level */
Packit Service a1973e
		unsigned long sel_edge:1;		/* edge detec */
Packit Service a1973e
		unsigned long sel_pc:1;			/* pin control */
Packit Service a1973e
		unsigned long sel_int:1;		/* enable APIC intr */
Packit Service a1973e
		unsigned long sel_any:1;		/* any thread (v3) */
Packit Service a1973e
		unsigned long sel_en:1;			/* enable */
Packit Service a1973e
		unsigned long sel_inv:1;		/* invert counter mask */
Packit Service a1973e
		unsigned long sel_cnt_mask:8;		/* counter mask */
Packit Service a1973e
		unsigned long sel_res2:32;
Packit Service a1973e
	} perfevtsel;
Packit Service a1973e
} pfm_gen_ia32_sel_reg_t;
Packit Service a1973e
Packit Service a1973e
typedef struct {
Packit Service a1973e
	unsigned long		cnt_mask;	/* threshold (cnt_mask)  */
Packit Service a1973e
	unsigned int		flags;		/* counter specific flag */
Packit Service a1973e
} pfmlib_gen_ia32_counter_t;
Packit Service a1973e
Packit Service a1973e
#define PFM_GEN_IA32_SEL_INV	0x1	/* inverse */
Packit Service a1973e
#define PFM_GEN_IA32_SEL_EDGE	0x2	/* edge detect */
Packit Service a1973e
#define PFM_GEN_IA32_SEL_ANYTHR 0x4	/* measure on any thread (v3 and up) */
Packit Service a1973e
Packit Service a1973e
/*
Packit Service a1973e
 * model-specific parameters for the library
Packit Service a1973e
 */
Packit Service a1973e
typedef struct {
Packit Service a1973e
	pfmlib_gen_ia32_counter_t	pfp_gen_ia32_counters[PMU_GEN_IA32_MAX_COUNTERS];
Packit Service a1973e
	uint64_t			reserved[4];	/* for future use */
Packit Service a1973e
} pfmlib_gen_ia32_input_param_t;
Packit Service a1973e
Packit Service a1973e
typedef struct {
Packit Service a1973e
	uint64_t	reserved[8];		/* for future use */
Packit Service a1973e
} pfmlib_gen_ia32_output_param_t;
Packit Service a1973e
Packit Service a1973e
#ifdef __cplusplus /* extern C */
Packit Service a1973e
}
Packit Service a1973e
#endif
Packit Service a1973e
Packit Service a1973e
#endif /* __PFMLIB_GEN_IA32_H__ */