1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Copyright (C) 2013 Shuah Khan <shuah.kh@samsung.com>
9 #define TRACE_SYSTEM iommu
11 #if !defined(_TRACE_IOMMU_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_IOMMU_H
14 #include <linux/tracepoint.h>
18 DECLARE_EVENT_CLASS(iommu_group_event
,
20 TP_PROTO(int group_id
, struct device
*dev
),
22 TP_ARGS(group_id
, dev
),
26 __string(device
, dev_name(dev
))
30 __entry
->gid
= group_id
;
31 __assign_str(device
, dev_name(dev
));
34 TP_printk("IOMMU: groupID=%d device=%s",
35 __entry
->gid
, __get_str(device
)
39 DEFINE_EVENT(iommu_group_event
, add_device_to_group
,
41 TP_PROTO(int group_id
, struct device
*dev
),
43 TP_ARGS(group_id
, dev
)
47 DEFINE_EVENT(iommu_group_event
, remove_device_from_group
,
49 TP_PROTO(int group_id
, struct device
*dev
),
51 TP_ARGS(group_id
, dev
)
54 DECLARE_EVENT_CLASS(iommu_device_event
,
56 TP_PROTO(struct device
*dev
),
61 __string(device
, dev_name(dev
))
65 __assign_str(device
, dev_name(dev
));
68 TP_printk("IOMMU: device=%s", __get_str(device
)
72 DEFINE_EVENT(iommu_device_event
, attach_device_to_domain
,
74 TP_PROTO(struct device
*dev
),
79 DEFINE_EVENT(iommu_device_event
, detach_device_from_domain
,
81 TP_PROTO(struct device
*dev
),
88 TP_PROTO(unsigned long iova
, phys_addr_t paddr
, size_t size
),
90 TP_ARGS(iova
, paddr
, size
),
100 __entry
->paddr
= paddr
;
101 __entry
->size
= size
;
104 TP_printk("IOMMU: iova=0x%016llx paddr=0x%016llx size=%zu",
105 __entry
->iova
, __entry
->paddr
, __entry
->size
111 TP_PROTO(unsigned long iova
, size_t size
, size_t unmapped_size
),
113 TP_ARGS(iova
, size
, unmapped_size
),
117 __field(size_t, size
)
118 __field(size_t, unmapped_size
)
122 __entry
->iova
= iova
;
123 __entry
->size
= size
;
124 __entry
->unmapped_size
= unmapped_size
;
127 TP_printk("IOMMU: iova=0x%016llx size=%zu unmapped_size=%zu",
128 __entry
->iova
, __entry
->size
, __entry
->unmapped_size
132 DECLARE_EVENT_CLASS(iommu_error
,
134 TP_PROTO(struct device
*dev
, unsigned long iova
, int flags
),
136 TP_ARGS(dev
, iova
, flags
),
139 __string(device
, dev_name(dev
))
140 __string(driver
, dev_driver_string(dev
))
146 __assign_str(device
, dev_name(dev
));
147 __assign_str(driver
, dev_driver_string(dev
));
148 __entry
->iova
= iova
;
149 __entry
->flags
= flags
;
152 TP_printk("IOMMU:%s %s iova=0x%016llx flags=0x%04x",
153 __get_str(driver
), __get_str(device
),
154 __entry
->iova
, __entry
->flags
158 DEFINE_EVENT(iommu_error
, io_page_fault
,
160 TP_PROTO(struct device
*dev
, unsigned long iova
, int flags
),
162 TP_ARGS(dev
, iova
, flags
)
164 #endif /* _TRACE_IOMMU_H */
166 /* This part must be outside protection */
167 #include <trace/define_trace.h>