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 10 #if !defined(_TRACE_IOMMU_H) || defined(TRACE_HEADER_MULTI_READ) 11 #define _TRACE_IOMMU_H 12 13 #include <linux/tracepoint.h> 14 15 struct device; 16 17 DECLARE_EVENT_CLASS(iommu_group_event, 18 19 TP_PROTO(int group_id, struct device *dev), 20 21 TP_ARGS(group_id, dev), 22 23 TP_STRUCT__entry( 24 __field(int, gid) 25 __string(device, dev_name(dev)) 26 ), 27 28 TP_fast_assign( 29 __entry->gid = group_id; 30 __assign_str(device, dev_name(dev)); 31 ), 32 33 TP_printk("IOMMU: groupID=%d device=%s", 34 __entry->gid, __get_str(device) 35 ) 36 ); 37 38 DEFINE_EVENT(iommu_group_event, add_device_to_group, 39 40 TP_PROTO(int group_id, struct device *dev), 41 42 TP_ARGS(group_id, dev) 43 44 ); 45 46 DEFINE_EVENT(iommu_group_event, remove_device_from_group, 47 48 TP_PROTO(int group_id, struct device *dev), 49 50 TP_ARGS(group_id, dev) 51 ); 52 53 DECLARE_EVENT_CLASS(iommu_device_event, 54 55 TP_PROTO(struct device *dev), 56 57 TP_ARGS(dev), 58 59 TP_STRUCT__entry( 60 __string(device, dev_name(dev)) 61 ), 62 63 TP_fast_assign( 64 __assign_str(device, dev_name(dev)); 65 ), 66 67 TP_printk("IOMMU: device=%s", __get_str(device) 68 ) 69 ); 70 71 DEFINE_EVENT(iommu_device_event, attach_device_to_domain, 72 73 TP_PROTO(struct device *dev), 74 75 TP_ARGS(dev) 76 ); 77 78 DEFINE_EVENT(iommu_device_event, detach_device_from_domain, 79 80 TP_PROTO(struct device *dev), 81 82 TP_ARGS(dev) 83 ); 84 85 TRACE_EVENT(map, 86 87 TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size), 88 89 TP_ARGS(iova, paddr, size), 90 91 TP_STRUCT__entry( 92 __field(u64, iova) 93 __field(u64, paddr) 94 __field(size_t, size) 95 ), 96 97 TP_fast_assign( 98 __entry->iova = iova; 99 __entry->paddr = paddr; 100 __entry->size = size; 101 ), 102 103 TP_printk("IOMMU: iova=0x%016llx paddr=0x%016llx size=%zu", 104 __entry->iova, __entry->paddr, __entry->size 105 ) 106 ); 107 108 TRACE_EVENT(unmap, 109 110 TP_PROTO(unsigned long iova, size_t size, size_t unmapped_size), 111 112 TP_ARGS(iova, size, unmapped_size), 113 114 TP_STRUCT__entry( 115 __field(u64, iova) 116 __field(size_t, size) 117 __field(size_t, unmapped_size) 118 ), 119 120 TP_fast_assign( 121 __entry->iova = iova; 122 __entry->size = size; 123 __entry->unmapped_size = unmapped_size; 124 ), 125 126 TP_printk("IOMMU: iova=0x%016llx size=%zu unmapped_size=%zu", 127 __entry->iova, __entry->size, __entry->unmapped_size 128 ) 129 ); 130 131 DECLARE_EVENT_CLASS(iommu_error, 132 133 TP_PROTO(struct device *dev, unsigned long iova, int flags), 134 135 TP_ARGS(dev, iova, flags), 136 137 TP_STRUCT__entry( 138 __string(device, dev_name(dev)) 139 __string(driver, dev_driver_string(dev)) 140 __field(u64, iova) 141 __field(int, flags) 142 ), 143 144 TP_fast_assign( 145 __assign_str(device, dev_name(dev)); 146 __assign_str(driver, dev_driver_string(dev)); 147 __entry->iova = iova; 148 __entry->flags = flags; 149 ), 150 151 TP_printk("IOMMU:%s %s iova=0x%016llx flags=0x%04x", 152 __get_str(driver), __get_str(device), 153 __entry->iova, __entry->flags 154 ) 155 ); 156 157 DEFINE_EVENT(iommu_error, io_page_fault, 158 159 TP_PROTO(struct device *dev, unsigned long iova, int flags), 160 161 TP_ARGS(dev, iova, flags) 162 ); 163 #endif /* _TRACE_IOMMU_H */ 164 165 /* This part must be outside protection */ 166 #include <trace/define_trace.h> 167