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

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