Lines Matching defs:spe_pmu
121 static u32 arm_spe_pmu_cap_get(struct arm_spe_pmu *spe_pmu, int cap)
124 return !!(spe_pmu->features & arm_spe_pmu_feat_caps[cap]);
128 return spe_pmu->counter_sz;
130 return spe_pmu->min_period;
142 struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);
148 arm_spe_pmu_cap_get(spe_pmu, cap));
257 struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);
259 return cpumap_print_to_pagebuf(true, buf, &spe_pmu->supported_cpus);
303 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
308 if (period < spe_pmu->min_period)
309 period = spe_pmu->min_period;
378 struct arm_spe_pmu *spe_pmu = to_spe_pmu(handle->event->pmu);
395 if (limit - head < spe_pmu->max_record_sz) {
406 struct arm_spe_pmu *spe_pmu = to_spe_pmu(handle->event->pmu);
427 if (!IS_ALIGNED(head, spe_pmu->align)) {
428 unsigned long delta = roundup(head, spe_pmu->align) - head;
477 struct arm_spe_pmu *spe_pmu = to_spe_pmu(handle->event->pmu);
485 if (limit && (limit - head < spe_pmu->max_record_sz)) {
681 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
688 !cpumask_test_cpu(event->cpu, &spe_pmu->supported_cpus))
709 !(spe_pmu->features & SPE_PMU_FEAT_FILT_EVT))
713 !(spe_pmu->features & SPE_PMU_FEAT_FILT_TYP))
717 !(spe_pmu->features & SPE_PMU_FEAT_FILT_LAT))
733 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
735 struct perf_output_handle *handle = this_cpu_ptr(spe_pmu->handle);
766 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
768 struct perf_output_handle *handle = this_cpu_ptr(spe_pmu->handle);
808 struct arm_spe_pmu *spe_pmu = to_spe_pmu(event->pmu);
812 if (!cpumask_test_cpu(cpu, &spe_pmu->supported_cpus))
895 static int arm_spe_pmu_perf_init(struct arm_spe_pmu *spe_pmu)
901 struct device *dev = &spe_pmu->pdev->dev;
903 spe_pmu->pmu = (struct pmu) {
935 return perf_pmu_register(&spe_pmu->pmu, name, -1);
938 static void arm_spe_pmu_perf_destroy(struct arm_spe_pmu *spe_pmu)
940 perf_pmu_unregister(&spe_pmu->pmu);
947 struct arm_spe_pmu *spe_pmu = info;
948 struct device *dev = &spe_pmu->pdev->dev;
969 spe_pmu->align = 1 << fld;
970 if (spe_pmu->align > SZ_2K) {
979 spe_pmu->features |= SPE_PMU_FEAT_FILT_EVT;
982 spe_pmu->features |= SPE_PMU_FEAT_FILT_TYP;
985 spe_pmu->features |= SPE_PMU_FEAT_FILT_LAT;
988 spe_pmu->features |= SPE_PMU_FEAT_ARCH_INST;
991 spe_pmu->features |= SPE_PMU_FEAT_LDS;
994 spe_pmu->features |= SPE_PMU_FEAT_ERND;
1000 spe_pmu->min_period = 256;
1003 spe_pmu->min_period = 512;
1006 spe_pmu->min_period = 768;
1009 spe_pmu->min_period = 1024;
1012 spe_pmu->min_period = 1536;
1015 spe_pmu->min_period = 2048;
1018 spe_pmu->min_period = 3072;
1025 spe_pmu->min_period = 4096;
1030 spe_pmu->max_record_sz = 1 << fld;
1031 if (spe_pmu->max_record_sz > SZ_2K || spe_pmu->max_record_sz < 16) {
1044 spe_pmu->counter_sz = 12;
1049 cpumask_pr_args(&spe_pmu->supported_cpus),
1050 spe_pmu->max_record_sz, spe_pmu->align, spe_pmu->features);
1052 spe_pmu->features |= SPE_PMU_FEAT_DEV_PROBED;
1075 struct arm_spe_pmu *spe_pmu = info;
1078 enable_percpu_irq(spe_pmu->irq, IRQ_TYPE_NONE);
1083 struct arm_spe_pmu *spe_pmu = info;
1085 disable_percpu_irq(spe_pmu->irq);
1091 struct arm_spe_pmu *spe_pmu;
1093 spe_pmu = hlist_entry_safe(node, struct arm_spe_pmu, hotplug_node);
1094 if (!cpumask_test_cpu(cpu, &spe_pmu->supported_cpus))
1097 __arm_spe_pmu_setup_one(spe_pmu);
1103 struct arm_spe_pmu *spe_pmu;
1105 spe_pmu = hlist_entry_safe(node, struct arm_spe_pmu, hotplug_node);
1106 if (!cpumask_test_cpu(cpu, &spe_pmu->supported_cpus))
1109 __arm_spe_pmu_stop_one(spe_pmu);
1113 static int arm_spe_pmu_dev_init(struct arm_spe_pmu *spe_pmu)
1116 cpumask_t *mask = &spe_pmu->supported_cpus;
1119 ret = smp_call_function_any(mask, __arm_spe_pmu_dev_probe, spe_pmu, 1);
1120 if (ret || !(spe_pmu->features & SPE_PMU_FEAT_DEV_PROBED))
1124 ret = request_percpu_irq(spe_pmu->irq, arm_spe_pmu_irq_handler, DRVNAME,
1125 spe_pmu->handle);
1135 &spe_pmu->hotplug_node);
1137 free_percpu_irq(spe_pmu->irq, spe_pmu->handle);
1142 static void arm_spe_pmu_dev_teardown(struct arm_spe_pmu *spe_pmu)
1144 cpuhp_state_remove_instance(arm_spe_pmu_online, &spe_pmu->hotplug_node);
1145 free_percpu_irq(spe_pmu->irq, spe_pmu->handle);
1149 static int arm_spe_pmu_irq_probe(struct arm_spe_pmu *spe_pmu)
1151 struct platform_device *pdev = spe_pmu->pdev;
1162 if (irq_get_percpu_devid_partition(irq, &spe_pmu->supported_cpus)) {
1167 spe_pmu->irq = irq;
1186 struct arm_spe_pmu *spe_pmu;
1198 spe_pmu = devm_kzalloc(dev, sizeof(*spe_pmu), GFP_KERNEL);
1199 if (!spe_pmu) {
1200 dev_err(dev, "failed to allocate spe_pmu\n");
1204 spe_pmu->handle = alloc_percpu(typeof(*spe_pmu->handle));
1205 if (!spe_pmu->handle)
1208 spe_pmu->pdev = pdev;
1209 platform_set_drvdata(pdev, spe_pmu);
1211 ret = arm_spe_pmu_irq_probe(spe_pmu);
1215 ret = arm_spe_pmu_dev_init(spe_pmu);
1219 ret = arm_spe_pmu_perf_init(spe_pmu);
1226 arm_spe_pmu_dev_teardown(spe_pmu);
1228 free_percpu(spe_pmu->handle);
1234 struct arm_spe_pmu *spe_pmu = platform_get_drvdata(pdev);
1236 arm_spe_pmu_perf_destroy(spe_pmu);
1237 arm_spe_pmu_dev_teardown(spe_pmu);
1238 free_percpu(spe_pmu->handle);