1

accel/habanalabs: add traces for dma mappings

In order to get a full picture of DMA mappings (e.g. to track DMAR
errors), DMA mappings APIs should be covered.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
Ohad Sharabi 2023-08-27 10:54:06 +03:00 committed by Oded Gabbay
parent d7aa294805
commit 309ed96903

View File

@ -87,6 +87,49 @@ DEFINE_EVENT(habanalabs_dma_alloc_template, habanalabs_dma_free,
TP_PROTO(struct device *dev, u64 cpu_addr, u64 dma_addr, size_t size, const char *caller),
TP_ARGS(dev, cpu_addr, dma_addr, size, caller));
DECLARE_EVENT_CLASS(habanalabs_dma_map_template,
TP_PROTO(struct device *dev, u64 phys_addr, u64 dma_addr, size_t len,
enum dma_data_direction dir, const char *caller),
TP_ARGS(dev, phys_addr, dma_addr, len, dir, caller),
TP_STRUCT__entry(
__string(dname, dev_name(dev))
__field(u64, phys_addr)
__field(u64, dma_addr)
__field(u32, len)
__field(int, dir)
__field(const char *, caller)
),
TP_fast_assign(
__assign_str(dname, dev_name(dev));
__entry->phys_addr = phys_addr;
__entry->dma_addr = dma_addr;
__entry->len = len;
__entry->dir = dir;
__entry->caller = caller;
),
TP_printk("%s: phys_addr: %#llx, dma_addr: %#llx, len: %#x, dir: %d, caller: %s",
__get_str(dname),
__entry->phys_addr,
__entry->dma_addr,
__entry->len,
__entry->dir,
__entry->caller)
);
DEFINE_EVENT(habanalabs_dma_map_template, habanalabs_dma_map_page,
TP_PROTO(struct device *dev, u64 phys_addr, u64 dma_addr, size_t len,
enum dma_data_direction dir, const char *caller),
TP_ARGS(dev, phys_addr, dma_addr, len, dir, caller));
DEFINE_EVENT(habanalabs_dma_map_template, habanalabs_dma_unmap_page,
TP_PROTO(struct device *dev, u64 phys_addr, u64 dma_addr, size_t len,
enum dma_data_direction dir, const char *caller),
TP_ARGS(dev, phys_addr, dma_addr, len, dir, caller));
DECLARE_EVENT_CLASS(habanalabs_comms_template,
TP_PROTO(struct device *dev, char *op_str),