1 /* SPDX-License-Identifier: GPL-2.0 */
3 #if !defined(_TRACE_KVM_PR_H) || defined(TRACE_HEADER_MULTI_READ)
4 #define _TRACE_KVM_PR_H
6 #include <linux/tracepoint.h>
7 #include "trace_book3s.h"
10 #define TRACE_SYSTEM kvm_pr
12 TRACE_EVENT(kvm_book3s_reenter
,
13 TP_PROTO(int r
, struct kvm_vcpu
*vcpu
),
17 __field( unsigned int, r
)
18 __field( unsigned long, pc
)
23 __entry
->pc
= kvmppc_get_pc(vcpu
);
26 TP_printk("reentry r=%d | pc=0x%lx", __entry
->r
, __entry
->pc
)
29 #ifdef CONFIG_PPC_BOOK3S_64
31 TRACE_EVENT(kvm_book3s_64_mmu_map
,
32 TP_PROTO(int rflags
, ulong hpteg
, ulong va
, kvm_pfn_t hpaddr
,
33 struct kvmppc_pte
*orig_pte
),
34 TP_ARGS(rflags
, hpteg
, va
, hpaddr
, orig_pte
),
37 __field( unsigned char, flag_w
)
38 __field( unsigned char, flag_x
)
39 __field( unsigned long, eaddr
)
40 __field( unsigned long, hpteg
)
41 __field( unsigned long, va
)
42 __field( unsigned long long, vpage
)
43 __field( unsigned long, hpaddr
)
47 __entry
->flag_w
= ((rflags
& HPTE_R_PP
) == 3) ? '-' : 'w';
48 __entry
->flag_x
= (rflags
& HPTE_R_N
) ? '-' : 'x';
49 __entry
->eaddr
= orig_pte
->eaddr
;
50 __entry
->hpteg
= hpteg
;
52 __entry
->vpage
= orig_pte
->vpage
;
53 __entry
->hpaddr
= hpaddr
;
56 TP_printk("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx",
57 __entry
->flag_w
, __entry
->flag_x
, __entry
->eaddr
,
58 __entry
->hpteg
, __entry
->va
, __entry
->vpage
, __entry
->hpaddr
)
61 #endif /* CONFIG_PPC_BOOK3S_64 */
63 TRACE_EVENT(kvm_book3s_mmu_map
,
64 TP_PROTO(struct hpte_cache
*pte
),
68 __field( u64
, host_vpn
)
70 __field( ulong
, eaddr
)
72 __field( ulong
, raddr
)
77 __entry
->host_vpn
= pte
->host_vpn
;
78 __entry
->pfn
= pte
->pfn
;
79 __entry
->eaddr
= pte
->pte
.eaddr
;
80 __entry
->vpage
= pte
->pte
.vpage
;
81 __entry
->raddr
= pte
->pte
.raddr
;
82 __entry
->flags
= (pte
->pte
.may_read
? 0x4 : 0) |
83 (pte
->pte
.may_write
? 0x2 : 0) |
84 (pte
->pte
.may_execute
? 0x1 : 0);
87 TP_printk("Map: hvpn=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
88 __entry
->host_vpn
, __entry
->pfn
, __entry
->eaddr
,
89 __entry
->vpage
, __entry
->raddr
, __entry
->flags
)
92 TRACE_EVENT(kvm_book3s_mmu_invalidate
,
93 TP_PROTO(struct hpte_cache
*pte
),
97 __field( u64
, host_vpn
)
99 __field( ulong
, eaddr
)
100 __field( u64
, vpage
)
101 __field( ulong
, raddr
)
102 __field( int, flags
)
106 __entry
->host_vpn
= pte
->host_vpn
;
107 __entry
->pfn
= pte
->pfn
;
108 __entry
->eaddr
= pte
->pte
.eaddr
;
109 __entry
->vpage
= pte
->pte
.vpage
;
110 __entry
->raddr
= pte
->pte
.raddr
;
111 __entry
->flags
= (pte
->pte
.may_read
? 0x4 : 0) |
112 (pte
->pte
.may_write
? 0x2 : 0) |
113 (pte
->pte
.may_execute
? 0x1 : 0);
116 TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
117 __entry
->host_vpn
, __entry
->pfn
, __entry
->eaddr
,
118 __entry
->vpage
, __entry
->raddr
, __entry
->flags
)
121 TRACE_EVENT(kvm_book3s_mmu_flush
,
122 TP_PROTO(const char *type
, struct kvm_vcpu
*vcpu
, unsigned long long p1
,
123 unsigned long long p2
),
124 TP_ARGS(type
, vcpu
, p1
, p2
),
127 __field( int, count
)
128 __field( unsigned long long, p1
)
129 __field( unsigned long long, p2
)
130 __field( const char *, type
)
134 __entry
->count
= to_book3s(vcpu
)->hpte_cache_count
;
137 __entry
->type
= type
;
140 TP_printk("Flush %d %sPTEs: %llx - %llx",
141 __entry
->count
, __entry
->type
, __entry
->p1
, __entry
->p2
)
144 TRACE_EVENT(kvm_book3s_slb_found
,
145 TP_PROTO(unsigned long long gvsid
, unsigned long long hvsid
),
146 TP_ARGS(gvsid
, hvsid
),
149 __field( unsigned long long, gvsid
)
150 __field( unsigned long long, hvsid
)
154 __entry
->gvsid
= gvsid
;
155 __entry
->hvsid
= hvsid
;
158 TP_printk("%llx -> %llx", __entry
->gvsid
, __entry
->hvsid
)
161 TRACE_EVENT(kvm_book3s_slb_fail
,
162 TP_PROTO(u16 sid_map_mask
, unsigned long long gvsid
),
163 TP_ARGS(sid_map_mask
, gvsid
),
166 __field( unsigned short, sid_map_mask
)
167 __field( unsigned long long, gvsid
)
171 __entry
->sid_map_mask
= sid_map_mask
;
172 __entry
->gvsid
= gvsid
;
175 TP_printk("%x/%x: %llx", __entry
->sid_map_mask
,
176 SID_MAP_MASK
- __entry
->sid_map_mask
, __entry
->gvsid
)
179 TRACE_EVENT(kvm_book3s_slb_map
,
180 TP_PROTO(u16 sid_map_mask
, unsigned long long gvsid
,
181 unsigned long long hvsid
),
182 TP_ARGS(sid_map_mask
, gvsid
, hvsid
),
185 __field( unsigned short, sid_map_mask
)
186 __field( unsigned long long, guest_vsid
)
187 __field( unsigned long long, host_vsid
)
191 __entry
->sid_map_mask
= sid_map_mask
;
192 __entry
->guest_vsid
= gvsid
;
193 __entry
->host_vsid
= hvsid
;
196 TP_printk("%x: %llx -> %llx", __entry
->sid_map_mask
,
197 __entry
->guest_vsid
, __entry
->host_vsid
)
200 TRACE_EVENT(kvm_book3s_slbmte
,
201 TP_PROTO(u64 slb_vsid
, u64 slb_esid
),
202 TP_ARGS(slb_vsid
, slb_esid
),
205 __field( u64
, slb_vsid
)
206 __field( u64
, slb_esid
)
210 __entry
->slb_vsid
= slb_vsid
;
211 __entry
->slb_esid
= slb_esid
;
214 TP_printk("%llx, %llx", __entry
->slb_vsid
, __entry
->slb_esid
)
217 TRACE_EVENT(kvm_exit
,
218 TP_PROTO(unsigned int exit_nr
, struct kvm_vcpu
*vcpu
),
219 TP_ARGS(exit_nr
, vcpu
),
222 __field( unsigned int, exit_nr
)
223 __field( unsigned long, pc
)
224 __field( unsigned long, msr
)
225 __field( unsigned long, dar
)
226 __field( unsigned long, srr1
)
227 __field( unsigned long, last_inst
)
231 __entry
->exit_nr
= exit_nr
;
232 __entry
->pc
= kvmppc_get_pc(vcpu
);
233 __entry
->dar
= kvmppc_get_fault_dar(vcpu
);
234 __entry
->msr
= kvmppc_get_msr(vcpu
);
235 __entry
->srr1
= vcpu
->arch
.shadow_srr1
;
236 __entry
->last_inst
= vcpu
->arch
.last_inst
;
246 __print_symbolic(__entry
->exit_nr
, kvm_trace_symbol_exit
),
255 #endif /* _TRACE_KVM_H */
257 /* This part must be outside protection */
259 #undef TRACE_INCLUDE_PATH
260 #undef TRACE_INCLUDE_FILE
262 #define TRACE_INCLUDE_PATH .
263 #define TRACE_INCLUDE_FILE trace_pr
265 #include <trace/define_trace.h>