xref: /openbmc/linux/drivers/vfio/pci/trace.h (revision f519f0be)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * VFIO PCI mmap/mmap_fault tracepoints
4  *
5  * Copyright (C) 2018 IBM Corp.  All rights reserved.
6  *     Author: Alexey Kardashevskiy <aik@ozlabs.ru>
7  */
8 
9 #undef TRACE_SYSTEM
10 #define TRACE_SYSTEM vfio_pci
11 
12 #if !defined(_TRACE_VFIO_PCI_H) || defined(TRACE_HEADER_MULTI_READ)
13 #define _TRACE_VFIO_PCI_H
14 
15 #include <linux/tracepoint.h>
16 
17 TRACE_EVENT(vfio_pci_nvgpu_mmap_fault,
18 	TP_PROTO(struct pci_dev *pdev, unsigned long hpa, unsigned long ua,
19 			vm_fault_t ret),
20 	TP_ARGS(pdev, hpa, ua, ret),
21 
22 	TP_STRUCT__entry(
23 		__field(const char *, name)
24 		__field(unsigned long, hpa)
25 		__field(unsigned long, ua)
26 		__field(int, ret)
27 	),
28 
29 	TP_fast_assign(
30 		__entry->name = dev_name(&pdev->dev),
31 		__entry->hpa = hpa;
32 		__entry->ua = ua;
33 		__entry->ret = ret;
34 	),
35 
36 	TP_printk("%s: %lx -> %lx ret=%d", __entry->name, __entry->hpa,
37 			__entry->ua, __entry->ret)
38 );
39 
40 TRACE_EVENT(vfio_pci_nvgpu_mmap,
41 	TP_PROTO(struct pci_dev *pdev, unsigned long hpa, unsigned long ua,
42 			unsigned long size, int ret),
43 	TP_ARGS(pdev, hpa, ua, size, ret),
44 
45 	TP_STRUCT__entry(
46 		__field(const char *, name)
47 		__field(unsigned long, hpa)
48 		__field(unsigned long, ua)
49 		__field(unsigned long, size)
50 		__field(int, ret)
51 	),
52 
53 	TP_fast_assign(
54 		__entry->name = dev_name(&pdev->dev),
55 		__entry->hpa = hpa;
56 		__entry->ua = ua;
57 		__entry->size = size;
58 		__entry->ret = ret;
59 	),
60 
61 	TP_printk("%s: %lx -> %lx size=%lx ret=%d", __entry->name, __entry->hpa,
62 			__entry->ua, __entry->size, __entry->ret)
63 );
64 
65 TRACE_EVENT(vfio_pci_npu2_mmap,
66 	TP_PROTO(struct pci_dev *pdev, unsigned long hpa, unsigned long ua,
67 			unsigned long size, int ret),
68 	TP_ARGS(pdev, hpa, ua, size, ret),
69 
70 	TP_STRUCT__entry(
71 		__field(const char *, name)
72 		__field(unsigned long, hpa)
73 		__field(unsigned long, ua)
74 		__field(unsigned long, size)
75 		__field(int, ret)
76 	),
77 
78 	TP_fast_assign(
79 		__entry->name = dev_name(&pdev->dev),
80 		__entry->hpa = hpa;
81 		__entry->ua = ua;
82 		__entry->size = size;
83 		__entry->ret = ret;
84 	),
85 
86 	TP_printk("%s: %lx -> %lx size=%lx ret=%d", __entry->name, __entry->hpa,
87 			__entry->ua, __entry->size, __entry->ret)
88 );
89 
90 #endif /* _TRACE_VFIO_PCI_H */
91 
92 #undef TRACE_INCLUDE_PATH
93 #define TRACE_INCLUDE_PATH ../../drivers/vfio/pci
94 #undef TRACE_INCLUDE_FILE
95 #define TRACE_INCLUDE_FILE trace
96 
97 /* This part must be outside protection */
98 #include <trace/define_trace.h>
99