xref: /linux/drivers/vfio/pci/trace.h (revision 9f7d35d9f7a184ffb591b090b2cbf63d2d599c02)
1 /* SPDX-License-Identifier: GPL-2.0+ */
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  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12 
13 #undef TRACE_SYSTEM
14 #define TRACE_SYSTEM vfio_pci
15 
16 #if !defined(_TRACE_VFIO_PCI_H) || defined(TRACE_HEADER_MULTI_READ)
17 #define _TRACE_VFIO_PCI_H
18 
19 #include <linux/tracepoint.h>
20 
21 TRACE_EVENT(vfio_pci_nvgpu_mmap_fault,
22 	TP_PROTO(struct pci_dev *pdev, unsigned long hpa, unsigned long ua,
23 			vm_fault_t ret),
24 	TP_ARGS(pdev, hpa, ua, ret),
25 
26 	TP_STRUCT__entry(
27 		__field(const char *, name)
28 		__field(unsigned long, hpa)
29 		__field(unsigned long, ua)
30 		__field(int, ret)
31 	),
32 
33 	TP_fast_assign(
34 		__entry->name = dev_name(&pdev->dev),
35 		__entry->hpa = hpa;
36 		__entry->ua = ua;
37 		__entry->ret = ret;
38 	),
39 
40 	TP_printk("%s: %lx -> %lx ret=%d", __entry->name, __entry->hpa,
41 			__entry->ua, __entry->ret)
42 );
43 
44 TRACE_EVENT(vfio_pci_nvgpu_mmap,
45 	TP_PROTO(struct pci_dev *pdev, unsigned long hpa, unsigned long ua,
46 			unsigned long size, int ret),
47 	TP_ARGS(pdev, hpa, ua, size, ret),
48 
49 	TP_STRUCT__entry(
50 		__field(const char *, name)
51 		__field(unsigned long, hpa)
52 		__field(unsigned long, ua)
53 		__field(unsigned long, size)
54 		__field(int, ret)
55 	),
56 
57 	TP_fast_assign(
58 		__entry->name = dev_name(&pdev->dev),
59 		__entry->hpa = hpa;
60 		__entry->ua = ua;
61 		__entry->size = size;
62 		__entry->ret = ret;
63 	),
64 
65 	TP_printk("%s: %lx -> %lx size=%lx ret=%d", __entry->name, __entry->hpa,
66 			__entry->ua, __entry->size, __entry->ret)
67 );
68 
69 TRACE_EVENT(vfio_pci_npu2_mmap,
70 	TP_PROTO(struct pci_dev *pdev, unsigned long hpa, unsigned long ua,
71 			unsigned long size, int ret),
72 	TP_ARGS(pdev, hpa, ua, size, ret),
73 
74 	TP_STRUCT__entry(
75 		__field(const char *, name)
76 		__field(unsigned long, hpa)
77 		__field(unsigned long, ua)
78 		__field(unsigned long, size)
79 		__field(int, ret)
80 	),
81 
82 	TP_fast_assign(
83 		__entry->name = dev_name(&pdev->dev),
84 		__entry->hpa = hpa;
85 		__entry->ua = ua;
86 		__entry->size = size;
87 		__entry->ret = ret;
88 	),
89 
90 	TP_printk("%s: %lx -> %lx size=%lx ret=%d", __entry->name, __entry->hpa,
91 			__entry->ua, __entry->size, __entry->ret)
92 );
93 
94 #endif /* _TRACE_VFIO_PCI_H */
95 
96 #undef TRACE_INCLUDE_PATH
97 #define TRACE_INCLUDE_PATH .
98 #undef TRACE_INCLUDE_FILE
99 #define TRACE_INCLUDE_FILE trace
100 
101 /* This part must be outside protection */
102 #include <trace/define_trace.h>
103