1 #include <linux/perf_event.h>
2 #include <linux/export.h>
3 #include <linux/types.h>
4 #include <linux/init.h>
5 #include <linux/slab.h>
6 #include <linux/delay.h>
7 #include <asm/apicdef.h>
9 #include "../perf_event.h"
11 static __initconst const u64 amd_hw_cache_event_ids
12 [PERF_COUNT_HW_CACHE_MAX]
13 [PERF_COUNT_HW_CACHE_OP_MAX]
14 [PERF_COUNT_HW_CACHE_RESULT_MAX] =
18 [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses */
19 [ C(RESULT_MISS) ] = 0x0141, /* Data Cache Misses */
22 [ C(RESULT_ACCESS) ] = 0,
23 [ C(RESULT_MISS) ] = 0,
25 [ C(OP_PREFETCH) ] = {
26 [ C(RESULT_ACCESS) ] = 0x0267, /* Data Prefetcher :attempts */
27 [ C(RESULT_MISS) ] = 0x0167, /* Data Prefetcher :cancelled */
32 [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction cache fetches */
33 [ C(RESULT_MISS) ] = 0x0081, /* Instruction cache misses */
36 [ C(RESULT_ACCESS) ] = -1,
37 [ C(RESULT_MISS) ] = -1,
39 [ C(OP_PREFETCH) ] = {
40 [ C(RESULT_ACCESS) ] = 0x014B, /* Prefetch Instructions :Load */
41 [ C(RESULT_MISS) ] = 0,
46 [ C(RESULT_ACCESS) ] = 0x037D, /* Requests to L2 Cache :IC+DC */
47 [ C(RESULT_MISS) ] = 0x037E, /* L2 Cache Misses : IC+DC */
50 [ C(RESULT_ACCESS) ] = 0x017F, /* L2 Fill/Writeback */
51 [ C(RESULT_MISS) ] = 0,
53 [ C(OP_PREFETCH) ] = {
54 [ C(RESULT_ACCESS) ] = 0,
55 [ C(RESULT_MISS) ] = 0,
60 [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses */
61 [ C(RESULT_MISS) ] = 0x0746, /* L1_DTLB_AND_L2_DLTB_MISS.ALL */
64 [ C(RESULT_ACCESS) ] = 0,
65 [ C(RESULT_MISS) ] = 0,
67 [ C(OP_PREFETCH) ] = {
68 [ C(RESULT_ACCESS) ] = 0,
69 [ C(RESULT_MISS) ] = 0,
74 [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes */
75 [ C(RESULT_MISS) ] = 0x0385, /* L1_ITLB_AND_L2_ITLB_MISS.ALL */
78 [ C(RESULT_ACCESS) ] = -1,
79 [ C(RESULT_MISS) ] = -1,
81 [ C(OP_PREFETCH) ] = {
82 [ C(RESULT_ACCESS) ] = -1,
83 [ C(RESULT_MISS) ] = -1,
88 [ C(RESULT_ACCESS) ] = 0x00c2, /* Retired Branch Instr. */
89 [ C(RESULT_MISS) ] = 0x00c3, /* Retired Mispredicted BI */
92 [ C(RESULT_ACCESS) ] = -1,
93 [ C(RESULT_MISS) ] = -1,
95 [ C(OP_PREFETCH) ] = {
96 [ C(RESULT_ACCESS) ] = -1,
97 [ C(RESULT_MISS) ] = -1,
102 [ C(RESULT_ACCESS) ] = 0xb8e9, /* CPU Request to Memory, l+r */
103 [ C(RESULT_MISS) ] = 0x98e9, /* CPU Request to Memory, r */
106 [ C(RESULT_ACCESS) ] = -1,
107 [ C(RESULT_MISS) ] = -1,
109 [ C(OP_PREFETCH) ] = {
110 [ C(RESULT_ACCESS) ] = -1,
111 [ C(RESULT_MISS) ] = -1,
117 * AMD Performance Monitor K7 and later.
119 static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] =
121 [PERF_COUNT_HW_CPU_CYCLES] = 0x0076,
122 [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
123 [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d,
124 [PERF_COUNT_HW_CACHE_MISSES] = 0x077e,
125 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2,
126 [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3,
127 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */
128 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */
131 static u64 amd_pmu_event_map(int hw_event)
133 return amd_perfmon_event_map[hw_event];
137 * Previously calculated offsets
139 static unsigned int event_offsets[X86_PMC_IDX_MAX] __read_mostly;
140 static unsigned int count_offsets[X86_PMC_IDX_MAX] __read_mostly;
144 * 4 counters starting at 0xc0010000 each offset by 1
146 * CPUs with core performance counter extensions:
147 * 6 counters starting at 0xc0010200 each offset by 2
149 static inline int amd_pmu_addr_offset(int index, bool eventsel)
157 offset = event_offsets[index];
159 offset = count_offsets[index];
164 if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
170 event_offsets[index] = offset;
172 count_offsets[index] = offset;
177 static int amd_core_hw_config(struct perf_event *event)
179 if (event->attr.exclude_host && event->attr.exclude_guest)
181 * When HO == GO == 1 the hardware treats that as GO == HO == 0
182 * and will count in both modes. We don't want to count in that
183 * case so we emulate no-counting by setting US = OS = 0.
185 event->hw.config &= ~(ARCH_PERFMON_EVENTSEL_USR |
186 ARCH_PERFMON_EVENTSEL_OS);
187 else if (event->attr.exclude_host)
188 event->hw.config |= AMD64_EVENTSEL_GUESTONLY;
189 else if (event->attr.exclude_guest)
190 event->hw.config |= AMD64_EVENTSEL_HOSTONLY;
196 * AMD64 events are detected based on their event codes.
198 static inline unsigned int amd_get_event_code(struct hw_perf_event *hwc)
200 return ((hwc->config >> 24) & 0x0f00) | (hwc->config & 0x00ff);
203 static inline int amd_is_nb_event(struct hw_perf_event *hwc)
205 return (hwc->config & 0xe0) == 0xe0;
208 static inline int amd_has_nb(struct cpu_hw_events *cpuc)
210 struct amd_nb *nb = cpuc->amd_nb;
212 return nb && nb->nb_id != -1;
215 static int amd_pmu_hw_config(struct perf_event *event)
219 /* pass precise event sampling to ibs: */
220 if (event->attr.precise_ip && get_ibs_caps())
223 if (has_branch_stack(event))
226 ret = x86_pmu_hw_config(event);
230 if (event->attr.type == PERF_TYPE_RAW)
231 event->hw.config |= event->attr.config & AMD64_RAW_EVENT_MASK;
233 return amd_core_hw_config(event);
236 static void __amd_put_nb_event_constraints(struct cpu_hw_events *cpuc,
237 struct perf_event *event)
239 struct amd_nb *nb = cpuc->amd_nb;
243 * need to scan whole list because event may not have
244 * been assigned during scheduling
246 * no race condition possible because event can only
247 * be removed on one CPU at a time AND PMU is disabled
250 for (i = 0; i < x86_pmu.num_counters; i++) {
251 if (cmpxchg(nb->owners + i, event, NULL) == event)
257 * AMD64 NorthBridge events need special treatment because
258 * counter access needs to be synchronized across all cores
259 * of a package. Refer to BKDG section 3.12
261 * NB events are events measuring L3 cache, Hypertransport
262 * traffic. They are identified by an event code >= 0xe00.
263 * They measure events on the NorthBride which is shared
264 * by all cores on a package. NB events are counted on a
265 * shared set of counters. When a NB event is programmed
266 * in a counter, the data actually comes from a shared
267 * counter. Thus, access to those counters needs to be
270 * We implement the synchronization such that no two cores
271 * can be measuring NB events using the same counters. Thus,
272 * we maintain a per-NB allocation table. The available slot
273 * is propagated using the event_constraint structure.
275 * We provide only one choice for each NB event based on
276 * the fact that only NB events have restrictions. Consequently,
277 * if a counter is available, there is a guarantee the NB event
278 * will be assigned to it. If no slot is available, an empty
279 * constraint is returned and scheduling will eventually fail
282 * Note that all cores attached the same NB compete for the same
283 * counters to host NB events, this is why we use atomic ops. Some
284 * multi-chip CPUs may have more than one NB.
286 * Given that resources are allocated (cmpxchg), they must be
287 * eventually freed for others to use. This is accomplished by
288 * calling __amd_put_nb_event_constraints()
290 * Non NB events are not impacted by this restriction.
292 static struct event_constraint *
293 __amd_get_nb_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event,
294 struct event_constraint *c)
296 struct hw_perf_event *hwc = &event->hw;
297 struct amd_nb *nb = cpuc->amd_nb;
298 struct perf_event *old;
308 * detect if already present, if so reuse
310 * cannot merge with actual allocation
311 * because of possible holes
313 * event can already be present yet not assigned (in hwc->idx)
314 * because of successive calls to x86_schedule_events() from
315 * hw_perf_group_sched_in() without hw_perf_enable()
317 for_each_set_bit(idx, c->idxmsk, x86_pmu.num_counters) {
318 if (new == -1 || hwc->idx == idx)
319 /* assign free slot, prefer hwc->idx */
320 old = cmpxchg(nb->owners + idx, NULL, event);
321 else if (nb->owners[idx] == event)
322 /* event already present */
327 if (old && old != event)
330 /* reassign to this slot */
332 cmpxchg(nb->owners + new, event, NULL);
335 /* already present, reuse */
341 return &emptyconstraint;
343 return &nb->event_constraints[new];
346 static struct amd_nb *amd_alloc_nb(int cpu)
351 nb = kzalloc_node(sizeof(struct amd_nb), GFP_KERNEL, cpu_to_node(cpu));
358 * initialize all possible NB constraints
360 for (i = 0; i < x86_pmu.num_counters; i++) {
361 __set_bit(i, nb->event_constraints[i].idxmsk);
362 nb->event_constraints[i].weight = 1;
367 static int amd_pmu_cpu_prepare(int cpu)
369 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
371 WARN_ON_ONCE(cpuc->amd_nb);
373 if (!x86_pmu.amd_nb_constraints)
376 cpuc->amd_nb = amd_alloc_nb(cpu);
383 static void amd_pmu_cpu_starting(int cpu)
385 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
386 void **onln = &cpuc->kfree_on_online[X86_PERF_KFREE_SHARED];
390 cpuc->perf_ctr_virt_mask = AMD64_EVENTSEL_HOSTONLY;
392 if (!x86_pmu.amd_nb_constraints)
395 nb_id = amd_get_nb_id(cpu);
396 WARN_ON_ONCE(nb_id == BAD_APICID);
398 for_each_online_cpu(i) {
399 nb = per_cpu(cpu_hw_events, i).amd_nb;
400 if (WARN_ON_ONCE(!nb))
403 if (nb->nb_id == nb_id) {
404 *onln = cpuc->amd_nb;
410 cpuc->amd_nb->nb_id = nb_id;
411 cpuc->amd_nb->refcnt++;
414 static void amd_pmu_cpu_dead(int cpu)
416 struct cpu_hw_events *cpuhw;
418 if (!x86_pmu.amd_nb_constraints)
421 cpuhw = &per_cpu(cpu_hw_events, cpu);
424 struct amd_nb *nb = cpuhw->amd_nb;
426 if (nb->nb_id == -1 || --nb->refcnt == 0)
429 cpuhw->amd_nb = NULL;
434 * When a PMC counter overflows, an NMI is used to process the event and
435 * reset the counter. NMI latency can result in the counter being updated
436 * before the NMI can run, which can result in what appear to be spurious
437 * NMIs. This function is intended to wait for the NMI to run and reset
438 * the counter to avoid possible unhandled NMI messages.
440 #define OVERFLOW_WAIT_COUNT 50
442 static void amd_pmu_wait_on_overflow(int idx)
448 * Wait for the counter to be reset if it has overflowed. This loop
449 * should exit very, very quickly, but just in case, don't wait
452 for (i = 0; i < OVERFLOW_WAIT_COUNT; i++) {
453 rdmsrl(x86_pmu_event_addr(idx), counter);
454 if (counter & (1ULL << (x86_pmu.cntval_bits - 1)))
457 /* Might be in IRQ context, so can't sleep */
462 static void amd_pmu_disable_all(void)
464 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
467 x86_pmu_disable_all();
470 * This shouldn't be called from NMI context, but add a safeguard here
471 * to return, since if we're in NMI context we can't wait for an NMI
472 * to reset an overflowed counter value.
478 * Check each counter for overflow and wait for it to be reset by the
479 * NMI if it has overflowed. This relies on the fact that all active
480 * counters are always enabled when this function is caled and
481 * ARCH_PERFMON_EVENTSEL_INT is always set.
483 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
484 if (!test_bit(idx, cpuc->active_mask))
487 amd_pmu_wait_on_overflow(idx);
491 static struct event_constraint *
492 amd_get_event_constraints(struct cpu_hw_events *cpuc, int idx,
493 struct perf_event *event)
496 * if not NB event or no NB, then no constraints
498 if (!(amd_has_nb(cpuc) && amd_is_nb_event(&event->hw)))
499 return &unconstrained;
501 return __amd_get_nb_event_constraints(cpuc, event, NULL);
504 static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
505 struct perf_event *event)
507 if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))
508 __amd_put_nb_event_constraints(cpuc, event);
511 PMU_FORMAT_ATTR(event, "config:0-7,32-35");
512 PMU_FORMAT_ATTR(umask, "config:8-15" );
513 PMU_FORMAT_ATTR(edge, "config:18" );
514 PMU_FORMAT_ATTR(inv, "config:23" );
515 PMU_FORMAT_ATTR(cmask, "config:24-31" );
517 static struct attribute *amd_format_attr[] = {
518 &format_attr_event.attr,
519 &format_attr_umask.attr,
520 &format_attr_edge.attr,
521 &format_attr_inv.attr,
522 &format_attr_cmask.attr,
528 #define AMD_EVENT_TYPE_MASK 0x000000F0ULL
530 #define AMD_EVENT_FP 0x00000000ULL ... 0x00000010ULL
531 #define AMD_EVENT_LS 0x00000020ULL ... 0x00000030ULL
532 #define AMD_EVENT_DC 0x00000040ULL ... 0x00000050ULL
533 #define AMD_EVENT_CU 0x00000060ULL ... 0x00000070ULL
534 #define AMD_EVENT_IC_DE 0x00000080ULL ... 0x00000090ULL
535 #define AMD_EVENT_EX_LS 0x000000C0ULL
536 #define AMD_EVENT_DE 0x000000D0ULL
537 #define AMD_EVENT_NB 0x000000E0ULL ... 0x000000F0ULL
540 * AMD family 15h event code/PMC mappings:
542 * type = event_code & 0x0F0:
544 * 0x000 FP PERF_CTL[5:3]
545 * 0x010 FP PERF_CTL[5:3]
546 * 0x020 LS PERF_CTL[5:0]
547 * 0x030 LS PERF_CTL[5:0]
548 * 0x040 DC PERF_CTL[5:0]
549 * 0x050 DC PERF_CTL[5:0]
550 * 0x060 CU PERF_CTL[2:0]
551 * 0x070 CU PERF_CTL[2:0]
552 * 0x080 IC/DE PERF_CTL[2:0]
553 * 0x090 IC/DE PERF_CTL[2:0]
556 * 0x0C0 EX/LS PERF_CTL[5:0]
557 * 0x0D0 DE PERF_CTL[2:0]
558 * 0x0E0 NB NB_PERF_CTL[3:0]
559 * 0x0F0 NB NB_PERF_CTL[3:0]
563 * 0x000 FP PERF_CTL[3], PERF_CTL[5:3] (*)
564 * 0x003 FP PERF_CTL[3]
565 * 0x004 FP PERF_CTL[3], PERF_CTL[5:3] (*)
566 * 0x00B FP PERF_CTL[3]
567 * 0x00D FP PERF_CTL[3]
568 * 0x023 DE PERF_CTL[2:0]
569 * 0x02D LS PERF_CTL[3]
570 * 0x02E LS PERF_CTL[3,0]
571 * 0x031 LS PERF_CTL[2:0] (**)
572 * 0x043 CU PERF_CTL[2:0]
573 * 0x045 CU PERF_CTL[2:0]
574 * 0x046 CU PERF_CTL[2:0]
575 * 0x054 CU PERF_CTL[2:0]
576 * 0x055 CU PERF_CTL[2:0]
577 * 0x08F IC PERF_CTL[0]
578 * 0x187 DE PERF_CTL[0]
579 * 0x188 DE PERF_CTL[0]
580 * 0x0DB EX PERF_CTL[5:0]
581 * 0x0DC LS PERF_CTL[5:0]
582 * 0x0DD LS PERF_CTL[5:0]
583 * 0x0DE LS PERF_CTL[5:0]
584 * 0x0DF LS PERF_CTL[5:0]
585 * 0x1C0 EX PERF_CTL[5:3]
586 * 0x1D6 EX PERF_CTL[5:0]
587 * 0x1D8 EX PERF_CTL[5:0]
589 * (*) depending on the umask all FPU counters may be used
590 * (**) only one unitmask enabled at a time
593 static struct event_constraint amd_f15_PMC0 = EVENT_CONSTRAINT(0, 0x01, 0);
594 static struct event_constraint amd_f15_PMC20 = EVENT_CONSTRAINT(0, 0x07, 0);
595 static struct event_constraint amd_f15_PMC3 = EVENT_CONSTRAINT(0, 0x08, 0);
596 static struct event_constraint amd_f15_PMC30 = EVENT_CONSTRAINT_OVERLAP(0, 0x09, 0);
597 static struct event_constraint amd_f15_PMC50 = EVENT_CONSTRAINT(0, 0x3F, 0);
598 static struct event_constraint amd_f15_PMC53 = EVENT_CONSTRAINT(0, 0x38, 0);
600 static struct event_constraint *
601 amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, int idx,
602 struct perf_event *event)
604 struct hw_perf_event *hwc = &event->hw;
605 unsigned int event_code = amd_get_event_code(hwc);
607 switch (event_code & AMD_EVENT_TYPE_MASK) {
609 switch (event_code) {
611 if (!(hwc->config & 0x0000F000ULL))
613 if (!(hwc->config & 0x00000F00ULL))
615 return &amd_f15_PMC3;
617 if (hweight_long(hwc->config & ARCH_PERFMON_EVENTSEL_UMASK) <= 1)
619 return &amd_f15_PMC3;
623 return &amd_f15_PMC3;
625 return &amd_f15_PMC53;
628 case AMD_EVENT_EX_LS:
629 switch (event_code) {
636 return &amd_f15_PMC20;
638 return &amd_f15_PMC3;
640 return &amd_f15_PMC30;
642 if (hweight_long(hwc->config & ARCH_PERFMON_EVENTSEL_UMASK) <= 1)
643 return &amd_f15_PMC20;
644 return &emptyconstraint;
646 return &amd_f15_PMC53;
648 return &amd_f15_PMC50;
651 case AMD_EVENT_IC_DE:
653 switch (event_code) {
657 return &amd_f15_PMC0;
658 case 0x0DB ... 0x0DF:
661 return &amd_f15_PMC50;
663 return &amd_f15_PMC20;
666 /* moved to uncore.c */
667 return &emptyconstraint;
669 return &emptyconstraint;
673 static ssize_t amd_event_sysfs_show(char *page, u64 config)
675 u64 event = (config & ARCH_PERFMON_EVENTSEL_EVENT) |
676 (config & AMD64_EVENTSEL_EVENT) >> 24;
678 return x86_event_sysfs_show(page, config, event);
681 static __initconst const struct x86_pmu amd_pmu = {
683 .handle_irq = x86_pmu_handle_irq,
684 .disable_all = amd_pmu_disable_all,
685 .enable_all = x86_pmu_enable_all,
686 .enable = x86_pmu_enable_event,
687 .disable = x86_pmu_disable_event,
688 .hw_config = amd_pmu_hw_config,
689 .schedule_events = x86_schedule_events,
690 .eventsel = MSR_K7_EVNTSEL0,
691 .perfctr = MSR_K7_PERFCTR0,
692 .addr_offset = amd_pmu_addr_offset,
693 .event_map = amd_pmu_event_map,
694 .max_events = ARRAY_SIZE(amd_perfmon_event_map),
695 .num_counters = AMD64_NUM_COUNTERS,
697 .cntval_mask = (1ULL << 48) - 1,
699 /* use highest bit to detect overflow */
700 .max_period = (1ULL << 47) - 1,
701 .get_event_constraints = amd_get_event_constraints,
702 .put_event_constraints = amd_put_event_constraints,
704 .format_attrs = amd_format_attr,
705 .events_sysfs_show = amd_event_sysfs_show,
707 .cpu_prepare = amd_pmu_cpu_prepare,
708 .cpu_starting = amd_pmu_cpu_starting,
709 .cpu_dead = amd_pmu_cpu_dead,
711 .amd_nb_constraints = 1,
714 static int __init amd_core_pmu_init(void)
716 if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
719 switch (boot_cpu_data.x86) {
722 x86_pmu.get_event_constraints = amd_get_event_constraints_f15h;
727 * In family 17h, there are no event constraints in the PMC hardware.
728 * We fallback to using default amd_get_event_constraints.
733 /* Using default amd_get_event_constraints. */
736 pr_err("core perfctr but no constraints; unknown hardware!\n");
741 * If core performance counter extensions exists, we must use
742 * MSR_F15H_PERF_CTL/MSR_F15H_PERF_CTR msrs. See also
743 * amd_pmu_addr_offset().
745 x86_pmu.eventsel = MSR_F15H_PERF_CTL;
746 x86_pmu.perfctr = MSR_F15H_PERF_CTR;
747 x86_pmu.num_counters = AMD64_NUM_COUNTERS_CORE;
749 * AMD Core perfctr has separate MSRs for the NB events, see
750 * the amd/uncore.c driver.
752 x86_pmu.amd_nb_constraints = 0;
754 pr_cont("core perfctr, ");
758 __init int amd_pmu_init(void)
762 /* Performance-monitoring supported from K7 and later: */
763 if (boot_cpu_data.x86 < 6)
768 ret = amd_core_pmu_init();
772 if (num_possible_cpus() == 1) {
774 * No point in allocating data structures to serialize
775 * against other CPUs, when there is only the one CPU.
777 x86_pmu.amd_nb_constraints = 0;
780 /* Events are common for all AMDs */
781 memcpy(hw_cache_event_ids, amd_hw_cache_event_ids,
782 sizeof(hw_cache_event_ids));
787 void amd_pmu_enable_virt(void)
789 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
791 cpuc->perf_ctr_virt_mask = 0;
793 /* Reload all events */
794 amd_pmu_disable_all();
795 x86_pmu_enable_all(0);
797 EXPORT_SYMBOL_GPL(amd_pmu_enable_virt);
799 void amd_pmu_disable_virt(void)
801 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
804 * We only mask out the Host-only bit so that host-only counting works
805 * when SVM is disabled. If someone sets up a guest-only counter when
806 * SVM is disabled the Guest-only bits still gets set and the counter
807 * will not count anything.
809 cpuc->perf_ctr_virt_mask = AMD64_EVENTSEL_HOSTONLY;
811 /* Reload all events */
812 amd_pmu_disable_all();
813 x86_pmu_enable_all(0);
815 EXPORT_SYMBOL_GPL(amd_pmu_disable_virt);