iommu.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. * iommu trace points
  3. *
  4. * Copyright (C) 2013 Shuah Khan <shuah.kh@samsung.com>
  5. *
  6. */
  7. #undef TRACE_SYSTEM
  8. #define TRACE_SYSTEM iommu
  9. #if !defined(_TRACE_IOMMU_H) || defined(TRACE_HEADER_MULTI_READ)
  10. #define _TRACE_IOMMU_H
  11. #include <linux/tracepoint.h>
  12. #include <linux/pci.h>
  13. struct device;
  14. DECLARE_EVENT_CLASS(iommu_group_event,
  15. TP_PROTO(int group_id, struct device *dev),
  16. TP_ARGS(group_id, dev),
  17. TP_STRUCT__entry(
  18. __field(int, gid)
  19. __string(device, dev_name(dev))
  20. ),
  21. TP_fast_assign(
  22. __entry->gid = group_id;
  23. __assign_str(device, dev_name(dev));
  24. ),
  25. TP_printk("IOMMU: groupID=%d device=%s",
  26. __entry->gid, __get_str(device)
  27. )
  28. );
  29. DEFINE_EVENT(iommu_group_event, add_device_to_group,
  30. TP_PROTO(int group_id, struct device *dev),
  31. TP_ARGS(group_id, dev)
  32. );
  33. DEFINE_EVENT(iommu_group_event, remove_device_from_group,
  34. TP_PROTO(int group_id, struct device *dev),
  35. TP_ARGS(group_id, dev)
  36. );
  37. DECLARE_EVENT_CLASS(iommu_device_event,
  38. TP_PROTO(struct device *dev),
  39. TP_ARGS(dev),
  40. TP_STRUCT__entry(
  41. __string(device, dev_name(dev))
  42. ),
  43. TP_fast_assign(
  44. __assign_str(device, dev_name(dev));
  45. ),
  46. TP_printk("IOMMU: device=%s", __get_str(device)
  47. )
  48. );
  49. DEFINE_EVENT(iommu_device_event, attach_device_to_domain,
  50. TP_PROTO(struct device *dev),
  51. TP_ARGS(dev)
  52. );
  53. DEFINE_EVENT(iommu_device_event, detach_device_from_domain,
  54. TP_PROTO(struct device *dev),
  55. TP_ARGS(dev)
  56. );
  57. TRACE_EVENT(map,
  58. TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size),
  59. TP_ARGS(iova, paddr, size),
  60. TP_STRUCT__entry(
  61. __field(u64, iova)
  62. __field(u64, paddr)
  63. __field(size_t, size)
  64. ),
  65. TP_fast_assign(
  66. __entry->iova = iova;
  67. __entry->paddr = paddr;
  68. __entry->size = size;
  69. ),
  70. TP_printk("IOMMU: iova=0x%016llx paddr=0x%016llx size=%zu",
  71. __entry->iova, __entry->paddr, __entry->size
  72. )
  73. );
  74. TRACE_EVENT(unmap,
  75. TP_PROTO(unsigned long iova, size_t size, size_t unmapped_size),
  76. TP_ARGS(iova, size, unmapped_size),
  77. TP_STRUCT__entry(
  78. __field(u64, iova)
  79. __field(size_t, size)
  80. __field(size_t, unmapped_size)
  81. ),
  82. TP_fast_assign(
  83. __entry->iova = iova;
  84. __entry->size = size;
  85. __entry->unmapped_size = unmapped_size;
  86. ),
  87. TP_printk("IOMMU: iova=0x%016llx size=%zu unmapped_size=%zu",
  88. __entry->iova, __entry->size, __entry->unmapped_size
  89. )
  90. );
  91. DECLARE_EVENT_CLASS(iommu_error,
  92. TP_PROTO(struct device *dev, unsigned long iova, int flags),
  93. TP_ARGS(dev, iova, flags),
  94. TP_STRUCT__entry(
  95. __string(device, dev_name(dev))
  96. __string(driver, dev_driver_string(dev))
  97. __field(u64, iova)
  98. __field(int, flags)
  99. ),
  100. TP_fast_assign(
  101. __assign_str(device, dev_name(dev));
  102. __assign_str(driver, dev_driver_string(dev));
  103. __entry->iova = iova;
  104. __entry->flags = flags;
  105. ),
  106. TP_printk("IOMMU:%s %s iova=0x%016llx flags=0x%04x",
  107. __get_str(driver), __get_str(device),
  108. __entry->iova, __entry->flags
  109. )
  110. );
  111. DEFINE_EVENT(iommu_error, io_page_fault,
  112. TP_PROTO(struct device *dev, unsigned long iova, int flags),
  113. TP_ARGS(dev, iova, flags)
  114. );
  115. #endif /* _TRACE_IOMMU_H */
  116. /* This part must be outside protection */
  117. #include <trace/define_trace.h>