18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* Driver for Intel Xeon Phi "Knights Corner" PMU */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#include <linux/perf_event.h> 58c2ecf20Sopenharmony_ci#include <linux/types.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <asm/hardirq.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include "../perf_event.h" 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistatic const u64 knc_perfmon_event_map[] = 128c2ecf20Sopenharmony_ci{ 138c2ecf20Sopenharmony_ci [PERF_COUNT_HW_CPU_CYCLES] = 0x002a, 148c2ecf20Sopenharmony_ci [PERF_COUNT_HW_INSTRUCTIONS] = 0x0016, 158c2ecf20Sopenharmony_ci [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0028, 168c2ecf20Sopenharmony_ci [PERF_COUNT_HW_CACHE_MISSES] = 0x0029, 178c2ecf20Sopenharmony_ci [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x0012, 188c2ecf20Sopenharmony_ci [PERF_COUNT_HW_BRANCH_MISSES] = 0x002b, 198c2ecf20Sopenharmony_ci}; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cistatic const u64 __initconst knc_hw_cache_event_ids 228c2ecf20Sopenharmony_ci [PERF_COUNT_HW_CACHE_MAX] 238c2ecf20Sopenharmony_ci [PERF_COUNT_HW_CACHE_OP_MAX] 248c2ecf20Sopenharmony_ci [PERF_COUNT_HW_CACHE_RESULT_MAX] = 258c2ecf20Sopenharmony_ci{ 268c2ecf20Sopenharmony_ci [ C(L1D) ] = { 278c2ecf20Sopenharmony_ci [ C(OP_READ) ] = { 288c2ecf20Sopenharmony_ci /* On Xeon Phi event "0" is a valid DATA_READ */ 298c2ecf20Sopenharmony_ci /* (L1 Data Cache Reads) Instruction. */ 308c2ecf20Sopenharmony_ci /* We code this as ARCH_PERFMON_EVENTSEL_INT as this */ 318c2ecf20Sopenharmony_ci /* bit will always be set in x86_pmu_hw_config(). */ 328c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = ARCH_PERFMON_EVENTSEL_INT, 338c2ecf20Sopenharmony_ci /* DATA_READ */ 348c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x0003, /* DATA_READ_MISS */ 358c2ecf20Sopenharmony_ci }, 368c2ecf20Sopenharmony_ci [ C(OP_WRITE) ] = { 378c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x0001, /* DATA_WRITE */ 388c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x0004, /* DATA_WRITE_MISS */ 398c2ecf20Sopenharmony_ci }, 408c2ecf20Sopenharmony_ci [ C(OP_PREFETCH) ] = { 418c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x0011, /* L1_DATA_PF1 */ 428c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x001c, /* L1_DATA_PF1_MISS */ 438c2ecf20Sopenharmony_ci }, 448c2ecf20Sopenharmony_ci }, 458c2ecf20Sopenharmony_ci [ C(L1I ) ] = { 468c2ecf20Sopenharmony_ci [ C(OP_READ) ] = { 478c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x000c, /* CODE_READ */ 488c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x000e, /* CODE_CACHE_MISS */ 498c2ecf20Sopenharmony_ci }, 508c2ecf20Sopenharmony_ci [ C(OP_WRITE) ] = { 518c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = -1, 528c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = -1, 538c2ecf20Sopenharmony_ci }, 548c2ecf20Sopenharmony_ci [ C(OP_PREFETCH) ] = { 558c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x0, 568c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x0, 578c2ecf20Sopenharmony_ci }, 588c2ecf20Sopenharmony_ci }, 598c2ecf20Sopenharmony_ci [ C(LL ) ] = { 608c2ecf20Sopenharmony_ci [ C(OP_READ) ] = { 618c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0, 628c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x10cb, /* L2_READ_MISS */ 638c2ecf20Sopenharmony_ci }, 648c2ecf20Sopenharmony_ci [ C(OP_WRITE) ] = { 658c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x10cc, /* L2_WRITE_HIT */ 668c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0, 678c2ecf20Sopenharmony_ci }, 688c2ecf20Sopenharmony_ci [ C(OP_PREFETCH) ] = { 698c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x10fc, /* L2_DATA_PF2 */ 708c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x10fe, /* L2_DATA_PF2_MISS */ 718c2ecf20Sopenharmony_ci }, 728c2ecf20Sopenharmony_ci }, 738c2ecf20Sopenharmony_ci [ C(DTLB) ] = { 748c2ecf20Sopenharmony_ci [ C(OP_READ) ] = { 758c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = ARCH_PERFMON_EVENTSEL_INT, 768c2ecf20Sopenharmony_ci /* DATA_READ */ 778c2ecf20Sopenharmony_ci /* see note on L1 OP_READ */ 788c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x0002, /* DATA_PAGE_WALK */ 798c2ecf20Sopenharmony_ci }, 808c2ecf20Sopenharmony_ci [ C(OP_WRITE) ] = { 818c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x0001, /* DATA_WRITE */ 828c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x0002, /* DATA_PAGE_WALK */ 838c2ecf20Sopenharmony_ci }, 848c2ecf20Sopenharmony_ci [ C(OP_PREFETCH) ] = { 858c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x0, 868c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x0, 878c2ecf20Sopenharmony_ci }, 888c2ecf20Sopenharmony_ci }, 898c2ecf20Sopenharmony_ci [ C(ITLB) ] = { 908c2ecf20Sopenharmony_ci [ C(OP_READ) ] = { 918c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x000c, /* CODE_READ */ 928c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x000d, /* CODE_PAGE_WALK */ 938c2ecf20Sopenharmony_ci }, 948c2ecf20Sopenharmony_ci [ C(OP_WRITE) ] = { 958c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = -1, 968c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = -1, 978c2ecf20Sopenharmony_ci }, 988c2ecf20Sopenharmony_ci [ C(OP_PREFETCH) ] = { 998c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = -1, 1008c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = -1, 1018c2ecf20Sopenharmony_ci }, 1028c2ecf20Sopenharmony_ci }, 1038c2ecf20Sopenharmony_ci [ C(BPU ) ] = { 1048c2ecf20Sopenharmony_ci [ C(OP_READ) ] = { 1058c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = 0x0012, /* BRANCHES */ 1068c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = 0x002b, /* BRANCHES_MISPREDICTED */ 1078c2ecf20Sopenharmony_ci }, 1088c2ecf20Sopenharmony_ci [ C(OP_WRITE) ] = { 1098c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = -1, 1108c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = -1, 1118c2ecf20Sopenharmony_ci }, 1128c2ecf20Sopenharmony_ci [ C(OP_PREFETCH) ] = { 1138c2ecf20Sopenharmony_ci [ C(RESULT_ACCESS) ] = -1, 1148c2ecf20Sopenharmony_ci [ C(RESULT_MISS) ] = -1, 1158c2ecf20Sopenharmony_ci }, 1168c2ecf20Sopenharmony_ci }, 1178c2ecf20Sopenharmony_ci}; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_cistatic u64 knc_pmu_event_map(int hw_event) 1218c2ecf20Sopenharmony_ci{ 1228c2ecf20Sopenharmony_ci return knc_perfmon_event_map[hw_event]; 1238c2ecf20Sopenharmony_ci} 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_cistatic struct event_constraint knc_event_constraints[] = 1268c2ecf20Sopenharmony_ci{ 1278c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xc3, 0x1), /* HWP_L2HIT */ 1288c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xc4, 0x1), /* HWP_L2MISS */ 1298c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xc8, 0x1), /* L2_READ_HIT_E */ 1308c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xc9, 0x1), /* L2_READ_HIT_M */ 1318c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xca, 0x1), /* L2_READ_HIT_S */ 1328c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* L2_READ_MISS */ 1338c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xcc, 0x1), /* L2_WRITE_HIT */ 1348c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xce, 0x1), /* L2_STRONGLY_ORDERED_STREAMING_VSTORES_MISS */ 1358c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xcf, 0x1), /* L2_WEAKLY_ORDERED_STREAMING_VSTORE_MISS */ 1368c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xd7, 0x1), /* L2_VICTIM_REQ_WITH_DATA */ 1378c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xe3, 0x1), /* SNP_HITM_BUNIT */ 1388c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xe6, 0x1), /* SNP_HIT_L2 */ 1398c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xe7, 0x1), /* SNP_HITM_L2 */ 1408c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xf1, 0x1), /* L2_DATA_READ_MISS_CACHE_FILL */ 1418c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xf2, 0x1), /* L2_DATA_WRITE_MISS_CACHE_FILL */ 1428c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xf6, 0x1), /* L2_DATA_READ_MISS_MEM_FILL */ 1438c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xf7, 0x1), /* L2_DATA_WRITE_MISS_MEM_FILL */ 1448c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xfc, 0x1), /* L2_DATA_PF2 */ 1458c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xfd, 0x1), /* L2_DATA_PF2_DROP */ 1468c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xfe, 0x1), /* L2_DATA_PF2_MISS */ 1478c2ecf20Sopenharmony_ci INTEL_EVENT_CONSTRAINT(0xff, 0x1), /* L2_DATA_HIT_INFLIGHT_PF2 */ 1488c2ecf20Sopenharmony_ci EVENT_CONSTRAINT_END 1498c2ecf20Sopenharmony_ci}; 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci#define MSR_KNC_IA32_PERF_GLOBAL_STATUS 0x0000002d 1528c2ecf20Sopenharmony_ci#define MSR_KNC_IA32_PERF_GLOBAL_OVF_CONTROL 0x0000002e 1538c2ecf20Sopenharmony_ci#define MSR_KNC_IA32_PERF_GLOBAL_CTRL 0x0000002f 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci#define KNC_ENABLE_COUNTER0 0x00000001 1568c2ecf20Sopenharmony_ci#define KNC_ENABLE_COUNTER1 0x00000002 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_cistatic void knc_pmu_disable_all(void) 1598c2ecf20Sopenharmony_ci{ 1608c2ecf20Sopenharmony_ci u64 val; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci rdmsrl(MSR_KNC_IA32_PERF_GLOBAL_CTRL, val); 1638c2ecf20Sopenharmony_ci val &= ~(KNC_ENABLE_COUNTER0|KNC_ENABLE_COUNTER1); 1648c2ecf20Sopenharmony_ci wrmsrl(MSR_KNC_IA32_PERF_GLOBAL_CTRL, val); 1658c2ecf20Sopenharmony_ci} 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_cistatic void knc_pmu_enable_all(int added) 1688c2ecf20Sopenharmony_ci{ 1698c2ecf20Sopenharmony_ci u64 val; 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci rdmsrl(MSR_KNC_IA32_PERF_GLOBAL_CTRL, val); 1728c2ecf20Sopenharmony_ci val |= (KNC_ENABLE_COUNTER0|KNC_ENABLE_COUNTER1); 1738c2ecf20Sopenharmony_ci wrmsrl(MSR_KNC_IA32_PERF_GLOBAL_CTRL, val); 1748c2ecf20Sopenharmony_ci} 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_cistatic inline void 1778c2ecf20Sopenharmony_ciknc_pmu_disable_event(struct perf_event *event) 1788c2ecf20Sopenharmony_ci{ 1798c2ecf20Sopenharmony_ci struct hw_perf_event *hwc = &event->hw; 1808c2ecf20Sopenharmony_ci u64 val; 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci val = hwc->config; 1838c2ecf20Sopenharmony_ci val &= ~ARCH_PERFMON_EVENTSEL_ENABLE; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci (void)wrmsrl_safe(hwc->config_base + hwc->idx, val); 1868c2ecf20Sopenharmony_ci} 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_cistatic void knc_pmu_enable_event(struct perf_event *event) 1898c2ecf20Sopenharmony_ci{ 1908c2ecf20Sopenharmony_ci struct hw_perf_event *hwc = &event->hw; 1918c2ecf20Sopenharmony_ci u64 val; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci val = hwc->config; 1948c2ecf20Sopenharmony_ci val |= ARCH_PERFMON_EVENTSEL_ENABLE; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci (void)wrmsrl_safe(hwc->config_base + hwc->idx, val); 1978c2ecf20Sopenharmony_ci} 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_cistatic inline u64 knc_pmu_get_status(void) 2008c2ecf20Sopenharmony_ci{ 2018c2ecf20Sopenharmony_ci u64 status; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci rdmsrl(MSR_KNC_IA32_PERF_GLOBAL_STATUS, status); 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci return status; 2068c2ecf20Sopenharmony_ci} 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_cistatic inline void knc_pmu_ack_status(u64 ack) 2098c2ecf20Sopenharmony_ci{ 2108c2ecf20Sopenharmony_ci wrmsrl(MSR_KNC_IA32_PERF_GLOBAL_OVF_CONTROL, ack); 2118c2ecf20Sopenharmony_ci} 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_cistatic int knc_pmu_handle_irq(struct pt_regs *regs) 2148c2ecf20Sopenharmony_ci{ 2158c2ecf20Sopenharmony_ci struct perf_sample_data data; 2168c2ecf20Sopenharmony_ci struct cpu_hw_events *cpuc; 2178c2ecf20Sopenharmony_ci int handled = 0; 2188c2ecf20Sopenharmony_ci int bit, loops; 2198c2ecf20Sopenharmony_ci u64 status; 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci cpuc = this_cpu_ptr(&cpu_hw_events); 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci knc_pmu_disable_all(); 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci status = knc_pmu_get_status(); 2268c2ecf20Sopenharmony_ci if (!status) { 2278c2ecf20Sopenharmony_ci knc_pmu_enable_all(0); 2288c2ecf20Sopenharmony_ci return handled; 2298c2ecf20Sopenharmony_ci } 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci loops = 0; 2328c2ecf20Sopenharmony_ciagain: 2338c2ecf20Sopenharmony_ci knc_pmu_ack_status(status); 2348c2ecf20Sopenharmony_ci if (++loops > 100) { 2358c2ecf20Sopenharmony_ci WARN_ONCE(1, "perf: irq loop stuck!\n"); 2368c2ecf20Sopenharmony_ci perf_event_print_debug(); 2378c2ecf20Sopenharmony_ci goto done; 2388c2ecf20Sopenharmony_ci } 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci inc_irq_stat(apic_perf_irqs); 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci for_each_set_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) { 2438c2ecf20Sopenharmony_ci struct perf_event *event = cpuc->events[bit]; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci handled++; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci if (!test_bit(bit, cpuc->active_mask)) 2488c2ecf20Sopenharmony_ci continue; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci if (!intel_pmu_save_and_restart(event)) 2518c2ecf20Sopenharmony_ci continue; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci perf_sample_data_init(&data, 0, event->hw.last_period); 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci if (perf_event_overflow(event, &data, regs)) 2568c2ecf20Sopenharmony_ci x86_pmu_stop(event, 0); 2578c2ecf20Sopenharmony_ci } 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci /* 2608c2ecf20Sopenharmony_ci * Repeat if there is more work to be done: 2618c2ecf20Sopenharmony_ci */ 2628c2ecf20Sopenharmony_ci status = knc_pmu_get_status(); 2638c2ecf20Sopenharmony_ci if (status) 2648c2ecf20Sopenharmony_ci goto again; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_cidone: 2678c2ecf20Sopenharmony_ci /* Only restore PMU state when it's active. See x86_pmu_disable(). */ 2688c2ecf20Sopenharmony_ci if (cpuc->enabled) 2698c2ecf20Sopenharmony_ci knc_pmu_enable_all(0); 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci return handled; 2728c2ecf20Sopenharmony_ci} 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ciPMU_FORMAT_ATTR(event, "config:0-7" ); 2768c2ecf20Sopenharmony_ciPMU_FORMAT_ATTR(umask, "config:8-15" ); 2778c2ecf20Sopenharmony_ciPMU_FORMAT_ATTR(edge, "config:18" ); 2788c2ecf20Sopenharmony_ciPMU_FORMAT_ATTR(inv, "config:23" ); 2798c2ecf20Sopenharmony_ciPMU_FORMAT_ATTR(cmask, "config:24-31" ); 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_cistatic struct attribute *intel_knc_formats_attr[] = { 2828c2ecf20Sopenharmony_ci &format_attr_event.attr, 2838c2ecf20Sopenharmony_ci &format_attr_umask.attr, 2848c2ecf20Sopenharmony_ci &format_attr_edge.attr, 2858c2ecf20Sopenharmony_ci &format_attr_inv.attr, 2868c2ecf20Sopenharmony_ci &format_attr_cmask.attr, 2878c2ecf20Sopenharmony_ci NULL, 2888c2ecf20Sopenharmony_ci}; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_cistatic const struct x86_pmu knc_pmu __initconst = { 2918c2ecf20Sopenharmony_ci .name = "knc", 2928c2ecf20Sopenharmony_ci .handle_irq = knc_pmu_handle_irq, 2938c2ecf20Sopenharmony_ci .disable_all = knc_pmu_disable_all, 2948c2ecf20Sopenharmony_ci .enable_all = knc_pmu_enable_all, 2958c2ecf20Sopenharmony_ci .enable = knc_pmu_enable_event, 2968c2ecf20Sopenharmony_ci .disable = knc_pmu_disable_event, 2978c2ecf20Sopenharmony_ci .hw_config = x86_pmu_hw_config, 2988c2ecf20Sopenharmony_ci .schedule_events = x86_schedule_events, 2998c2ecf20Sopenharmony_ci .eventsel = MSR_KNC_EVNTSEL0, 3008c2ecf20Sopenharmony_ci .perfctr = MSR_KNC_PERFCTR0, 3018c2ecf20Sopenharmony_ci .event_map = knc_pmu_event_map, 3028c2ecf20Sopenharmony_ci .max_events = ARRAY_SIZE(knc_perfmon_event_map), 3038c2ecf20Sopenharmony_ci .apic = 1, 3048c2ecf20Sopenharmony_ci .max_period = (1ULL << 39) - 1, 3058c2ecf20Sopenharmony_ci .version = 0, 3068c2ecf20Sopenharmony_ci .num_counters = 2, 3078c2ecf20Sopenharmony_ci .cntval_bits = 40, 3088c2ecf20Sopenharmony_ci .cntval_mask = (1ULL << 40) - 1, 3098c2ecf20Sopenharmony_ci .get_event_constraints = x86_get_event_constraints, 3108c2ecf20Sopenharmony_ci .event_constraints = knc_event_constraints, 3118c2ecf20Sopenharmony_ci .format_attrs = intel_knc_formats_attr, 3128c2ecf20Sopenharmony_ci}; 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci__init int knc_pmu_init(void) 3158c2ecf20Sopenharmony_ci{ 3168c2ecf20Sopenharmony_ci x86_pmu = knc_pmu; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci memcpy(hw_cache_event_ids, knc_hw_cache_event_ids, 3198c2ecf20Sopenharmony_ci sizeof(hw_cache_event_ids)); 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci return 0; 3228c2ecf20Sopenharmony_ci} 323