Lines Matching full:pmu

103 struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)  in uncore_pmu_to_box()  argument
111 return dieid < max_dies ? pmu->boxes[dieid] : NULL; in uncore_pmu_to_box()
342 * Using uncore_pmu_event_init pmu event_init callback
349 return &box->pmu->pmu == event->pmu; in is_box_event()
359 max_count = box->pmu->type->num_counters; in uncore_collect_events()
360 if (box->pmu->type->fixed_ctl) in uncore_collect_events()
393 struct intel_uncore_type *type = box->pmu->type; in uncore_get_event_constraint()
418 if (box->pmu->type->ops->put_constraint) in uncore_put_event_constraint()
419 box->pmu->type->ops->put_constraint(box, event); in uncore_put_event_constraint()
655 * PMU if it was the only group available.
657 static int uncore_validate_group(struct intel_uncore_pmu *pmu, in uncore_validate_group() argument
668 fake_box = uncore_alloc_box(pmu->type, NUMA_NO_NODE); in uncore_validate_group()
672 fake_box->pmu = pmu; in uncore_validate_group()
698 struct intel_uncore_pmu *pmu; in uncore_pmu_event_init() local
703 if (event->attr.type != event->pmu->type) in uncore_pmu_event_init()
706 pmu = uncore_event_to_pmu(event); in uncore_pmu_event_init()
707 /* no device found for this pmu */ in uncore_pmu_event_init()
708 if (pmu->func_id < 0) in uncore_pmu_event_init()
721 box = uncore_pmu_to_box(pmu, event->cpu); in uncore_pmu_event_init()
736 if (!pmu->type->fixed_ctl) in uncore_pmu_event_init()
739 * if there is only one fixed counter, only the first pmu in uncore_pmu_event_init()
742 if (pmu->type->single_fixed && pmu->pmu_idx > 0) in uncore_pmu_event_init()
761 (pmu->type->event_mask | ((u64)pmu->type->event_mask_ext << 32)); in uncore_pmu_event_init()
762 if (pmu->type->ops->hw_config) { in uncore_pmu_event_init()
763 ret = pmu->type->ops->hw_config(box, event); in uncore_pmu_event_init()
770 ret = uncore_validate_group(pmu, event); in uncore_pmu_event_init()
777 static void uncore_pmu_enable(struct pmu *pmu) in uncore_pmu_enable() argument
782 uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu); in uncore_pmu_enable()
794 static void uncore_pmu_disable(struct pmu *pmu) in uncore_pmu_disable() argument
799 uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu); in uncore_pmu_disable()
828 static int uncore_pmu_register(struct intel_uncore_pmu *pmu) in uncore_pmu_register() argument
832 if (!pmu->type->pmu) { in uncore_pmu_register()
833 pmu->pmu = (struct pmu) { in uncore_pmu_register()
834 .attr_groups = pmu->type->attr_groups, in uncore_pmu_register()
848 pmu->pmu = *pmu->type->pmu; in uncore_pmu_register()
849 pmu->pmu.attr_groups = pmu->type->attr_groups; in uncore_pmu_register()
852 if (pmu->type->num_boxes == 1) { in uncore_pmu_register()
853 if (strlen(pmu->type->name) > 0) in uncore_pmu_register()
854 sprintf(pmu->name, "uncore_%s", pmu->type->name); in uncore_pmu_register()
856 sprintf(pmu->name, "uncore"); in uncore_pmu_register()
858 sprintf(pmu->name, "uncore_%s_%d", pmu->type->name, in uncore_pmu_register()
859 pmu->pmu_idx); in uncore_pmu_register()
862 ret = perf_pmu_register(&pmu->pmu, pmu->name, -1); in uncore_pmu_register()
864 pmu->registered = true; in uncore_pmu_register()
868 static void uncore_pmu_unregister(struct intel_uncore_pmu *pmu) in uncore_pmu_unregister() argument
870 if (!pmu->registered) in uncore_pmu_unregister()
872 perf_pmu_unregister(&pmu->pmu); in uncore_pmu_unregister()
873 pmu->registered = false; in uncore_pmu_unregister()
876 static void uncore_free_boxes(struct intel_uncore_pmu *pmu) in uncore_free_boxes() argument
881 kfree(pmu->boxes[die]); in uncore_free_boxes()
882 kfree(pmu->boxes); in uncore_free_boxes()
887 struct intel_uncore_pmu *pmu = type->pmus; in uncore_type_exit() local
890 if (pmu) { in uncore_type_exit()
891 for (i = 0; i < type->num_boxes; i++, pmu++) { in uncore_type_exit()
892 uncore_pmu_unregister(pmu); in uncore_type_exit()
893 uncore_free_boxes(pmu); in uncore_type_exit()
986 struct intel_uncore_pmu *pmu = NULL; in uncore_pci_probe() local
1011 * for multiple instances of an uncore PMU device type. We should check in uncore_pci_probe()
1025 pmu = &type->pmus[UNCORE_PCI_DEV_IDX(ids->driver_data)]; in uncore_pci_probe()
1031 if (pmu == NULL) in uncore_pci_probe()
1038 pmu = &type->pmus[UNCORE_PCI_DEV_IDX(id->driver_data)]; in uncore_pci_probe()
1041 if (WARN_ON_ONCE(pmu->boxes[die] != NULL)) in uncore_pci_probe()
1048 if (pmu->func_id < 0) in uncore_pci_probe()
1049 pmu->func_id = pdev->devfn; in uncore_pci_probe()
1051 WARN_ON_ONCE(pmu->func_id != pdev->devfn); in uncore_pci_probe()
1057 box->pmu = pmu; in uncore_pci_probe()
1061 pmu->boxes[die] = box; in uncore_pci_probe()
1062 if (atomic_inc_return(&pmu->activeboxes) > 1) in uncore_pci_probe()
1065 /* First active box registers the pmu */ in uncore_pci_probe()
1066 ret = uncore_pmu_register(pmu); in uncore_pci_probe()
1069 pmu->boxes[die] = NULL; in uncore_pci_probe()
1079 struct intel_uncore_pmu *pmu; in uncore_pci_remove() local
1098 pmu = box->pmu; in uncore_pci_remove()
1103 pmu->boxes[box->dieid] = NULL; in uncore_pci_remove()
1104 if (atomic_dec_return(&pmu->activeboxes) == 0) in uncore_pci_remove()
1105 uncore_pmu_unregister(pmu); in uncore_pci_remove()
1160 struct intel_uncore_pmu *pmu = type->pmus; in uncore_change_type_ctx() local
1165 for (i = 0; i < type->num_boxes; i++, pmu++) { in uncore_change_type_ctx()
1166 box = pmu->boxes[die]; in uncore_change_type_ctx()
1182 perf_pmu_migrate_context(&pmu->pmu, old_cpu, new_cpu); in uncore_change_type_ctx()
1197 struct intel_uncore_pmu *pmu; in uncore_box_unref() local
1203 pmu = type->pmus; in uncore_box_unref()
1204 for (i = 0; i < type->num_boxes; i++, pmu++) { in uncore_box_unref()
1205 box = pmu->boxes[id]; in uncore_box_unref()
1245 struct intel_uncore_pmu *pmu; in allocate_boxes() local
1252 pmu = type->pmus; in allocate_boxes()
1253 for (i = 0; i < type->num_boxes; i++, pmu++) { in allocate_boxes()
1254 if (pmu->boxes[die]) in allocate_boxes()
1259 box->pmu = pmu; in allocate_boxes()
1267 box->pmu->boxes[die] = box; in allocate_boxes()
1283 struct intel_uncore_pmu *pmu; in uncore_box_ref() local
1293 pmu = type->pmus; in uncore_box_ref()
1294 for (i = 0; i < type->num_boxes; i++, pmu++) { in uncore_box_ref()
1295 box = pmu->boxes[id]; in uncore_box_ref()