blob: 2c7befb10f13e3b0175385e501e40ddedaab9094 [file] [log] [blame]
Shuah Khan7f6db172013-08-15 11:59:23 -06001/*
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#include <linux/pci.h>
15
16struct device;
17
18DECLARE_EVENT_CLASS(iommu_group_event,
19
20 TP_PROTO(int group_id, struct device *dev),
21
22 TP_ARGS(group_id, dev),
23
24 TP_STRUCT__entry(
25 __field(int, gid)
26 __string(device, dev_name(dev))
27 ),
28
29 TP_fast_assign(
30 __entry->gid = group_id;
31 __assign_str(device, dev_name(dev));
32 ),
33
34 TP_printk("IOMMU: groupID=%d device=%s",
35 __entry->gid, __get_str(device)
36 )
37);
38
39DEFINE_EVENT(iommu_group_event, add_device_to_group,
40
41 TP_PROTO(int group_id, struct device *dev),
42
43 TP_ARGS(group_id, dev)
44
45);
46
47DEFINE_EVENT(iommu_group_event, remove_device_from_group,
48
49 TP_PROTO(int group_id, struct device *dev),
50
51 TP_ARGS(group_id, dev)
52);
53
54DECLARE_EVENT_CLASS(iommu_device_event,
55
56 TP_PROTO(struct device *dev),
57
58 TP_ARGS(dev),
59
60 TP_STRUCT__entry(
61 __string(device, dev_name(dev))
62 ),
63
64 TP_fast_assign(
65 __assign_str(device, dev_name(dev));
66 ),
67
68 TP_printk("IOMMU: device=%s", __get_str(device)
69 )
70);
71
72DEFINE_EVENT(iommu_device_event, attach_device_to_domain,
73
74 TP_PROTO(struct device *dev),
75
76 TP_ARGS(dev)
77);
78
79DEFINE_EVENT(iommu_device_event, detach_device_from_domain,
80
81 TP_PROTO(struct device *dev),
82
83 TP_ARGS(dev)
84);
85
Shuah Khandb8614d2015-01-16 20:53:17 -070086TRACE_EVENT(map,
Shuah Khan7f6db172013-08-15 11:59:23 -060087
88 TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size),
89
90 TP_ARGS(iova, paddr, size),
91
92 TP_STRUCT__entry(
93 __field(u64, iova)
94 __field(u64, paddr)
Shuah Khandb8614d2015-01-16 20:53:17 -070095 __field(size_t, size)
Shuah Khan7f6db172013-08-15 11:59:23 -060096 ),
97
98 TP_fast_assign(
99 __entry->iova = iova;
100 __entry->paddr = paddr;
101 __entry->size = size;
102 ),
103
Shuah Khandb8614d2015-01-16 20:53:17 -0700104 TP_printk("IOMMU: iova=0x%016llx paddr=0x%016llx size=%zu",
Shuah Khan7f6db172013-08-15 11:59:23 -0600105 __entry->iova, __entry->paddr, __entry->size
106 )
107);
108
Shuah Khandb8614d2015-01-16 20:53:17 -0700109TRACE_EVENT(unmap,
Shuah Khan7f6db172013-08-15 11:59:23 -0600110
Shuah Khandb8614d2015-01-16 20:53:17 -0700111 TP_PROTO(unsigned long iova, size_t size, size_t unmapped_size),
Shuah Khan7f6db172013-08-15 11:59:23 -0600112
Shuah Khandb8614d2015-01-16 20:53:17 -0700113 TP_ARGS(iova, size, unmapped_size),
Shuah Khan7f6db172013-08-15 11:59:23 -0600114
Shuah Khandb8614d2015-01-16 20:53:17 -0700115 TP_STRUCT__entry(
116 __field(u64, iova)
117 __field(size_t, size)
118 __field(size_t, unmapped_size)
119 ),
Shuah Khan7f6db172013-08-15 11:59:23 -0600120
Shuah Khandb8614d2015-01-16 20:53:17 -0700121 TP_fast_assign(
122 __entry->iova = iova;
123 __entry->size = size;
124 __entry->unmapped_size = unmapped_size;
125 ),
Shuah Khan7f6db172013-08-15 11:59:23 -0600126
Shuah Khandb8614d2015-01-16 20:53:17 -0700127 TP_printk("IOMMU: iova=0x%016llx size=%zu unmapped_size=%zu",
128 __entry->iova, __entry->size, __entry->unmapped_size
Shuah Khan7f6db172013-08-15 11:59:23 -0600129 )
130);
Shuah Khan04fa2f72013-09-24 15:21:19 -0600131
132DECLARE_EVENT_CLASS(iommu_error,
133
134 TP_PROTO(struct device *dev, unsigned long iova, int flags),
135
136 TP_ARGS(dev, iova, flags),
137
138 TP_STRUCT__entry(
139 __string(device, dev_name(dev))
140 __string(driver, dev_driver_string(dev))
141 __field(u64, iova)
142 __field(int, flags)
143 ),
144
145 TP_fast_assign(
146 __assign_str(device, dev_name(dev));
147 __assign_str(driver, dev_driver_string(dev));
148 __entry->iova = iova;
149 __entry->flags = flags;
150 ),
151
152 TP_printk("IOMMU:%s %s iova=0x%016llx flags=0x%04x",
153 __get_str(driver), __get_str(device),
154 __entry->iova, __entry->flags
155 )
156);
157
158DEFINE_EVENT(iommu_error, io_page_fault,
159
160 TP_PROTO(struct device *dev, unsigned long iova, int flags),
161
162 TP_ARGS(dev, iova, flags)
163);
Shuah Khan7f6db172013-08-15 11:59:23 -0600164#endif /* _TRACE_IOMMU_H */
165
166/* This part must be outside protection */
167#include <trace/define_trace.h>