1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM dma_buf 4 5 #if !defined(_TRACE_DMA_BUF_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_DMA_BUF_H 7 8 #include <linux/dma-buf.h> 9 #include <linux/tracepoint.h> 10 11 DECLARE_EVENT_CLASS(dma_buf, 12 13 TP_PROTO(struct dma_buf *dmabuf), 14 15 TP_ARGS(dmabuf), 16 17 TP_STRUCT__entry( 18 __string(exp_name, dmabuf->exp_name) 19 __field(size_t, size) 20 __field(ino_t, ino) 21 ), 22 23 TP_fast_assign( 24 __assign_str(exp_name); 25 __entry->size = dmabuf->size; 26 __entry->ino = dmabuf->file->f_inode->i_ino; 27 ), 28 29 TP_printk("exp_name=%s size=%zu ino=%lu", 30 __get_str(exp_name), 31 __entry->size, 32 __entry->ino) 33 ); 34 35 DECLARE_EVENT_CLASS(dma_buf_attach_dev, 36 37 TP_PROTO(struct dma_buf *dmabuf, struct dma_buf_attachment *attach, 38 bool is_dynamic, struct device *dev), 39 40 TP_ARGS(dmabuf, attach, is_dynamic, dev), 41 42 TP_STRUCT__entry( 43 __string(dev_name, dev_name(dev)) 44 __string(exp_name, dmabuf->exp_name) 45 __field(size_t, size) 46 __field(ino_t, ino) 47 __field(struct dma_buf_attachment *, attach) 48 __field(bool, is_dynamic) 49 ), 50 51 TP_fast_assign( 52 __assign_str(dev_name); 53 __assign_str(exp_name); 54 __entry->size = dmabuf->size; 55 __entry->ino = dmabuf->file->f_inode->i_ino; 56 __entry->is_dynamic = is_dynamic; 57 __entry->attach = attach; 58 ), 59 60 TP_printk("exp_name=%s size=%zu ino=%lu attachment:%p is_dynamic=%d dev_name=%s", 61 __get_str(exp_name), 62 __entry->size, 63 __entry->ino, 64 __entry->attach, 65 __entry->is_dynamic, 66 __get_str(dev_name)) 67 ); 68 69 DECLARE_EVENT_CLASS(dma_buf_fd, 70 71 TP_PROTO(struct dma_buf *dmabuf, int fd), 72 73 TP_ARGS(dmabuf, fd), 74 75 TP_STRUCT__entry( 76 __string(exp_name, dmabuf->exp_name) 77 __field(size_t, size) 78 __field(ino_t, ino) 79 __field(int, fd) 80 ), 81 82 TP_fast_assign( 83 __assign_str(exp_name); 84 __entry->size = dmabuf->size; 85 __entry->ino = dmabuf->file->f_inode->i_ino; 86 __entry->fd = fd; 87 ), 88 89 TP_printk("exp_name=%s size=%zu ino=%lu fd=%d", 90 __get_str(exp_name), 91 __entry->size, 92 __entry->ino, 93 __entry->fd) 94 ); 95 96 DEFINE_EVENT(dma_buf, dma_buf_export, 97 98 TP_PROTO(struct dma_buf *dmabuf), 99 100 TP_ARGS(dmabuf) 101 ); 102 103 DEFINE_EVENT(dma_buf, dma_buf_mmap_internal, 104 105 TP_PROTO(struct dma_buf *dmabuf), 106 107 TP_ARGS(dmabuf) 108 ); 109 110 DEFINE_EVENT(dma_buf, dma_buf_mmap, 111 112 TP_PROTO(struct dma_buf *dmabuf), 113 114 TP_ARGS(dmabuf) 115 ); 116 117 DEFINE_EVENT(dma_buf, dma_buf_put, 118 119 TP_PROTO(struct dma_buf *dmabuf), 120 121 TP_ARGS(dmabuf) 122 ); 123 124 DEFINE_EVENT(dma_buf_attach_dev, dma_buf_dynamic_attach, 125 126 TP_PROTO(struct dma_buf *dmabuf, struct dma_buf_attachment *attach, 127 bool is_dynamic, struct device *dev), 128 129 TP_ARGS(dmabuf, attach, is_dynamic, dev) 130 ); 131 132 DEFINE_EVENT(dma_buf_attach_dev, dma_buf_detach, 133 134 TP_PROTO(struct dma_buf *dmabuf, struct dma_buf_attachment *attach, 135 bool is_dynamic, struct device *dev), 136 137 TP_ARGS(dmabuf, attach, is_dynamic, dev) 138 ); 139 140 DEFINE_EVENT(dma_buf_fd, dma_buf_fd, 141 142 TP_PROTO(struct dma_buf *dmabuf, int fd), 143 144 TP_ARGS(dmabuf, fd) 145 ); 146 147 DEFINE_EVENT(dma_buf_fd, dma_buf_get, 148 149 TP_PROTO(struct dma_buf *dmabuf, int fd), 150 151 TP_ARGS(dmabuf, fd) 152 ); 153 154 #endif /* _TRACE_DMA_BUF_H */ 155 156 /* This part must be outside protection */ 157 #include <trace/define_trace.h> 158