Lines Matching full:pmu
20 * DOC: Xe PMU (Performance Monitoring Unit)
93 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in event_to_gt()
101 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in event_to_hwe()
135 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in event_gt_forcewake()
160 static bool event_supported(struct xe_pmu *pmu, unsigned int gt_id, in event_supported() argument
163 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu); in event_supported()
169 return id < sizeof(pmu->supported_events) * BITS_PER_BYTE && in event_supported()
170 pmu->supported_events & BIT_ULL(id); in event_supported()
175 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in event_param_valid()
216 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_destroy()
234 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_init()
235 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_init() local
238 if (!pmu->registered) in xe_pmu_event_init()
241 if (event->attr.type != event->pmu->type) in xe_pmu_event_init()
253 if (!event_supported(pmu, gt, id)) in xe_pmu_event_init()
338 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_read()
339 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_read() local
341 if (!pmu->registered) { in xe_pmu_event_read()
361 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_start()
362 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_start() local
364 if (!pmu->registered) in xe_pmu_event_start()
373 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_stop()
374 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_stop() local
376 if (pmu->registered) in xe_pmu_event_stop()
385 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_add()
386 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_add() local
388 if (!pmu->registered) in xe_pmu_event_add()
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) in set_supported_events() argument
499 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu); in set_supported_events()
503 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_GT_C6_RESIDENCY); in set_supported_events()
504 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_GT_ACTUAL_FREQUENCY); in set_supported_events()
505 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_GT_REQUESTED_FREQUENCY); in set_supported_events()
509 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_ENGINE_ACTIVE_TICKS); in set_supported_events()
510 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_ENGINE_TOTAL_TICKS); in set_supported_events()
515 * xe_pmu_unregister() - Remove/cleanup PMU registration
516 * @arg: Ptr to pmu
520 struct xe_pmu *pmu = arg; in xe_pmu_unregister() local
521 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu); in xe_pmu_unregister()
523 if (!pmu->registered) in xe_pmu_unregister()
526 pmu->registered = false; in xe_pmu_unregister()
528 perf_pmu_unregister(&pmu->base); in xe_pmu_unregister()
529 kfree(pmu->name); in xe_pmu_unregister()
533 * xe_pmu_register() - Define basic PMU properties for Xe and add event callbacks.
534 * @pmu: the PMU object
538 int xe_pmu_register(struct xe_pmu *pmu) in xe_pmu_register() argument
540 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu); in xe_pmu_register()
562 pmu->name = name; in xe_pmu_register()
563 pmu->base.attr_groups = attr_groups; in xe_pmu_register()
564 pmu->base.attr_update = pmu_events_attr_update; in xe_pmu_register()
565 pmu->base.scope = PERF_PMU_SCOPE_SYS_WIDE; in xe_pmu_register()
566 pmu->base.module = THIS_MODULE; in xe_pmu_register()
567 pmu->base.task_ctx_nr = perf_invalid_context; in xe_pmu_register()
568 pmu->base.event_init = xe_pmu_event_init; in xe_pmu_register()
569 pmu->base.add = xe_pmu_event_add; in xe_pmu_register()
570 pmu->base.del = xe_pmu_event_del; in xe_pmu_register()
571 pmu->base.start = xe_pmu_event_start; in xe_pmu_register()
572 pmu->base.stop = xe_pmu_event_stop; in xe_pmu_register()
573 pmu->base.read = xe_pmu_event_read; in xe_pmu_register()
575 set_supported_events(pmu); in xe_pmu_register()
577 ret = perf_pmu_register(&pmu->base, pmu->name, -1); in xe_pmu_register()
581 pmu->registered = true; in xe_pmu_register()
583 return devm_add_action_or_reset(xe->drm.dev, xe_pmu_unregister, pmu); in xe_pmu_register()
588 drm_err(&xe->drm, "Failed to register PMU (ret=%d)!\n", ret); in xe_pmu_register()