diff options
Diffstat (limited to 'arch/x86/include/asm/perf_event.h')
-rw-r--r-- | arch/x86/include/asm/perf_event.h | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index db6109a885a..254883d0c7e 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * Performance event hw details: | 5 | * Performance event hw details: |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define X86_PMC_MAX_GENERIC 8 | 8 | #define X86_PMC_MAX_GENERIC 32 |
9 | #define X86_PMC_MAX_FIXED 3 | 9 | #define X86_PMC_MAX_FIXED 3 |
10 | 10 | ||
11 | #define X86_PMC_IDX_GENERIC 0 | 11 | #define X86_PMC_IDX_GENERIC 0 |
@@ -18,39 +18,31 @@ | |||
18 | #define MSR_ARCH_PERFMON_EVENTSEL0 0x186 | 18 | #define MSR_ARCH_PERFMON_EVENTSEL0 0x186 |
19 | #define MSR_ARCH_PERFMON_EVENTSEL1 0x187 | 19 | #define MSR_ARCH_PERFMON_EVENTSEL1 0x187 |
20 | 20 | ||
21 | #define ARCH_PERFMON_EVENTSEL_ENABLE (1 << 22) | 21 | #define ARCH_PERFMON_EVENTSEL_EVENT 0x000000FFULL |
22 | #define ARCH_PERFMON_EVENTSEL_ANY (1 << 21) | 22 | #define ARCH_PERFMON_EVENTSEL_UMASK 0x0000FF00ULL |
23 | #define ARCH_PERFMON_EVENTSEL_INT (1 << 20) | 23 | #define ARCH_PERFMON_EVENTSEL_USR (1ULL << 16) |
24 | #define ARCH_PERFMON_EVENTSEL_OS (1 << 17) | 24 | #define ARCH_PERFMON_EVENTSEL_OS (1ULL << 17) |
25 | #define ARCH_PERFMON_EVENTSEL_USR (1 << 16) | 25 | #define ARCH_PERFMON_EVENTSEL_EDGE (1ULL << 18) |
26 | 26 | #define ARCH_PERFMON_EVENTSEL_INT (1ULL << 20) | |
27 | /* | 27 | #define ARCH_PERFMON_EVENTSEL_ANY (1ULL << 21) |
28 | * Includes eventsel and unit mask as well: | 28 | #define ARCH_PERFMON_EVENTSEL_ENABLE (1ULL << 22) |
29 | */ | 29 | #define ARCH_PERFMON_EVENTSEL_INV (1ULL << 23) |
30 | 30 | #define ARCH_PERFMON_EVENTSEL_CMASK 0xFF000000ULL | |
31 | 31 | ||
32 | #define INTEL_ARCH_EVTSEL_MASK 0x000000FFULL | 32 | #define AMD64_EVENTSEL_EVENT \ |
33 | #define INTEL_ARCH_UNIT_MASK 0x0000FF00ULL | 33 | (ARCH_PERFMON_EVENTSEL_EVENT | (0x0FULL << 32)) |
34 | #define INTEL_ARCH_EDGE_MASK 0x00040000ULL | 34 | #define INTEL_ARCH_EVENT_MASK \ |
35 | #define INTEL_ARCH_INV_MASK 0x00800000ULL | 35 | (ARCH_PERFMON_EVENTSEL_UMASK | ARCH_PERFMON_EVENTSEL_EVENT) |
36 | #define INTEL_ARCH_CNT_MASK 0xFF000000ULL | 36 | |
37 | #define INTEL_ARCH_EVENT_MASK (INTEL_ARCH_UNIT_MASK|INTEL_ARCH_EVTSEL_MASK) | 37 | #define X86_RAW_EVENT_MASK \ |
38 | 38 | (ARCH_PERFMON_EVENTSEL_EVENT | \ | |
39 | /* | 39 | ARCH_PERFMON_EVENTSEL_UMASK | \ |
40 | * filter mask to validate fixed counter events. | 40 | ARCH_PERFMON_EVENTSEL_EDGE | \ |
41 | * the following filters disqualify for fixed counters: | 41 | ARCH_PERFMON_EVENTSEL_INV | \ |
42 | * - inv | 42 | ARCH_PERFMON_EVENTSEL_CMASK) |
43 | * - edge | 43 | #define AMD64_RAW_EVENT_MASK \ |
44 | * - cnt-mask | 44 | (X86_RAW_EVENT_MASK | \ |
45 | * The other filters are supported by fixed counters. | 45 | AMD64_EVENTSEL_EVENT) |
46 | * The any-thread option is supported starting with v3. | ||
47 | */ | ||
48 | #define INTEL_ARCH_FIXED_MASK \ | ||
49 | (INTEL_ARCH_CNT_MASK| \ | ||
50 | INTEL_ARCH_INV_MASK| \ | ||
51 | INTEL_ARCH_EDGE_MASK|\ | ||
52 | INTEL_ARCH_UNIT_MASK|\ | ||
53 | INTEL_ARCH_EVENT_MASK) | ||
54 | 46 | ||
55 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c | 47 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c |
56 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) | 48 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) |
@@ -67,7 +59,7 @@ | |||
67 | union cpuid10_eax { | 59 | union cpuid10_eax { |
68 | struct { | 60 | struct { |
69 | unsigned int version_id:8; | 61 | unsigned int version_id:8; |
70 | unsigned int num_events:8; | 62 | unsigned int num_counters:8; |
71 | unsigned int bit_width:8; | 63 | unsigned int bit_width:8; |
72 | unsigned int mask_length:8; | 64 | unsigned int mask_length:8; |
73 | } split; | 65 | } split; |
@@ -76,7 +68,7 @@ union cpuid10_eax { | |||
76 | 68 | ||
77 | union cpuid10_edx { | 69 | union cpuid10_edx { |
78 | struct { | 70 | struct { |
79 | unsigned int num_events_fixed:4; | 71 | unsigned int num_counters_fixed:4; |
80 | unsigned int reserved:28; | 72 | unsigned int reserved:28; |
81 | } split; | 73 | } split; |
82 | unsigned int full; | 74 | unsigned int full; |
@@ -136,6 +128,18 @@ extern void perf_events_lapic_init(void); | |||
136 | 128 | ||
137 | #define PERF_EVENT_INDEX_OFFSET 0 | 129 | #define PERF_EVENT_INDEX_OFFSET 0 |
138 | 130 | ||
131 | /* | ||
132 | * Abuse bit 3 of the cpu eflags register to indicate proper PEBS IP fixups. | ||
133 | * This flag is otherwise unused and ABI specified to be 0, so nobody should | ||
134 | * care what we do with it. | ||
135 | */ | ||
136 | #define PERF_EFLAGS_EXACT (1UL << 3) | ||
137 | |||
138 | struct pt_regs; | ||
139 | extern unsigned long perf_instruction_pointer(struct pt_regs *regs); | ||
140 | extern unsigned long perf_misc_flags(struct pt_regs *regs); | ||
141 | #define perf_misc_flags(regs) perf_misc_flags(regs) | ||
142 | |||
139 | #else | 143 | #else |
140 | static inline void init_hw_perf_events(void) { } | 144 | static inline void init_hw_perf_events(void) { } |
141 | static inline void perf_events_lapic_init(void) { } | 145 | static inline void perf_events_lapic_init(void) { } |