Lines Matching full:pmu

18  * DOC: Xe PMU (Performance Monitoring Unit)
82 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in event_to_gt()
90 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in event_to_hwe()
116 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in event_gt_forcewake()
141 static bool event_supported(struct xe_pmu *pmu, unsigned int gt, in event_supported() argument
147 return id < sizeof(pmu->supported_events) * BITS_PER_BYTE && in event_supported()
148 pmu->supported_events & BIT_ULL(id); in event_supported()
153 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in event_param_valid()
182 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_destroy()
200 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_init()
201 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_init() local
204 if (!pmu->registered) in xe_pmu_event_init()
207 if (event->attr.type != event->pmu->type) in xe_pmu_event_init()
219 if (!event_supported(pmu, gt, id)) in xe_pmu_event_init()
289 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_read()
290 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_read() local
292 if (!pmu->registered) { in xe_pmu_event_read()
312 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_start()
313 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_start() local
315 if (!pmu->registered) in xe_pmu_event_start()
324 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_stop()
325 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_stop() local
327 if (pmu->registered) in xe_pmu_event_stop()
336 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); in xe_pmu_event_add()
337 struct xe_pmu *pmu = &xe->pmu; in xe_pmu_event_add() local
339 if (!pmu->registered) in xe_pmu_event_add()
395 struct xe_pmu *pmu; \
398 pmu = container_of(dev_get_drvdata(kobj_to_dev(kobj)), \
399 typeof(*pmu), base); \
401 return event_supported(pmu, 0, id_) ? attr->mode : 0; \
440 static void set_supported_events(struct xe_pmu *pmu) in set_supported_events() argument
442 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu); in set_supported_events()
446 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_GT_C6_RESIDENCY); in set_supported_events()
449 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_ENGINE_ACTIVE_TICKS); in set_supported_events()
450 pmu->supported_events |= BIT_ULL(XE_PMU_EVENT_ENGINE_TOTAL_TICKS); in set_supported_events()
455 * xe_pmu_unregister() - Remove/cleanup PMU registration
456 * @arg: Ptr to pmu
460 struct xe_pmu *pmu = arg; in xe_pmu_unregister() local
461 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu); in xe_pmu_unregister()
463 if (!pmu->registered) in xe_pmu_unregister()
466 pmu->registered = false; in xe_pmu_unregister()
468 perf_pmu_unregister(&pmu->base); in xe_pmu_unregister()
469 kfree(pmu->name); in xe_pmu_unregister()
473 * xe_pmu_register() - Define basic PMU properties for Xe and add event callbacks.
474 * @pmu: the PMU object
478 int xe_pmu_register(struct xe_pmu *pmu) in xe_pmu_register() argument
480 struct xe_device *xe = container_of(pmu, typeof(*xe), pmu); in xe_pmu_register()
502 pmu->name = name; in xe_pmu_register()
503 pmu->base.attr_groups = attr_groups; in xe_pmu_register()
504 pmu->base.attr_update = pmu_events_attr_update; in xe_pmu_register()
505 pmu->base.scope = PERF_PMU_SCOPE_SYS_WIDE; in xe_pmu_register()
506 pmu->base.module = THIS_MODULE; in xe_pmu_register()
507 pmu->base.task_ctx_nr = perf_invalid_context; in xe_pmu_register()
508 pmu->base.event_init = xe_pmu_event_init; in xe_pmu_register()
509 pmu->base.add = xe_pmu_event_add; in xe_pmu_register()
510 pmu->base.del = xe_pmu_event_del; in xe_pmu_register()
511 pmu->base.start = xe_pmu_event_start; in xe_pmu_register()
512 pmu->base.stop = xe_pmu_event_stop; in xe_pmu_register()
513 pmu->base.read = xe_pmu_event_read; in xe_pmu_register()
515 set_supported_events(pmu); in xe_pmu_register()
517 ret = perf_pmu_register(&pmu->base, pmu->name, -1); in xe_pmu_register()
521 pmu->registered = true; in xe_pmu_register()
523 return devm_add_action_or_reset(xe->drm.dev, xe_pmu_unregister, pmu); in xe_pmu_register()
528 drm_err(&xe->drm, "Failed to register PMU (ret=%d)!\n", ret); in xe_pmu_register()