1 /* SPDX-License-Identifier: GPL-2.0 2 * 3 * Copyright 2016-2021 HabanaLabs, Ltd. 4 * All Rights Reserved. 5 * 6 */ 7 8 #undef TRACE_SYSTEM 9 #define TRACE_SYSTEM habanalabs 10 11 #if !defined(_TRACE_HABANALABS_H) || defined(TRACE_HEADER_MULTI_READ) 12 #define _TRACE_HABANALABS_H 13 14 #include <linux/tracepoint.h> 15 16 DECLARE_EVENT_CLASS(habanalabs_mmu_template, 17 TP_PROTO(struct device *dev, u64 virt_addr, u64 phys_addr, u32 page_size, bool flush_pte), 18 19 TP_ARGS(dev, virt_addr, phys_addr, page_size, flush_pte), 20 21 TP_STRUCT__entry( 22 __string(dname, dev_name(dev)) 23 __field(u64, virt_addr) 24 __field(u64, phys_addr) 25 __field(u32, page_size) 26 __field(u8, flush_pte) 27 ), 28 29 TP_fast_assign( 30 __assign_str(dname, dev_name(dev)); 31 __entry->virt_addr = virt_addr; 32 __entry->phys_addr = phys_addr; 33 __entry->page_size = page_size; 34 __entry->flush_pte = flush_pte; 35 ), 36 37 TP_printk("%s: vaddr: %#llx, paddr: %#llx, psize: %#x, flush: %s", 38 __get_str(dname), 39 __entry->virt_addr, 40 __entry->phys_addr, 41 __entry->page_size, 42 __entry->flush_pte ? "true" : "false") 43 ); 44 45 DEFINE_EVENT(habanalabs_mmu_template, habanalabs_mmu_map, 46 TP_PROTO(struct device *dev, u64 virt_addr, u64 phys_addr, u32 page_size, bool flush_pte), 47 TP_ARGS(dev, virt_addr, phys_addr, page_size, flush_pte)); 48 49 DEFINE_EVENT(habanalabs_mmu_template, habanalabs_mmu_unmap, 50 TP_PROTO(struct device *dev, u64 virt_addr, u64 phys_addr, u32 page_size, bool flush_pte), 51 TP_ARGS(dev, virt_addr, phys_addr, page_size, flush_pte)); 52 53 DECLARE_EVENT_CLASS(habanalabs_dma_alloc_template, 54 TP_PROTO(struct device *dev, u64 cpu_addr, u64 dma_addr, size_t size, const char *caller), 55 56 TP_ARGS(dev, cpu_addr, dma_addr, size, caller), 57 58 TP_STRUCT__entry( 59 __string(dname, dev_name(dev)) 60 __field(u64, cpu_addr) 61 __field(u64, dma_addr) 62 __field(u32, size) 63 __field(const char *, caller) 64 ), 65 66 TP_fast_assign( 67 __assign_str(dname, dev_name(dev)); 68 __entry->cpu_addr = cpu_addr; 69 __entry->dma_addr = dma_addr; 70 __entry->size = size; 71 __entry->caller = caller; 72 ), 73 74 TP_printk("%s: cpu_addr: %#llx, dma_addr: %#llx, size: %#x, caller: %s", 75 __get_str(dname), 76 __entry->cpu_addr, 77 __entry->dma_addr, 78 __entry->size, 79 __entry->caller) 80 ); 81 82 DEFINE_EVENT(habanalabs_dma_alloc_template, habanalabs_dma_alloc, 83 TP_PROTO(struct device *dev, u64 cpu_addr, u64 dma_addr, size_t size, const char *caller), 84 TP_ARGS(dev, cpu_addr, dma_addr, size, caller)); 85 86 DEFINE_EVENT(habanalabs_dma_alloc_template, habanalabs_dma_free, 87 TP_PROTO(struct device *dev, u64 cpu_addr, u64 dma_addr, size_t size, const char *caller), 88 TP_ARGS(dev, cpu_addr, dma_addr, size, caller)); 89 90 #endif /* if !defined(_TRACE_HABANALABS_H) || defined(TRACE_HEADER_MULTI_READ) */ 91 92 /* This part must be outside protection */ 93 #include <trace/define_trace.h> 94