Lines Matching +full:package +full:- +full:mode
20 * This file export cstate related free running (read-only) counters
27 * The events only support system-wide mode counting. There is no
32 * - 'cstate_core': The counter is available for each physical core.
34 * - 'cstate_pkg': The counter is available for each physical package.
37 * All of these counters are specified in the Intel® 64 and IA-32
63 * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter.
68 * Scope: Package (physical package)
69 * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter.
74 * Scope: Package (physical package)
75 * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter.
81 * Scope: Package (physical package)
82 * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter.
86 * Scope: Package (physical package)
87 * MSR_PKG_C8_RESIDENCY: Package C8 Residency Counter.
91 * Scope: Package (physical package)
92 * MSR_PKG_C9_RESIDENCY: Package C9 Residency Counter.
95 * Scope: Package (physical package)
96 * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter.
100 * Scope: Package (physical package)
113 #include <asm/intel-family.h>
131 /* Model -> events mapping */
156 PMU_EVENT_ATTR_STRING(c1-residency, attr_cstate_core_c1, "event=0x00");
157 PMU_EVENT_ATTR_STRING(c3-residency, attr_cstate_core_c3, "event=0x01");
158 PMU_EVENT_ATTR_STRING(c6-residency, attr_cstate_core_c6, "event=0x02");
159 PMU_EVENT_ATTR_STRING(c7-residency, attr_cstate_core_c7, "event=0x03");
194 DEFINE_CSTATE_FORMAT_ATTR(cstate_event, event, "config:0-63");
227 PMU_EVENT_ATTR_STRING(c2-residency, attr_cstate_pkg_c2, "event=0x00");
228 PMU_EVENT_ATTR_STRING(c3-residency, attr_cstate_pkg_c3, "event=0x01");
229 PMU_EVENT_ATTR_STRING(c6-residency, attr_cstate_pkg_c6, "event=0x02");
230 PMU_EVENT_ATTR_STRING(c7-residency, attr_cstate_pkg_c7, "event=0x03");
231 PMU_EVENT_ATTR_STRING(c8-residency, attr_cstate_pkg_c8, "event=0x04");
232 PMU_EVENT_ATTR_STRING(c9-residency, attr_cstate_pkg_c9, "event=0x05");
233 PMU_EVENT_ATTR_STRING(c10-residency, attr_cstate_pkg_c10, "event=0x06");
265 PMU_EVENT_ATTR_STRING(c6-residency, attr_cstate_module_c6, "event=0x00");
277 u64 cfg = event->attr.config; in cstate_pmu_event_init()
279 if (event->attr.type != event->pmu->type) in cstate_pmu_event_init()
280 return -ENOENT; in cstate_pmu_event_init()
283 if (event->attr.sample_period) /* no sampling */ in cstate_pmu_event_init()
284 return -EINVAL; in cstate_pmu_event_init()
286 if (event->cpu < 0) in cstate_pmu_event_init()
287 return -EINVAL; in cstate_pmu_event_init()
289 if (event->pmu == &cstate_core_pmu) { in cstate_pmu_event_init()
291 return -EINVAL; in cstate_pmu_event_init()
294 return -EINVAL; in cstate_pmu_event_init()
295 event->hw.event_base = core_msr[cfg].msr; in cstate_pmu_event_init()
296 } else if (event->pmu == &cstate_pkg_pmu) { in cstate_pmu_event_init()
298 return -EINVAL; in cstate_pmu_event_init()
301 return -EINVAL; in cstate_pmu_event_init()
302 event->hw.event_base = pkg_msr[cfg].msr; in cstate_pmu_event_init()
303 } else if (event->pmu == &cstate_module_pmu) { in cstate_pmu_event_init()
305 return -EINVAL; in cstate_pmu_event_init()
308 return -EINVAL; in cstate_pmu_event_init()
309 event->hw.event_base = module_msr[cfg].msr; in cstate_pmu_event_init()
311 return -ENOENT; in cstate_pmu_event_init()
314 event->hw.config = cfg; in cstate_pmu_event_init()
315 event->hw.idx = -1; in cstate_pmu_event_init()
323 rdmsrl(event->hw.event_base, val); in cstate_pmu_read_counter()
329 struct hw_perf_event *hwc = &event->hw; in cstate_pmu_event_update()
332 prev_raw_count = local64_read(&hwc->prev_count); in cstate_pmu_event_update()
335 } while (!local64_try_cmpxchg(&hwc->prev_count, in cstate_pmu_event_update()
338 local64_add(new_raw_count - prev_raw_count, &event->count); in cstate_pmu_event_update()
341 static void cstate_pmu_event_start(struct perf_event *event, int mode) in cstate_pmu_event_start() argument
343 local64_set(&event->hw.prev_count, cstate_pmu_read_counter(event)); in cstate_pmu_event_start()
346 static void cstate_pmu_event_stop(struct perf_event *event, int mode) in cstate_pmu_event_stop() argument
351 static void cstate_pmu_event_del(struct perf_event *event, int mode) in cstate_pmu_event_del() argument
356 static int cstate_pmu_event_add(struct perf_event *event, int mode) in cstate_pmu_event_add() argument
358 if (mode & PERF_EF_START) in cstate_pmu_event_add()
359 cstate_pmu_event_start(event, mode); in cstate_pmu_event_add()
661 if (cm->quirks & SLM_PKG_C6_USE_C7_MSR) in cstate_probe()
665 if (cm->quirks & KNL_CORE_C6_MSR) in cstate_probe()
670 true, (void *) &cm->core_events); in cstate_probe()
673 true, (void *) &cm->pkg_events); in cstate_probe()
676 true, (void *) &cm->module_events); in cstate_probe()
682 return (has_cstate_core || has_cstate_pkg || has_cstate_module) ? 0 : -ENODEV; in cstate_probe()
702 err = perf_pmu_register(&cstate_core_pmu, cstate_core_pmu.name, -1); in cstate_init()
713 /* CLX-AP is multi-die and the cstate is die-scope */ in cstate_init()
716 "cstate_die", -1); in cstate_init()
719 cstate_pkg_pmu.name, -1); in cstate_init()
730 err = perf_pmu_register(&cstate_module_pmu, cstate_module_pmu.name, -1); in cstate_init()
747 return -ENODEV; in cstate_pmu_init()
751 return -ENODEV; in cstate_pmu_init()
753 err = cstate_probe((const struct cstate_model *) id->driver_data); in cstate_pmu_init()