Lines Matching refs:cpuhw

116 static int sf_buffer_available(struct cpu_hw_sf *cpuhw)  in sf_buffer_available()  argument
118 return !!cpuhw->sfb.sdbt; in sf_buffer_available()
368 static void deallocate_buffers(struct cpu_hw_sf *cpuhw) in deallocate_buffers() argument
370 if (cpuhw->sfb.sdbt) in deallocate_buffers()
371 free_sampling_buffer(&cpuhw->sfb); in deallocate_buffers()
374 static int allocate_buffers(struct cpu_hw_sf *cpuhw, struct hw_perf_event *hwc) in allocate_buffers() argument
409 freq = sample_rate_to_freq(&cpuhw->qsi, SAMPL_RATE(hwc)); in allocate_buffers()
421 if (sf_buffer_available(cpuhw)) in allocate_buffers()
428 sample_size, cpuhw); in allocate_buffers()
430 return alloc_sampling_buffer(&cpuhw->sfb, in allocate_buffers()
431 sfb_pending_allocs(&cpuhw->sfb, hwc)); in allocate_buffers()
463 static void sfb_account_overflows(struct cpu_hw_sf *cpuhw, in sfb_account_overflows() argument
478 ratio = DIV_ROUND_UP(100 * OVERFLOW_REG(hwc) * cpuhw->sfb.num_sdb, in sfb_account_overflows()
479 sample_rate_to_freq(&cpuhw->qsi, SAMPL_RATE(hwc))); in sfb_account_overflows()
482 num = compute_sfb_extent(ratio, cpuhw->sfb.num_sdb); in sfb_account_overflows()
767 struct cpu_hw_sf *cpuhw; in __hw_perf_event_init() local
798 cpuhw = NULL; in __hw_perf_event_init()
805 cpuhw = &per_cpu(cpu_hw_sf, event->cpu); in __hw_perf_event_init()
806 si = cpuhw->qsi; in __hw_perf_event_init()
859 if (cpuhw) in __hw_perf_event_init()
861 err = allocate_buffers(cpuhw, hwc); in __hw_perf_event_init()
867 cpuhw = &per_cpu(cpu_hw_sf, cpu); in __hw_perf_event_init()
868 err = allocate_buffers(cpuhw, hwc); in __hw_perf_event_init()
944 struct cpu_hw_sf *cpuhw = this_cpu_ptr(&cpu_hw_sf); in cpumsf_pmu_enable() local
948 if (cpuhw->flags & PMU_F_ENABLED) in cpumsf_pmu_enable()
951 if (cpuhw->flags & PMU_F_ERR_MASK) in cpumsf_pmu_enable()
965 if (cpuhw->event) { in cpumsf_pmu_enable()
966 hwc = &cpuhw->event->hw; in cpumsf_pmu_enable()
972 sfb_account_overflows(cpuhw, hwc); in cpumsf_pmu_enable()
973 extend_sampling_buffer(&cpuhw->sfb, hwc); in cpumsf_pmu_enable()
976 cpuhw->lsctl.interval = SAMPL_RATE(&cpuhw->event->hw); in cpumsf_pmu_enable()
980 cpuhw->flags |= PMU_F_ENABLED; in cpumsf_pmu_enable()
983 err = lsctl(&cpuhw->lsctl); in cpumsf_pmu_enable()
985 cpuhw->flags &= ~PMU_F_ENABLED; in cpumsf_pmu_enable()
996 cpuhw->lsctl.es, cpuhw->lsctl.cs, cpuhw->lsctl.ed, in cpumsf_pmu_enable()
997 cpuhw->lsctl.cd, cpuhw->lsctl.interval, in cpumsf_pmu_enable()
998 cpuhw->lsctl.tear, cpuhw->lsctl.dear); in cpumsf_pmu_enable()
1003 struct cpu_hw_sf *cpuhw = this_cpu_ptr(&cpu_hw_sf); in cpumsf_pmu_disable() local
1008 if (!(cpuhw->flags & PMU_F_ENABLED)) in cpumsf_pmu_disable()
1011 if (cpuhw->flags & PMU_F_ERR_MASK) in cpumsf_pmu_disable()
1015 inactive = cpuhw->lsctl; in cpumsf_pmu_disable()
1035 cpuhw->lsctl.tear = si.tear; in cpumsf_pmu_disable()
1036 cpuhw->lsctl.dear = si.dear; in cpumsf_pmu_disable()
1042 cpuhw->flags &= ~PMU_F_ENABLED; in cpumsf_pmu_disable()
1428 struct cpu_hw_sf *cpuhw) in aux_output_begin() argument
1473 cpuhw->lsctl.tear = base + offset * sizeof(unsigned long); in aux_output_begin()
1474 cpuhw->lsctl.dear = aux->sdb_index[head]; in aux_output_begin()
1480 cpuhw->lsctl.tear, cpuhw->lsctl.dear); in aux_output_begin()
1606 static void hw_collect_aux(struct cpu_hw_sf *cpuhw) in hw_collect_aux() argument
1612 struct perf_output_handle *handle = &cpuhw->handle; in hw_collect_aux()
1628 aux = perf_aux_output_begin(handle, cpuhw->event); in hw_collect_aux()
1655 perf_aux_output_end(&cpuhw->handle, size); in hw_collect_aux()
1663 perf_aux_output_end(&cpuhw->handle, size); in hw_collect_aux()
1846 struct cpu_hw_sf *cpuhw = &per_cpu(cpu_hw_sf, event->cpu); in cpumsf_pmu_check_period() local
1848 si = cpuhw->qsi; in cpumsf_pmu_check_period()
1871 struct cpu_hw_sf *cpuhw = this_cpu_ptr(&cpu_hw_sf); in cpumsf_pmu_start() local
1881 cpuhw->lsctl.cs = 1; in cpumsf_pmu_start()
1883 cpuhw->lsctl.cd = 1; in cpumsf_pmu_start()
1892 struct cpu_hw_sf *cpuhw = this_cpu_ptr(&cpu_hw_sf); in cpumsf_pmu_stop() local
1898 cpuhw->lsctl.cs = 0; in cpumsf_pmu_stop()
1899 cpuhw->lsctl.cd = 0; in cpumsf_pmu_stop()
1911 struct cpu_hw_sf *cpuhw = this_cpu_ptr(&cpu_hw_sf); in cpumsf_pmu_add() local
1915 if (cpuhw->flags & PMU_F_IN_USE) in cpumsf_pmu_add()
1918 if (!SAMPL_DIAG_MODE(&event->hw) && !cpuhw->sfb.sdbt) in cpumsf_pmu_add()
1931 cpuhw->lsctl.s = 0; in cpumsf_pmu_add()
1932 cpuhw->lsctl.h = 1; in cpumsf_pmu_add()
1933 cpuhw->lsctl.interval = SAMPL_RATE(&event->hw); in cpumsf_pmu_add()
1935 cpuhw->lsctl.tear = (unsigned long) cpuhw->sfb.sdbt; in cpumsf_pmu_add()
1936 cpuhw->lsctl.dear = *(unsigned long *) cpuhw->sfb.sdbt; in cpumsf_pmu_add()
1937 TEAR_REG(&event->hw) = (unsigned long) cpuhw->sfb.sdbt; in cpumsf_pmu_add()
1942 if (WARN_ON_ONCE(cpuhw->lsctl.es == 1 || cpuhw->lsctl.ed == 1)) { in cpumsf_pmu_add()
1947 aux = perf_aux_output_begin(&cpuhw->handle, event); in cpumsf_pmu_add()
1952 err = aux_output_begin(&cpuhw->handle, aux, cpuhw); in cpumsf_pmu_add()
1955 cpuhw->lsctl.ed = 1; in cpumsf_pmu_add()
1957 cpuhw->lsctl.es = 1; in cpumsf_pmu_add()
1960 cpuhw->event = event; in cpumsf_pmu_add()
1961 cpuhw->flags |= PMU_F_IN_USE; in cpumsf_pmu_add()
1973 struct cpu_hw_sf *cpuhw = this_cpu_ptr(&cpu_hw_sf); in cpumsf_pmu_del() local
1978 cpuhw->lsctl.es = 0; in cpumsf_pmu_del()
1979 cpuhw->lsctl.ed = 0; in cpumsf_pmu_del()
1980 cpuhw->flags &= ~PMU_F_IN_USE; in cpumsf_pmu_del()
1981 cpuhw->event = NULL; in cpumsf_pmu_del()
1984 aux_output_end(&cpuhw->handle); in cpumsf_pmu_del()
2064 struct cpu_hw_sf *cpuhw; in cpumf_measurement_alert() local
2069 cpuhw = this_cpu_ptr(&cpu_hw_sf); in cpumf_measurement_alert()
2073 if (!(cpuhw->flags & PMU_F_RESERVED)) in cpumf_measurement_alert()
2081 if (cpuhw->flags & PMU_F_IN_USE) in cpumf_measurement_alert()
2082 if (SAMPL_DIAG_MODE(&cpuhw->event->hw)) in cpumf_measurement_alert()
2083 hw_collect_aux(cpuhw); in cpumf_measurement_alert()
2085 hw_perf_event_update(cpuhw->event, 0); in cpumf_measurement_alert()
2087 WARN_ON_ONCE(!(cpuhw->flags & PMU_F_IN_USE)); in cpumf_measurement_alert()
2097 qsi(&cpuhw->qsi); in cpumf_measurement_alert()
2102 cpuhw->flags |= PMU_F_ERR_LSDA; in cpumf_measurement_alert()
2110 cpuhw->flags |= PMU_F_ERR_IBE; in cpumf_measurement_alert()