Lines Matching refs:iommu
346 struct intel_iommu *iommu = iommu_pmu->iommu; in iommu_pmu_start() local
375 ecmd_submit_sync(iommu, DMA_ECMD_ENABLE, hwc->idx, 0); in iommu_pmu_start()
383 struct intel_iommu *iommu = iommu_pmu->iommu; in iommu_pmu_stop() local
387 ecmd_submit_sync(iommu, DMA_ECMD_DISABLE, hwc->idx, 0); in iommu_pmu_stop()
495 struct intel_iommu *iommu = iommu_pmu->iommu; in iommu_pmu_enable() local
497 ecmd_submit_sync(iommu, DMA_ECMD_UNFREEZE, 0, 0); in iommu_pmu_enable()
503 struct intel_iommu *iommu = iommu_pmu->iommu; in iommu_pmu_disable() local
505 ecmd_submit_sync(iommu, DMA_ECMD_FREEZE, 0, 0); in iommu_pmu_disable()
538 struct intel_iommu *iommu = dev_id; in iommu_pmu_irq_handler() local
540 if (!dmar_readl(iommu->reg + DMAR_PERFINTRSTS_REG)) in iommu_pmu_irq_handler()
543 iommu_pmu_counter_overflow(iommu->pmu); in iommu_pmu_irq_handler()
546 dmar_writel(iommu->reg + DMAR_PERFINTRSTS_REG, DMA_PERFINTRSTS_PIS); in iommu_pmu_irq_handler()
551 static int __iommu_pmu_register(struct intel_iommu *iommu) in __iommu_pmu_register() argument
553 struct iommu_pmu *iommu_pmu = iommu->pmu; in __iommu_pmu_register()
555 iommu_pmu->pmu.name = iommu->name; in __iommu_pmu_register()
574 get_perf_reg_address(struct intel_iommu *iommu, u32 offset) in get_perf_reg_address() argument
576 u32 off = dmar_readl(iommu->reg + offset); in get_perf_reg_address()
578 return iommu->reg + off; in get_perf_reg_address()
581 int alloc_iommu_pmu(struct intel_iommu *iommu) in alloc_iommu_pmu() argument
588 if (!ecap_pms(iommu->ecap)) in alloc_iommu_pmu()
592 if (!cap_ecmds(iommu->cap)) in alloc_iommu_pmu()
595 perfcap = dmar_readq(iommu->reg + DMAR_PERFCAP_REG); in alloc_iommu_pmu()
609 if (!ecmd_has_pmu_essential(iommu)) in alloc_iommu_pmu()
638 pcap = dmar_readq(iommu->reg + DMAR_PERFEVNTCAP_REG + in alloc_iommu_pmu()
662 iommu_pmu->cfg_reg = get_perf_reg_address(iommu, DMAR_PERFCFGOFF_REG); in alloc_iommu_pmu()
663 iommu_pmu->cntr_reg = get_perf_reg_address(iommu, DMAR_PERFCNTROFF_REG); in alloc_iommu_pmu()
664 iommu_pmu->overflow = get_perf_reg_address(iommu, DMAR_PERFOVFOFF_REG); in alloc_iommu_pmu()
708 iommu_pmu->iommu = iommu; in alloc_iommu_pmu()
709 iommu->pmu = iommu_pmu; in alloc_iommu_pmu()
725 void free_iommu_pmu(struct intel_iommu *iommu) in free_iommu_pmu() argument
727 struct iommu_pmu *iommu_pmu = iommu->pmu; in free_iommu_pmu()
741 iommu->pmu = NULL; in free_iommu_pmu()
744 static int iommu_pmu_set_interrupt(struct intel_iommu *iommu) in iommu_pmu_set_interrupt() argument
746 struct iommu_pmu *iommu_pmu = iommu->pmu; in iommu_pmu_set_interrupt()
749 irq = dmar_alloc_hwirq(IOMMU_IRQ_ID_OFFSET_PERF + iommu->seq_id, iommu->node, iommu); in iommu_pmu_set_interrupt()
753 snprintf(iommu_pmu->irq_name, sizeof(iommu_pmu->irq_name), "dmar%d-perf", iommu->seq_id); in iommu_pmu_set_interrupt()
755 iommu->perf_irq = irq; in iommu_pmu_set_interrupt()
757 IRQF_ONESHOT, iommu_pmu->irq_name, iommu); in iommu_pmu_set_interrupt()
760 iommu->perf_irq = 0; in iommu_pmu_set_interrupt()
766 static void iommu_pmu_unset_interrupt(struct intel_iommu *iommu) in iommu_pmu_unset_interrupt() argument
768 if (!iommu->perf_irq) in iommu_pmu_unset_interrupt()
771 free_irq(iommu->perf_irq, iommu); in iommu_pmu_unset_interrupt()
772 dmar_free_hwirq(iommu->perf_irq); in iommu_pmu_unset_interrupt()
773 iommu->perf_irq = 0; in iommu_pmu_unset_interrupt()
859 void iommu_pmu_register(struct intel_iommu *iommu) in iommu_pmu_register() argument
861 struct iommu_pmu *iommu_pmu = iommu->pmu; in iommu_pmu_register()
866 if (__iommu_pmu_register(iommu)) in iommu_pmu_register()
873 if (iommu_pmu_set_interrupt(iommu)) in iommu_pmu_register()
883 pr_err("Failed to register PMU for iommu (seq_id = %d)\n", iommu->seq_id); in iommu_pmu_register()
884 free_iommu_pmu(iommu); in iommu_pmu_register()
887 void iommu_pmu_unregister(struct intel_iommu *iommu) in iommu_pmu_unregister() argument
889 struct iommu_pmu *iommu_pmu = iommu->pmu; in iommu_pmu_unregister()
894 iommu_pmu_unset_interrupt(iommu); in iommu_pmu_unregister()