diff options
-rw-r--r-- | arch/x86/include/asm/perf_event.h | 15 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index c6998bc75456..b50e9d15aae0 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h | |||
@@ -95,6 +95,15 @@ union cpuid10_edx { | |||
95 | unsigned int full; | 95 | unsigned int full; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | struct x86_pmu_capability { | ||
99 | int version; | ||
100 | int num_counters_gp; | ||
101 | int num_counters_fixed; | ||
102 | int bit_width_gp; | ||
103 | int bit_width_fixed; | ||
104 | unsigned int events_mask; | ||
105 | int events_mask_len; | ||
106 | }; | ||
98 | 107 | ||
99 | /* | 108 | /* |
100 | * Fixed-purpose performance events: | 109 | * Fixed-purpose performance events: |
@@ -216,6 +225,7 @@ struct perf_guest_switch_msr { | |||
216 | }; | 225 | }; |
217 | 226 | ||
218 | extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr); | 227 | extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr); |
228 | extern void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap); | ||
219 | #else | 229 | #else |
220 | static inline perf_guest_switch_msr *perf_guest_get_msrs(int *nr) | 230 | static inline perf_guest_switch_msr *perf_guest_get_msrs(int *nr) |
221 | { | 231 | { |
@@ -223,6 +233,11 @@ static inline perf_guest_switch_msr *perf_guest_get_msrs(int *nr) | |||
223 | return NULL; | 233 | return NULL; |
224 | } | 234 | } |
225 | 235 | ||
236 | static inline void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap) | ||
237 | { | ||
238 | memset(cap, 0, sizeof(*cap)); | ||
239 | } | ||
240 | |||
226 | static inline void perf_events_lapic_init(void) { } | 241 | static inline void perf_events_lapic_init(void) { } |
227 | #endif | 242 | #endif |
228 | 243 | ||
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 55889e0b1452..930fe4879542 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -1696,3 +1696,15 @@ unsigned long perf_misc_flags(struct pt_regs *regs) | |||
1696 | 1696 | ||
1697 | return misc; | 1697 | return misc; |
1698 | } | 1698 | } |
1699 | |||
1700 | void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap) | ||
1701 | { | ||
1702 | cap->version = x86_pmu.version; | ||
1703 | cap->num_counters_gp = x86_pmu.num_counters; | ||
1704 | cap->num_counters_fixed = x86_pmu.num_counters_fixed; | ||
1705 | cap->bit_width_gp = x86_pmu.cntval_bits; | ||
1706 | cap->bit_width_fixed = x86_pmu.cntval_bits; | ||
1707 | cap->events_mask = (unsigned int)x86_pmu.events_maskl; | ||
1708 | cap->events_mask_len = x86_pmu.events_mask_len; | ||
1709 | } | ||
1710 | EXPORT_SYMBOL_GPL(perf_get_x86_pmu_capability); | ||