Lines Matching refs:hwc
384 static unsigned long sfb_max_limit(struct hw_perf_event *hwc) in sfb_max_limit() argument
386 return SAMPL_DIAG_MODE(hwc) ? CPUM_SF_MAX_SDB * CPUM_SF_SDB_DIAG_FACTOR in sfb_max_limit()
391 struct hw_perf_event *hwc) in sfb_pending_allocs() argument
394 return SFB_ALLOC_REG(hwc); in sfb_pending_allocs()
395 if (SFB_ALLOC_REG(hwc) > sfb->num_sdb) in sfb_pending_allocs()
396 return SFB_ALLOC_REG(hwc) - sfb->num_sdb; in sfb_pending_allocs()
401 struct hw_perf_event *hwc) in sfb_has_pending_allocs() argument
403 return sfb_pending_allocs(sfb, hwc) > 0; in sfb_has_pending_allocs()
406 static void sfb_account_allocs(unsigned long num, struct hw_perf_event *hwc) in sfb_account_allocs() argument
409 num = min_t(unsigned long, num, sfb_max_limit(hwc) - SFB_ALLOC_REG(hwc)); in sfb_account_allocs()
411 SFB_ALLOC_REG(hwc) += num; in sfb_account_allocs()
414 static void sfb_init_allocs(unsigned long num, struct hw_perf_event *hwc) in sfb_init_allocs() argument
416 SFB_ALLOC_REG(hwc) = 0; in sfb_init_allocs()
417 sfb_account_allocs(num, hwc); in sfb_init_allocs()
426 static int allocate_buffers(struct cpu_hw_sf *cpuhw, struct hw_perf_event *hwc) in allocate_buffers() argument
461 freq = sample_rate_to_freq(&cpuhw->qsi, SAMPL_RATE(hwc)); in allocate_buffers()
472 sfb_init_allocs(n_sdb, hwc); in allocate_buffers()
479 SAMPL_RATE(hwc), freq, n_sdb, sfb_max_limit(hwc), in allocate_buffers()
483 sfb_pending_allocs(&cpuhw->sfb, hwc)); in allocate_buffers()
516 struct hw_perf_event *hwc) in sfb_account_overflows() argument
520 if (!OVERFLOW_REG(hwc)) in sfb_account_overflows()
530 ratio = DIV_ROUND_UP(100 * OVERFLOW_REG(hwc) * cpuhw->sfb.num_sdb, in sfb_account_overflows()
531 sample_rate_to_freq(&cpuhw->qsi, SAMPL_RATE(hwc))); in sfb_account_overflows()
536 sfb_account_allocs(num, hwc); in sfb_account_overflows()
539 __func__, OVERFLOW_REG(hwc), ratio, num); in sfb_account_overflows()
540 OVERFLOW_REG(hwc) = 0; in sfb_account_overflows()
555 struct hw_perf_event *hwc) in extend_sampling_buffer() argument
560 num = sfb_pending_allocs(sfb, hwc); in extend_sampling_buffer()
580 if (sfb_has_pending_allocs(sfb, hwc)) in extend_sampling_buffer()
584 sfb_pending_allocs(sfb, hwc)); in extend_sampling_buffer()
655 static void hw_init_period(struct hw_perf_event *hwc, u64 period) in hw_init_period() argument
657 hwc->sample_period = period; in hw_init_period()
658 hwc->last_period = hwc->sample_period; in hw_init_period()
659 local64_set(&hwc->period_left, hwc->sample_period); in hw_init_period()
784 struct hw_perf_event *hwc = &event->hw; in __hw_perf_event_init_rate() local
792 SAMPL_FLAGS(hwc) |= PERF_CPUM_SF_FREQ_MODE; in __hw_perf_event_init_rate()
799 SAMPL_RATE(hwc) = rate; in __hw_perf_event_init_rate()
800 hw_init_period(hwc, SAMPL_RATE(hwc)); in __hw_perf_event_init_rate()
803 event->attr.freq, SAMPLE_FREQ_MODE(hwc)); in __hw_perf_event_init_rate()
812 struct hw_perf_event *hwc = &event->hw; in __hw_perf_event_init() local
867 SAMPL_FLAGS(hwc) = PERF_CPUM_SF_BASIC_MODE; in __hw_perf_event_init()
877 SAMPL_FLAGS(hwc) |= PERF_CPUM_SF_DIAG_MODE; in __hw_perf_event_init()
885 hwc->extra_reg.reg = REG_OVERFLOW; in __hw_perf_event_init()
886 OVERFLOW_REG(hwc) = 0; in __hw_perf_event_init()
899 err = allocate_buffers(cpuhw, hwc); in __hw_perf_event_init()
906 err = allocate_buffers(cpuhw, hwc); in __hw_perf_event_init()
979 struct hw_perf_event *hwc; in cpumsf_pmu_enable() local
1000 hwc = &cpuhw->event->hw; in cpumsf_pmu_enable()
1001 if (!(SAMPL_DIAG_MODE(hwc))) { in cpumsf_pmu_enable()
1006 sfb_account_overflows(cpuhw, hwc); in cpumsf_pmu_enable()
1007 extend_sampling_buffer(&cpuhw->sfb, hwc); in cpumsf_pmu_enable()
1278 struct hw_perf_event *hwc = &event->hw; in hw_perf_event_update() local
1290 sdbt = (unsigned long *)TEAR_REG(hwc); in hw_perf_event_update()
1343 TEAR_REG(hwc) = (unsigned long) sdbt; in hw_perf_event_update()
1354 OVERFLOW_REG(hwc) = DIV_ROUND_UP(OVERFLOW_REG(hwc) + in hw_perf_event_update()
1366 SAMPL_RATE(hwc) += DIV_ROUND_UP(SAMPL_RATE(hwc), 10); in hw_perf_event_update()
1369 DIV_ROUND_UP(SAMPL_RATE(hwc), 10)); in hw_perf_event_update()
1377 OVERFLOW_REG(hwc), num_sdb); in hw_perf_event_update()