Lines Matching refs:box
261 static inline bool uncore_mmio_is_valid_offset(struct intel_uncore_box *box, in uncore_mmio_is_valid_offset() argument
264 if (offset < box->pmu->type->mmio_map_size) in uncore_mmio_is_valid_offset()
268 offset, box->pmu->type->name); in uncore_mmio_is_valid_offset()
274 unsigned int uncore_mmio_box_ctl(struct intel_uncore_box *box) in uncore_mmio_box_ctl() argument
276 return box->pmu->type->box_ctl + in uncore_mmio_box_ctl()
277 box->pmu->type->mmio_offset * box->pmu->pmu_idx; in uncore_mmio_box_ctl()
280 static inline unsigned uncore_pci_box_ctl(struct intel_uncore_box *box) in uncore_pci_box_ctl() argument
282 return box->pmu->type->box_ctl; in uncore_pci_box_ctl()
285 static inline unsigned uncore_pci_fixed_ctl(struct intel_uncore_box *box) in uncore_pci_fixed_ctl() argument
287 return box->pmu->type->fixed_ctl; in uncore_pci_fixed_ctl()
290 static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box) in uncore_pci_fixed_ctr() argument
292 return box->pmu->type->fixed_ctr; in uncore_pci_fixed_ctr()
296 unsigned uncore_pci_event_ctl(struct intel_uncore_box *box, int idx) in uncore_pci_event_ctl() argument
298 if (test_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags)) in uncore_pci_event_ctl()
299 return idx * 8 + box->pmu->type->event_ctl; in uncore_pci_event_ctl()
301 return idx * 4 + box->pmu->type->event_ctl; in uncore_pci_event_ctl()
305 unsigned uncore_pci_perf_ctr(struct intel_uncore_box *box, int idx) in uncore_pci_perf_ctr() argument
307 return idx * 8 + box->pmu->type->perf_ctr; in uncore_pci_perf_ctr()
310 static inline unsigned uncore_msr_box_offset(struct intel_uncore_box *box) in uncore_msr_box_offset() argument
312 struct intel_uncore_pmu *pmu = box->pmu; in uncore_msr_box_offset()
318 static inline unsigned uncore_msr_box_ctl(struct intel_uncore_box *box) in uncore_msr_box_ctl() argument
320 if (!box->pmu->type->box_ctl) in uncore_msr_box_ctl()
322 return box->pmu->type->box_ctl + uncore_msr_box_offset(box); in uncore_msr_box_ctl()
325 static inline unsigned uncore_msr_fixed_ctl(struct intel_uncore_box *box) in uncore_msr_fixed_ctl() argument
327 if (!box->pmu->type->fixed_ctl) in uncore_msr_fixed_ctl()
329 return box->pmu->type->fixed_ctl + uncore_msr_box_offset(box); in uncore_msr_fixed_ctl()
332 static inline unsigned uncore_msr_fixed_ctr(struct intel_uncore_box *box) in uncore_msr_fixed_ctr() argument
334 return box->pmu->type->fixed_ctr + uncore_msr_box_offset(box); in uncore_msr_fixed_ctr()
379 unsigned int uncore_freerunning_counter(struct intel_uncore_box *box, in uncore_freerunning_counter() argument
384 struct intel_uncore_pmu *pmu = box->pmu; in uncore_freerunning_counter()
394 unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx) in uncore_msr_event_ctl() argument
396 if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) { in uncore_msr_event_ctl()
398 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); in uncore_msr_event_ctl()
400 return box->pmu->type->event_ctl + in uncore_msr_event_ctl()
401 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + in uncore_msr_event_ctl()
402 uncore_msr_box_offset(box); in uncore_msr_event_ctl()
407 unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx) in uncore_msr_perf_ctr() argument
409 if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) { in uncore_msr_perf_ctr()
411 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); in uncore_msr_perf_ctr()
413 return box->pmu->type->perf_ctr + in uncore_msr_perf_ctr()
414 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + in uncore_msr_perf_ctr()
415 uncore_msr_box_offset(box); in uncore_msr_perf_ctr()
420 unsigned uncore_fixed_ctl(struct intel_uncore_box *box) in uncore_fixed_ctl() argument
422 if (box->pci_dev || box->io_addr) in uncore_fixed_ctl()
423 return uncore_pci_fixed_ctl(box); in uncore_fixed_ctl()
425 return uncore_msr_fixed_ctl(box); in uncore_fixed_ctl()
429 unsigned uncore_fixed_ctr(struct intel_uncore_box *box) in uncore_fixed_ctr() argument
431 if (box->pci_dev || box->io_addr) in uncore_fixed_ctr()
432 return uncore_pci_fixed_ctr(box); in uncore_fixed_ctr()
434 return uncore_msr_fixed_ctr(box); in uncore_fixed_ctr()
438 unsigned uncore_event_ctl(struct intel_uncore_box *box, int idx) in uncore_event_ctl() argument
440 if (box->pci_dev || box->io_addr) in uncore_event_ctl()
441 return uncore_pci_event_ctl(box, idx); in uncore_event_ctl()
443 return uncore_msr_event_ctl(box, idx); in uncore_event_ctl()
447 unsigned uncore_perf_ctr(struct intel_uncore_box *box, int idx) in uncore_perf_ctr() argument
449 if (box->pci_dev || box->io_addr) in uncore_perf_ctr()
450 return uncore_pci_perf_ctr(box, idx); in uncore_perf_ctr()
452 return uncore_msr_perf_ctr(box, idx); in uncore_perf_ctr()
455 static inline int uncore_perf_ctr_bits(struct intel_uncore_box *box) in uncore_perf_ctr_bits() argument
457 return box->pmu->type->perf_ctr_bits; in uncore_perf_ctr_bits()
460 static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box) in uncore_fixed_ctr_bits() argument
462 return box->pmu->type->fixed_ctr_bits; in uncore_fixed_ctr_bits()
466 unsigned int uncore_freerunning_bits(struct intel_uncore_box *box, in uncore_freerunning_bits() argument
471 return box->pmu->type->freerunning[type].bits; in uncore_freerunning_bits()
474 static inline int uncore_num_freerunning(struct intel_uncore_box *box, in uncore_num_freerunning() argument
479 return box->pmu->type->freerunning[type].num_counters; in uncore_num_freerunning()
482 static inline int uncore_num_freerunning_types(struct intel_uncore_box *box, in uncore_num_freerunning_types() argument
485 return box->pmu->type->num_freerunning_types; in uncore_num_freerunning_types()
488 static inline bool check_valid_freerunning_event(struct intel_uncore_box *box, in check_valid_freerunning_event() argument
494 return (type < uncore_num_freerunning_types(box, event)) && in check_valid_freerunning_event()
495 (idx < uncore_num_freerunning(box, event)); in check_valid_freerunning_event()
498 static inline int uncore_num_counters(struct intel_uncore_box *box) in uncore_num_counters() argument
500 return box->pmu->type->num_counters; in uncore_num_counters()
512 static inline int uncore_freerunning_hw_config(struct intel_uncore_box *box, in uncore_freerunning_hw_config() argument
521 static inline void uncore_disable_event(struct intel_uncore_box *box, in uncore_disable_event() argument
524 box->pmu->type->ops->disable_event(box, event); in uncore_disable_event()
527 static inline void uncore_enable_event(struct intel_uncore_box *box, in uncore_enable_event() argument
530 box->pmu->type->ops->enable_event(box, event); in uncore_enable_event()
533 static inline u64 uncore_read_counter(struct intel_uncore_box *box, in uncore_read_counter() argument
536 return box->pmu->type->ops->read_counter(box, event); in uncore_read_counter()
539 static inline void uncore_box_init(struct intel_uncore_box *box) in uncore_box_init() argument
541 if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) { in uncore_box_init()
542 if (box->pmu->type->ops->init_box) in uncore_box_init()
543 box->pmu->type->ops->init_box(box); in uncore_box_init()
547 static inline void uncore_box_exit(struct intel_uncore_box *box) in uncore_box_exit() argument
549 if (test_and_clear_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) { in uncore_box_exit()
550 if (box->pmu->type->ops->exit_box) in uncore_box_exit()
551 box->pmu->type->ops->exit_box(box); in uncore_box_exit()
555 static inline bool uncore_box_is_fake(struct intel_uncore_box *box) in uncore_box_is_fake() argument
557 return (box->dieid < 0); in uncore_box_is_fake()
571 u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event);
572 void uncore_mmio_exit_box(struct intel_uncore_box *box);
573 u64 uncore_mmio_read_counter(struct intel_uncore_box *box,
575 void uncore_pmu_start_hrtimer(struct intel_uncore_box *box);
576 void uncore_pmu_cancel_hrtimer(struct intel_uncore_box *box);
582 void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *event);
584 uncore_get_constraint(struct intel_uncore_box *box, struct perf_event *event);
585 void uncore_put_constraint(struct intel_uncore_box *box, struct perf_event *event);
586 u64 uncore_shared_reg_config(struct intel_uncore_box *box, int idx);