Lines Matching full:box
155 u64 hrtimer_duration; /* hrtimer timeout for this box */
260 static inline bool uncore_mmio_is_valid_offset(struct intel_uncore_box *box, in uncore_mmio_is_valid_offset() argument
263 if (offset < box->pmu->type->mmio_map_size) in uncore_mmio_is_valid_offset()
267 offset, box->pmu->type->name); in uncore_mmio_is_valid_offset()
273 unsigned int uncore_mmio_box_ctl(struct intel_uncore_box *box) in uncore_mmio_box_ctl() argument
275 return box->pmu->type->box_ctl + in uncore_mmio_box_ctl()
276 box->pmu->type->mmio_offset * box->pmu->pmu_idx; in uncore_mmio_box_ctl()
279 static inline unsigned uncore_pci_box_ctl(struct intel_uncore_box *box) in uncore_pci_box_ctl() argument
281 return box->pmu->type->box_ctl; in uncore_pci_box_ctl()
284 static inline unsigned uncore_pci_fixed_ctl(struct intel_uncore_box *box) in uncore_pci_fixed_ctl() argument
286 return box->pmu->type->fixed_ctl; in uncore_pci_fixed_ctl()
289 static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box) in uncore_pci_fixed_ctr() argument
291 return box->pmu->type->fixed_ctr; in uncore_pci_fixed_ctr()
295 unsigned uncore_pci_event_ctl(struct intel_uncore_box *box, int idx) in uncore_pci_event_ctl() argument
297 if (test_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags)) in uncore_pci_event_ctl()
298 return idx * 8 + box->pmu->type->event_ctl; in uncore_pci_event_ctl()
300 return idx * 4 + box->pmu->type->event_ctl; in uncore_pci_event_ctl()
304 unsigned uncore_pci_perf_ctr(struct intel_uncore_box *box, int idx) in uncore_pci_perf_ctr() argument
306 return idx * 8 + box->pmu->type->perf_ctr; in uncore_pci_perf_ctr()
309 static inline unsigned uncore_msr_box_offset(struct intel_uncore_box *box) in uncore_msr_box_offset() argument
311 struct intel_uncore_pmu *pmu = box->pmu; in uncore_msr_box_offset()
317 static inline unsigned uncore_msr_box_ctl(struct intel_uncore_box *box) in uncore_msr_box_ctl() argument
319 if (!box->pmu->type->box_ctl) in uncore_msr_box_ctl()
321 return box->pmu->type->box_ctl + uncore_msr_box_offset(box); in uncore_msr_box_ctl()
324 static inline unsigned uncore_msr_fixed_ctl(struct intel_uncore_box *box) in uncore_msr_fixed_ctl() argument
326 if (!box->pmu->type->fixed_ctl) in uncore_msr_fixed_ctl()
328 return box->pmu->type->fixed_ctl + uncore_msr_box_offset(box); in uncore_msr_fixed_ctl()
331 static inline unsigned uncore_msr_fixed_ctr(struct intel_uncore_box *box) in uncore_msr_fixed_ctr() argument
333 return box->pmu->type->fixed_ctr + uncore_msr_box_offset(box); in uncore_msr_fixed_ctr()
378 unsigned int uncore_freerunning_counter(struct intel_uncore_box *box, in uncore_freerunning_counter() argument
383 struct intel_uncore_pmu *pmu = box->pmu; in uncore_freerunning_counter()
393 unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx) in uncore_msr_event_ctl() argument
395 if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) { in uncore_msr_event_ctl()
397 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); in uncore_msr_event_ctl()
399 return box->pmu->type->event_ctl + in uncore_msr_event_ctl()
400 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + in uncore_msr_event_ctl()
401 uncore_msr_box_offset(box); in uncore_msr_event_ctl()
406 unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx) in uncore_msr_perf_ctr() argument
408 if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) { in uncore_msr_perf_ctr()
410 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); in uncore_msr_perf_ctr()
412 return box->pmu->type->perf_ctr + in uncore_msr_perf_ctr()
413 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + in uncore_msr_perf_ctr()
414 uncore_msr_box_offset(box); in uncore_msr_perf_ctr()
419 unsigned uncore_fixed_ctl(struct intel_uncore_box *box) in uncore_fixed_ctl() argument
421 if (box->pci_dev || box->io_addr) in uncore_fixed_ctl()
422 return uncore_pci_fixed_ctl(box); in uncore_fixed_ctl()
424 return uncore_msr_fixed_ctl(box); in uncore_fixed_ctl()
428 unsigned uncore_fixed_ctr(struct intel_uncore_box *box) in uncore_fixed_ctr() argument
430 if (box->pci_dev || box->io_addr) in uncore_fixed_ctr()
431 return uncore_pci_fixed_ctr(box); in uncore_fixed_ctr()
433 return uncore_msr_fixed_ctr(box); in uncore_fixed_ctr()
437 unsigned uncore_event_ctl(struct intel_uncore_box *box, int idx) in uncore_event_ctl() argument
439 if (box->pci_dev || box->io_addr) in uncore_event_ctl()
440 return uncore_pci_event_ctl(box, idx); in uncore_event_ctl()
442 return uncore_msr_event_ctl(box, idx); in uncore_event_ctl()
446 unsigned uncore_perf_ctr(struct intel_uncore_box *box, int idx) in uncore_perf_ctr() argument
448 if (box->pci_dev || box->io_addr) in uncore_perf_ctr()
449 return uncore_pci_perf_ctr(box, idx); in uncore_perf_ctr()
451 return uncore_msr_perf_ctr(box, idx); in uncore_perf_ctr()
454 static inline int uncore_perf_ctr_bits(struct intel_uncore_box *box) in uncore_perf_ctr_bits() argument
456 return box->pmu->type->perf_ctr_bits; in uncore_perf_ctr_bits()
459 static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box) in uncore_fixed_ctr_bits() argument
461 return box->pmu->type->fixed_ctr_bits; in uncore_fixed_ctr_bits()
465 unsigned int uncore_freerunning_bits(struct intel_uncore_box *box, in uncore_freerunning_bits() argument
470 return box->pmu->type->freerunning[type].bits; in uncore_freerunning_bits()
473 static inline int uncore_num_freerunning(struct intel_uncore_box *box, in uncore_num_freerunning() argument
478 return box->pmu->type->freerunning[type].num_counters; in uncore_num_freerunning()
481 static inline int uncore_num_freerunning_types(struct intel_uncore_box *box, in uncore_num_freerunning_types() argument
484 return box->pmu->type->num_freerunning_types; in uncore_num_freerunning_types()
487 static inline bool check_valid_freerunning_event(struct intel_uncore_box *box, in check_valid_freerunning_event() argument
493 return (type < uncore_num_freerunning_types(box, event)) && in check_valid_freerunning_event()
494 (idx < uncore_num_freerunning(box, event)); in check_valid_freerunning_event()
497 static inline int uncore_num_counters(struct intel_uncore_box *box) in uncore_num_counters() argument
499 return box->pmu->type->num_counters; in uncore_num_counters()
511 static inline int uncore_freerunning_hw_config(struct intel_uncore_box *box, in uncore_freerunning_hw_config() argument
520 static inline void uncore_disable_event(struct intel_uncore_box *box, in uncore_disable_event() argument
523 box->pmu->type->ops->disable_event(box, event); in uncore_disable_event()
526 static inline void uncore_enable_event(struct intel_uncore_box *box, in uncore_enable_event() argument
529 box->pmu->type->ops->enable_event(box, event); in uncore_enable_event()
532 static inline u64 uncore_read_counter(struct intel_uncore_box *box, in uncore_read_counter() argument
535 return box->pmu->type->ops->read_counter(box, event); in uncore_read_counter()
538 static inline void uncore_box_init(struct intel_uncore_box *box) in uncore_box_init() argument
540 if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) { in uncore_box_init()
541 if (box->pmu->type->ops->init_box) in uncore_box_init()
542 box->pmu->type->ops->init_box(box); in uncore_box_init()
546 static inline void uncore_box_exit(struct intel_uncore_box *box) in uncore_box_exit() argument
548 if (test_and_clear_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) { in uncore_box_exit()
549 if (box->pmu->type->ops->exit_box) in uncore_box_exit()
550 box->pmu->type->ops->exit_box(box); in uncore_box_exit()
554 static inline bool uncore_box_is_fake(struct intel_uncore_box *box) in uncore_box_is_fake() argument
556 return (box->dieid < 0); in uncore_box_is_fake()
570 u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event);
571 void uncore_mmio_exit_box(struct intel_uncore_box *box);
572 u64 uncore_mmio_read_counter(struct intel_uncore_box *box,
574 void uncore_pmu_start_hrtimer(struct intel_uncore_box *box);
575 void uncore_pmu_cancel_hrtimer(struct intel_uncore_box *box);
581 void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *event);
583 uncore_get_constraint(struct intel_uncore_box *box, struct perf_event *event);
584 void uncore_put_constraint(struct intel_uncore_box *box, struct perf_event *event);
585 u64 uncore_shared_reg_config(struct intel_uncore_box *box, int idx);