Lines Matching defs:spe_pmu
124 static u32 arm_spe_pmu_cap_get(struct arm_spe_pmu *spe_pmu, int cap)
127 return !!(spe_pmu->features & arm_spe_pmu_feat_caps[cap]);
131 return spe_pmu->counter_sz;
133 return spe_pmu->min_period;
145 struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);
150 return sysfs_emit(buf, "%u\n", arm_spe_pmu_cap_get(spe_pmu, cap));
261 struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);
263 if (attr == &format_attr_inv_event_filter.attr && !(spe_pmu->features & SPE_PMU_FEAT_INV_FILT_EVT))
278 struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);
280 return cpumap_print_to_pagebuf(true, buf, &spe_pmu->supported_cpus);
324 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
328 if (period < spe_pmu->min_period)
329 period = spe_pmu->min_period;
406 struct arm_spe_pmu *spe_pmu = to_spe_pmu(handle->event->pmu);
423 if (limit - head < spe_pmu->max_record_sz) {
434 struct arm_spe_pmu *spe_pmu = to_spe_pmu(handle->event->pmu);
455 if (!IS_ALIGNED(head, spe_pmu->align)) {
456 unsigned long delta = roundup(head, spe_pmu->align) - head;
505 struct arm_spe_pmu *spe_pmu = to_spe_pmu(handle->event->pmu);
513 if (limit && (limit - head < spe_pmu->max_record_sz)) {
722 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
729 !cpumask_test_cpu(event->cpu, &spe_pmu->supported_cpus))
732 if (arm_spe_event_to_pmsevfr(event) & arm_spe_pmsevfr_res0(spe_pmu->pmsver))
735 if (arm_spe_event_to_pmsnevfr(event) & arm_spe_pmsevfr_res0(spe_pmu->pmsver))
753 !(spe_pmu->features & SPE_PMU_FEAT_FILT_EVT))
757 !(spe_pmu->features & SPE_PMU_FEAT_INV_FILT_EVT))
761 !(spe_pmu->features & SPE_PMU_FEAT_FILT_TYP))
765 !(spe_pmu->features & SPE_PMU_FEAT_FILT_LAT))
780 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
782 struct perf_output_handle *handle = this_cpu_ptr(spe_pmu->handle);
795 if (spe_pmu->features & SPE_PMU_FEAT_INV_FILT_EVT) {
818 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
820 struct perf_output_handle *handle = this_cpu_ptr(spe_pmu->handle);
860 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
864 if (!cpumask_test_cpu(cpu, &spe_pmu->supported_cpus))
947 static int arm_spe_pmu_perf_init(struct arm_spe_pmu *spe_pmu)
953 struct device *dev = &spe_pmu->pdev->dev;
955 spe_pmu->pmu = (struct pmu) {
987 return perf_pmu_register(&spe_pmu->pmu, name, -1);
990 static void arm_spe_pmu_perf_destroy(struct arm_spe_pmu *spe_pmu)
992 perf_pmu_unregister(&spe_pmu->pmu);
999 struct arm_spe_pmu *spe_pmu = info;
1000 struct device *dev = &spe_pmu->pdev->dev;
1010 spe_pmu->pmsver = (u16)fld;
1022 spe_pmu->align = 1 << fld;
1023 if (spe_pmu->align > SZ_2K) {
1032 spe_pmu->features |= SPE_PMU_FEAT_FILT_EVT;
1035 spe_pmu->features |= SPE_PMU_FEAT_INV_FILT_EVT;
1038 spe_pmu->features |= SPE_PMU_FEAT_FILT_TYP;
1041 spe_pmu->features |= SPE_PMU_FEAT_FILT_LAT;
1044 spe_pmu->features |= SPE_PMU_FEAT_ARCH_INST;
1047 spe_pmu->features |= SPE_PMU_FEAT_LDS;
1050 spe_pmu->features |= SPE_PMU_FEAT_ERND;
1056 spe_pmu->min_period = 256;
1059 spe_pmu->min_period = 512;
1062 spe_pmu->min_period = 768;
1065 spe_pmu->min_period = 1024;
1068 spe_pmu->min_period = 1536;
1071 spe_pmu->min_period = 2048;
1074 spe_pmu->min_period = 3072;
1081 spe_pmu->min_period = 4096;
1086 spe_pmu->max_record_sz = 1 << fld;
1087 if (spe_pmu->max_record_sz > SZ_2K || spe_pmu->max_record_sz < 16) {
1100 spe_pmu->counter_sz = 12;
1103 spe_pmu->counter_sz = 16;
1108 spe_pmu->pmsver - 1, cpumask_pr_args(&spe_pmu->supported_cpus),
1109 spe_pmu->max_record_sz, spe_pmu->align, spe_pmu->features);
1111 spe_pmu->features |= SPE_PMU_FEAT_DEV_PROBED;
1133 struct arm_spe_pmu *spe_pmu = info;
1136 enable_percpu_irq(spe_pmu->irq, IRQ_TYPE_NONE);
1141 struct arm_spe_pmu *spe_pmu = info;
1143 disable_percpu_irq(spe_pmu->irq);
1149 struct arm_spe_pmu *spe_pmu;
1151 spe_pmu = hlist_entry_safe(node, struct arm_spe_pmu, hotplug_node);
1152 if (!cpumask_test_cpu(cpu, &spe_pmu->supported_cpus))
1155 __arm_spe_pmu_setup_one(spe_pmu);
1161 struct arm_spe_pmu *spe_pmu;
1163 spe_pmu = hlist_entry_safe(node, struct arm_spe_pmu, hotplug_node);
1164 if (!cpumask_test_cpu(cpu, &spe_pmu->supported_cpus))
1167 __arm_spe_pmu_stop_one(spe_pmu);
1171 static int arm_spe_pmu_dev_init(struct arm_spe_pmu *spe_pmu)
1174 cpumask_t *mask = &spe_pmu->supported_cpus;
1177 ret = smp_call_function_any(mask, __arm_spe_pmu_dev_probe, spe_pmu, 1);
1178 if (ret || !(spe_pmu->features & SPE_PMU_FEAT_DEV_PROBED))
1182 ret = request_percpu_irq(spe_pmu->irq, arm_spe_pmu_irq_handler, DRVNAME,
1183 spe_pmu->handle);
1193 &spe_pmu->hotplug_node);
1195 free_percpu_irq(spe_pmu->irq, spe_pmu->handle);
1200 static void arm_spe_pmu_dev_teardown(struct arm_spe_pmu *spe_pmu)
1202 cpuhp_state_remove_instance(arm_spe_pmu_online, &spe_pmu->hotplug_node);
1203 free_percpu_irq(spe_pmu->irq, spe_pmu->handle);
1207 static int arm_spe_pmu_irq_probe(struct arm_spe_pmu *spe_pmu)
1209 struct platform_device *pdev = spe_pmu->pdev;
1220 if (irq_get_percpu_devid_partition(irq, &spe_pmu->supported_cpus)) {
1225 spe_pmu->irq = irq;
1244 struct arm_spe_pmu *spe_pmu;
1256 spe_pmu = devm_kzalloc(dev, sizeof(*spe_pmu), GFP_KERNEL);
1257 if (!spe_pmu)
1260 spe_pmu->handle = alloc_percpu(typeof(*spe_pmu->handle));
1261 if (!spe_pmu->handle)
1264 spe_pmu->pdev = pdev;
1265 platform_set_drvdata(pdev, spe_pmu);
1267 ret = arm_spe_pmu_irq_probe(spe_pmu);
1271 ret = arm_spe_pmu_dev_init(spe_pmu);
1275 ret = arm_spe_pmu_perf_init(spe_pmu);
1282 arm_spe_pmu_dev_teardown(spe_pmu);
1284 free_percpu(spe_pmu->handle);
1290 struct arm_spe_pmu *spe_pmu = platform_get_drvdata(pdev);
1292 arm_spe_pmu_perf_destroy(spe_pmu);
1293 arm_spe_pmu_dev_teardown(spe_pmu);
1294 free_percpu(spe_pmu->handle);