Skip to content

Commit f2dd871

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Add qi_submit trace event
This adds a new trace event to track the submissions of requests to the invalidation queue. This event will provide the information like: - IOMMU name - Invalidation type - Descriptor raw data A sample output like: | qi_submit: iotlb_inv dmar1: 0x100e2 0x0 0x0 0x0 | qi_submit: dev_tlb_inv dmar1: 0x1000000003 0x7ffffffffffff001 0x0 0x0 | qi_submit: iotlb_inv dmar2: 0x800f2 0xf9a00005 0x0 0x0 This will be helpful for queued invalidation related debugging. Signed-off-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 9872f9b commit f2dd871

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

drivers/iommu/intel/dmar.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/limits.h>
3232
#include <asm/irq_remapping.h>
3333
#include <asm/iommu_table.h>
34+
#include <trace/events/intel_iommu.h>
3435

3536
#include "../irq_remapping.h"
3637

@@ -1307,6 +1308,8 @@ int qi_submit_sync(struct intel_iommu *iommu, struct qi_desc *desc,
13071308
offset = ((index + i) % QI_LENGTH) << shift;
13081309
memcpy(qi->desc + offset, &desc[i], 1 << shift);
13091310
qi->desc_status[(index + i) % QI_LENGTH] = QI_IN_USE;
1311+
trace_qi_submit(iommu, desc[i].qw0, desc[i].qw1,
1312+
desc[i].qw2, desc[i].qw3);
13101313
}
13111314
qi->desc_status[wait_index] = QI_IN_USE;
13121315

include/trace/events/intel_iommu.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,43 @@ DEFINE_EVENT(dma_map_sg, bounce_map_sg,
135135
struct scatterlist *sg),
136136
TP_ARGS(dev, index, total, sg)
137137
);
138+
139+
TRACE_EVENT(qi_submit,
140+
TP_PROTO(struct intel_iommu *iommu, u64 qw0, u64 qw1, u64 qw2, u64 qw3),
141+
142+
TP_ARGS(iommu, qw0, qw1, qw2, qw3),
143+
144+
TP_STRUCT__entry(
145+
__field(u64, qw0)
146+
__field(u64, qw1)
147+
__field(u64, qw2)
148+
__field(u64, qw3)
149+
__string(iommu, iommu->name)
150+
),
151+
152+
TP_fast_assign(
153+
__assign_str(iommu, iommu->name);
154+
__entry->qw0 = qw0;
155+
__entry->qw1 = qw1;
156+
__entry->qw2 = qw2;
157+
__entry->qw3 = qw3;
158+
),
159+
160+
TP_printk("%s %s: 0x%llx 0x%llx 0x%llx 0x%llx",
161+
__print_symbolic(__entry->qw0 & 0xf,
162+
{ QI_CC_TYPE, "cc_inv" },
163+
{ QI_IOTLB_TYPE, "iotlb_inv" },
164+
{ QI_DIOTLB_TYPE, "dev_tlb_inv" },
165+
{ QI_IEC_TYPE, "iec_inv" },
166+
{ QI_IWD_TYPE, "inv_wait" },
167+
{ QI_EIOTLB_TYPE, "p_iotlb_inv" },
168+
{ QI_PC_TYPE, "pc_inv" },
169+
{ QI_DEIOTLB_TYPE, "p_dev_tlb_inv" },
170+
{ QI_PGRP_RESP_TYPE, "page_grp_resp" }),
171+
__get_str(iommu),
172+
__entry->qw0, __entry->qw1, __entry->qw2, __entry->qw3
173+
)
174+
);
138175
#endif /* _TRACE_INTEL_IOMMU_H */
139176

140177
/* This part must be outside protection */

0 commit comments

Comments
 (0)