Lines Matching refs:starlink_pmu
51 #define to_starlink_pmu(p) (container_of(p, struct starlink_pmu, pmu))
69 struct starlink_pmu { struct
132 struct starlink_pmu *starlink_pmu = to_starlink_pmu(dev_get_drvdata(dev)); in cpumask_show() local
134 return cpumap_print_to_pagebuf(true, buf, &starlink_pmu->cpumask); in cpumask_show()
157 struct starlink_pmu *starlink_pmu = to_starlink_pmu(event->pmu); in starlink_pmu_set_event_period() local
169 writeq(val, starlink_pmu->pmu_base + STARLINK_PMU_CYCLE_COUNTER); in starlink_pmu_set_event_period()
171 writeq(val, starlink_pmu->pmu_base + STARLINK_PMU_EVENT_COUNTER + in starlink_pmu_set_event_period()
176 struct starlink_pmu *starlink_pmu) in starlink_pmu_counter_start() argument
191 val = readq(starlink_pmu->pmu_base + STARLINK_PMU_INTERRUPT_ENABLE); in starlink_pmu_counter_start()
200 writeq(event->hw.config, starlink_pmu->pmu_base + in starlink_pmu_counter_start()
206 writeq(val, starlink_pmu->pmu_base + STARLINK_PMU_INTERRUPT_ENABLE); in starlink_pmu_counter_start()
208 writeq(STARLINK_PMU_GLOBAL_ENABLE, starlink_pmu->pmu_base + in starlink_pmu_counter_start()
213 struct starlink_pmu *starlink_pmu) in starlink_pmu_counter_stop() argument
219 val = readq(starlink_pmu->pmu_base + STARLINK_PMU_CONTROL); in starlink_pmu_counter_stop()
221 writeq(val, starlink_pmu->pmu_base + STARLINK_PMU_CONTROL); in starlink_pmu_counter_stop()
223 val = readq(starlink_pmu->pmu_base + STARLINK_PMU_INTERRUPT_ENABLE); in starlink_pmu_counter_stop()
229 writeq(val, starlink_pmu->pmu_base + STARLINK_PMU_INTERRUPT_ENABLE); in starlink_pmu_counter_stop()
234 struct starlink_pmu *starlink_pmu = to_starlink_pmu(event->pmu); in starlink_pmu_update() local
244 new_raw_count = readq(starlink_pmu->pmu_base + in starlink_pmu_update()
247 new_raw_count = readq(starlink_pmu->pmu_base + in starlink_pmu_update()
260 struct starlink_pmu *starlink_pmu = to_starlink_pmu(event->pmu); in starlink_pmu_start() local
272 starlink_pmu_counter_start(event, starlink_pmu); in starlink_pmu_start()
279 struct starlink_pmu *starlink_pmu = to_starlink_pmu(event->pmu); in starlink_pmu_stop() local
285 starlink_pmu_counter_stop(event, starlink_pmu); in starlink_pmu_stop()
292 struct starlink_pmu *starlink_pmu = to_starlink_pmu(event->pmu); in starlink_pmu_add() local
294 this_cpu_ptr(starlink_pmu->hw_events); in starlink_pmu_add()
332 struct starlink_pmu *starlink_pmu = to_starlink_pmu(event->pmu); in starlink_pmu_del() local
334 this_cpu_ptr(starlink_pmu->hw_events); in starlink_pmu_del()
370 struct starlink_pmu *starlink_pmu = to_starlink_pmu(event->pmu); in starlink_pmu_event_init() local
392 event->cpu = cpumask_first(&starlink_pmu->cpumask); in starlink_pmu_event_init()
399 struct starlink_pmu *starlink_pmu = data; in starlink_pmu_handle_irq() local
401 this_cpu_ptr(starlink_pmu->hw_events); in starlink_pmu_handle_irq()
412 overflow_status = readq(starlink_pmu->pmu_base + in starlink_pmu_handle_irq()
417 writeq(BIT_ULL(idx), starlink_pmu->pmu_base + in starlink_pmu_handle_irq()
427 static int starlink_setup_irqs(struct starlink_pmu *starlink_pmu, in starlink_setup_irqs() argument
437 0, STARLINK_PMU_PDEV_NAME, starlink_pmu); in starlink_setup_irqs()
441 starlink_pmu->irq = irq; in starlink_setup_irqs()
449 struct starlink_pmu *starlink_pmu = container_of(b, struct starlink_pmu, in starlink_pmu_pm_notify() local
452 this_cpu_ptr(starlink_pmu->hw_events); in starlink_pmu_pm_notify()
484 static int starlink_pmu_pm_register(struct starlink_pmu *starlink_pmu) in starlink_pmu_pm_register() argument
489 starlink_pmu->starlink_pmu_pm_nb.notifier_call = starlink_pmu_pm_notify; in starlink_pmu_pm_register()
490 return cpu_pm_register_notifier(&starlink_pmu->starlink_pmu_pm_nb); in starlink_pmu_pm_register()
493 static void starlink_pmu_pm_unregister(struct starlink_pmu *starlink_pmu) in starlink_pmu_pm_unregister() argument
498 cpu_pm_unregister_notifier(&starlink_pmu->starlink_pmu_pm_nb); in starlink_pmu_pm_unregister()
501 static void starlink_pmu_destroy(struct starlink_pmu *starlink_pmu) in starlink_pmu_destroy() argument
503 starlink_pmu_pm_unregister(starlink_pmu); in starlink_pmu_destroy()
505 &starlink_pmu->node); in starlink_pmu_destroy()
510 struct starlink_pmu *starlink_pmu; in starlink_pmu_probe() local
515 starlink_pmu = devm_kzalloc(&pdev->dev, sizeof(*starlink_pmu), GFP_KERNEL); in starlink_pmu_probe()
516 if (!starlink_pmu) in starlink_pmu_probe()
519 starlink_pmu->pmu_base = in starlink_pmu_probe()
521 if (IS_ERR(starlink_pmu->pmu_base)) in starlink_pmu_probe()
522 return PTR_ERR(starlink_pmu->pmu_base); in starlink_pmu_probe()
524 starlink_pmu->hw_events = alloc_percpu_gfp(struct starlink_hw_events, in starlink_pmu_probe()
526 if (!starlink_pmu->hw_events) { in starlink_pmu_probe()
532 hw_events = per_cpu_ptr(starlink_pmu->hw_events, cpuid); in starlink_pmu_probe()
537 ret = starlink_setup_irqs(starlink_pmu, pdev); in starlink_pmu_probe()
542 &starlink_pmu->node); in starlink_pmu_probe()
548 ret = starlink_pmu_pm_register(starlink_pmu); in starlink_pmu_probe()
551 &starlink_pmu->node); in starlink_pmu_probe()
555 starlink_pmu->pmu = (struct pmu) { in starlink_pmu_probe()
566 ret = perf_pmu_register(&starlink_pmu->pmu, STARLINK_PMU_PDEV_NAME, -1); in starlink_pmu_probe()
568 starlink_pmu_destroy(starlink_pmu); in starlink_pmu_probe()
591 struct starlink_pmu *starlink_pmu = hlist_entry_safe(node, in starlink_pmu_online_cpu() local
592 struct starlink_pmu, in starlink_pmu_online_cpu()
595 if (cpumask_empty(&starlink_pmu->cpumask)) in starlink_pmu_online_cpu()
596 cpumask_set_cpu(cpu, &starlink_pmu->cpumask); in starlink_pmu_online_cpu()
598 WARN_ON(irq_set_affinity(starlink_pmu->irq, cpumask_of(cpu))); in starlink_pmu_online_cpu()
606 struct starlink_pmu *starlink_pmu = hlist_entry_safe(node, in starlink_pmu_offline_cpu() local
607 struct starlink_pmu, in starlink_pmu_offline_cpu()
611 if (!cpumask_test_and_clear_cpu(cpu, &starlink_pmu->cpumask)) in starlink_pmu_offline_cpu()
618 perf_pmu_migrate_context(&starlink_pmu->pmu, cpu, target); in starlink_pmu_offline_cpu()
620 cpumask_set_cpu(target, &starlink_pmu->cpumask); in starlink_pmu_offline_cpu()
621 WARN_ON(irq_set_affinity(starlink_pmu->irq, cpumask_of(target))); in starlink_pmu_offline_cpu()