Lines Matching refs:pmu
93 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
101 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
135 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
160 static bool event_supported(struct xe_pmu *pmu, unsigned int gt_id,
163 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu);
169 return id < sizeof(pmu->supported_events) * BITS_PER_BYTE &&
170 pmu->supported_events & BIT_ULL(id);
175 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
216 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
234 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
235 struct xe_pmu *pmu = &xe->pmu;
238 if (!pmu->registered)
241 if (event->attr.type != event->pmu->type)
253 if (!event_supported(pmu, gt, id))
338 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
339 struct xe_pmu *pmu = &xe->pmu;
341 if (!pmu->registered) {
361 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
362 struct xe_pmu *pmu = &xe->pmu;
364 if (!pmu->registered)
373 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
374 struct xe_pmu *pmu = &xe->pmu;
376 if (pmu->registered)
385 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
386 struct xe_pmu *pmu = &xe->pmu;
388 if (!pmu->registered)
446 struct xe_pmu *pmu; \
449 pmu = container_of(dev_get_drvdata(kobj_to_dev(kobj)), \
450 typeof(*pmu), base); \
452 return event_supported(pmu, 0, id_) ? attr->mode : 0; \
497 static void set_supported_events(struct xe_pmu *pmu)
499 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu);
503 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_GT_C6_RESIDENCY);
504 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_GT_ACTUAL_FREQUENCY);
505 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_GT_REQUESTED_FREQUENCY);
509 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_ENGINE_ACTIVE_TICKS);
510 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_ENGINE_TOTAL_TICKS);
516 * @arg: Ptr to pmu
520 struct xe_pmu *pmu = arg;
521 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu);
523 if (!pmu->registered)
526 pmu->registered = false;
528 perf_pmu_unregister(&pmu->base);
529 kfree(pmu->name);
534 * @pmu: the PMU object
538 int xe_pmu_register(struct xe_pmu *pmu)
540 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu);
562 pmu->name = name;
563 pmu->base.attr_groups = attr_groups;
564 pmu->base.attr_update = pmu_events_attr_update;
565 pmu->base.scope = PERF_PMU_SCOPE_SYS_WIDE;
566 pmu->base.module = THIS_MODULE;
567 pmu->base.task_ctx_nr = perf_invalid_context;
568 pmu->base.event_init = xe_pmu_event_init;
569 pmu->base.add = xe_pmu_event_add;
570 pmu->base.del = xe_pmu_event_del;
571 pmu->base.start = xe_pmu_event_start;
572 pmu->base.stop = xe_pmu_event_stop;
573 pmu->base.read = xe_pmu_event_read;
575 set_supported_events(pmu);
577 ret = perf_pmu_register(&pmu->base, pmu->name, -1);
581 pmu->registered = true;
583 return devm_add_action_or_reset(xe->drm.dev, xe_pmu_unregister, pmu);