Lines Matching defs:pmu_mmdc

127 	struct mmdc_pmu *pmu_mmdc = dev_get_drvdata(dev);
129 return cpumap_print_to_pagebuf(true, buf, &pmu_mmdc->cpu);
184 static u32 mmdc_pmu_read_counter(struct mmdc_pmu *pmu_mmdc, int cfg)
188 mmdc_base = pmu_mmdc->mmdc_base;
218 struct mmdc_pmu *pmu_mmdc = hlist_entry_safe(node, struct mmdc_pmu, node);
221 if (!cpumask_test_and_clear_cpu(cpu, &pmu_mmdc->cpu))
228 perf_pmu_migrate_context(&pmu_mmdc->pmu, cpu, target);
229 cpumask_set_cpu(target, &pmu_mmdc->cpu);
279 struct mmdc_pmu *pmu_mmdc = to_mmdc_pmu(event->pmu);
289 dev_warn(pmu_mmdc->dev, "Can't provide per-task data!\n");
302 event->cpu = cpumask_first(&pmu_mmdc->cpu);
308 struct mmdc_pmu *pmu_mmdc = to_mmdc_pmu(event->pmu);
314 new_raw_count = mmdc_pmu_read_counter(pmu_mmdc,
326 struct mmdc_pmu *pmu_mmdc = to_mmdc_pmu(event->pmu);
331 mmdc_base = pmu_mmdc->mmdc_base;
338 hrtimer_start(&pmu_mmdc->hrtimer, mmdc_pmu_timer_period(),
354 if (pmu_mmdc->devtype_data->flags & MMDC_FLAG_PROFILE_SEL)
362 struct mmdc_pmu *pmu_mmdc = to_mmdc_pmu(event->pmu);
370 if (pmu_mmdc->mmdc_events[cfg] != NULL)
373 pmu_mmdc->mmdc_events[cfg] = event;
374 pmu_mmdc->active_events++;
376 local64_set(&hwc->prev_count, mmdc_pmu_read_counter(pmu_mmdc, cfg));
383 struct mmdc_pmu *pmu_mmdc = to_mmdc_pmu(event->pmu);
386 mmdc_base = pmu_mmdc->mmdc_base;
399 struct mmdc_pmu *pmu_mmdc = to_mmdc_pmu(event->pmu);
402 pmu_mmdc->mmdc_events[cfg] = NULL;
403 pmu_mmdc->active_events--;
405 if (pmu_mmdc->active_events == 0)
406 hrtimer_cancel(&pmu_mmdc->hrtimer);
411 static void mmdc_pmu_overflow_handler(struct mmdc_pmu *pmu_mmdc)
416 struct perf_event *event = pmu_mmdc->mmdc_events[i];
425 struct mmdc_pmu *pmu_mmdc = container_of(hrtimer, struct mmdc_pmu,
428 mmdc_pmu_overflow_handler(pmu_mmdc);
434 static int mmdc_pmu_init(struct mmdc_pmu *pmu_mmdc,
437 *pmu_mmdc = (struct mmdc_pmu) {
454 pmu_mmdc->id = ida_simple_get(&mmdc_ida, 0, 0, GFP_KERNEL);
456 return pmu_mmdc->id;
461 struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev);
463 ida_simple_remove(&mmdc_ida, pmu_mmdc->id);
464 cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
465 perf_pmu_unregister(&pmu_mmdc->pmu);
466 iounmap(pmu_mmdc->mmdc_base);
467 clk_disable_unprepare(pmu_mmdc->mmdc_ipg_clk);
468 kfree(pmu_mmdc);
475 struct mmdc_pmu *pmu_mmdc;
481 pmu_mmdc = kzalloc(sizeof(*pmu_mmdc), GFP_KERNEL);
482 if (!pmu_mmdc) {
499 ret = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev);
510 pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk;
511 pmu_mmdc->devtype_data = (struct fsl_mmdc_devtype_data *)of_id->data;
513 hrtimer_init(&pmu_mmdc->hrtimer, CLOCK_MONOTONIC,
515 pmu_mmdc->hrtimer.function = mmdc_pmu_timer_handler;
517 cpumask_set_cpu(raw_smp_processor_id(), &pmu_mmdc->cpu);
520 cpuhp_state_add_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
522 ret = perf_pmu_register(&(pmu_mmdc->pmu), name, -1);
526 platform_set_drvdata(pdev, pmu_mmdc);
531 cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
532 hrtimer_cancel(&pmu_mmdc->hrtimer);
534 ida_simple_remove(&mmdc_ida, pmu_mmdc->id);
536 kfree(pmu_mmdc);