perfmon.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * PERFCFGOFF_REG, PERFFRZOFF_REG
  4. * PERFOVFOFF_REG, PERFCNTROFF_REG
  5. */
  6. #define IOMMU_PMU_NUM_OFF_REGS 4
  7. #define IOMMU_PMU_OFF_REGS_STEP 4
  8. #define IOMMU_PMU_FILTER_REQUESTER_ID 0x01
  9. #define IOMMU_PMU_FILTER_DOMAIN 0x02
  10. #define IOMMU_PMU_FILTER_PASID 0x04
  11. #define IOMMU_PMU_FILTER_ATS 0x08
  12. #define IOMMU_PMU_FILTER_PAGE_TABLE 0x10
  13. #define IOMMU_PMU_FILTER_EN BIT(31)
  14. #define IOMMU_PMU_CFG_OFFSET 0x100
  15. #define IOMMU_PMU_CFG_CNTRCAP_OFFSET 0x80
  16. #define IOMMU_PMU_CFG_CNTREVCAP_OFFSET 0x84
  17. #define IOMMU_PMU_CFG_SIZE 0x8
  18. #define IOMMU_PMU_CFG_FILTERS_OFFSET 0x4
  19. #define IOMMU_PMU_CAP_REGS_STEP 8
  20. #define iommu_cntrcap_pcc(p) ((p) & 0x1)
  21. #define iommu_cntrcap_cw(p) (((p) >> 8) & 0xff)
  22. #define iommu_cntrcap_ios(p) (((p) >> 16) & 0x1)
  23. #define iommu_cntrcap_egcnt(p) (((p) >> 28) & 0xf)
  24. #define IOMMU_EVENT_CFG_EGI_SHIFT 8
  25. #define IOMMU_EVENT_CFG_ES_SHIFT 32
  26. #define IOMMU_EVENT_CFG_INT BIT_ULL(1)
  27. #define iommu_event_select(p) ((p) & 0xfffffff)
  28. #define iommu_event_group(p) (((p) >> 28) & 0xf)
  29. #ifdef CONFIG_INTEL_IOMMU_PERF_EVENTS
  30. int alloc_iommu_pmu(struct intel_iommu *iommu);
  31. void free_iommu_pmu(struct intel_iommu *iommu);
  32. void iommu_pmu_register(struct intel_iommu *iommu);
  33. void iommu_pmu_unregister(struct intel_iommu *iommu);
  34. #else
  35. static inline int
  36. alloc_iommu_pmu(struct intel_iommu *iommu)
  37. {
  38. return 0;
  39. }
  40. static inline void
  41. free_iommu_pmu(struct intel_iommu *iommu)
  42. {
  43. }
  44. static inline void
  45. iommu_pmu_register(struct intel_iommu *iommu)
  46. {
  47. }
  48. static inline void
  49. iommu_pmu_unregister(struct intel_iommu *iommu)
  50. {
  51. }
  52. #endif /* CONFIG_INTEL_IOMMU_PERF_EVENTS */