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
11 #define TRACE_INCLUDE_PATH .
12 #define TRACE_INCLUDE_FILE trace_pr
14 TRACE_EVENT(kvm_book3s_reenter
,
15 TP_PROTO(int r
, struct kvm_vcpu
*vcpu
),
19 __field( unsigned int, r
)
20 __field( unsigned long, pc
)
25 __entry
->pc
= kvmppc_get_pc(vcpu
);
28 TP_printk("reentry r=%d | pc=0x%lx", __entry
->r
, __entry
->pc
)
31 #ifdef CONFIG_PPC_BOOK3S_64
33 TRACE_EVENT(kvm_book3s_64_mmu_map
,
34 TP_PROTO(int rflags
, ulong hpteg
, ulong va
, kvm_pfn_t hpaddr
,
35 struct kvmppc_pte
*orig_pte
),
36 TP_ARGS(rflags
, hpteg
, va
, hpaddr
, orig_pte
),
39 __field( unsigned char, flag_w
)
40 __field( unsigned char, flag_x
)
41 __field( unsigned long, eaddr
)
42 __field( unsigned long, hpteg
)
43 __field( unsigned long, va
)
44 __field( unsigned long long, vpage
)
45 __field( unsigned long, hpaddr
)
49 __entry
->flag_w
= ((rflags
& HPTE_R_PP
) == 3) ? '-' : 'w';
50 __entry
->flag_x
= (rflags
& HPTE_R_N
) ? '-' : 'x';
51 __entry
->eaddr
= orig_pte
->eaddr
;
52 __entry
->hpteg
= hpteg
;
54 __entry
->vpage
= orig_pte
->vpage
;
55 __entry
->hpaddr
= hpaddr
;
58 TP_printk("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx",
59 __entry
->flag_w
, __entry
->flag_x
, __entry
->eaddr
,
60 __entry
->hpteg
, __entry
->va
, __entry
->vpage
, __entry
->hpaddr
)
63 #endif /* CONFIG_PPC_BOOK3S_64 */
65 TRACE_EVENT(kvm_book3s_mmu_map
,
66 TP_PROTO(struct hpte_cache
*pte
),
70 __field( u64
, host_vpn
)
72 __field( ulong
, eaddr
)
74 __field( ulong
, raddr
)
79 __entry
->host_vpn
= pte
->host_vpn
;
80 __entry
->pfn
= pte
->pfn
;
81 __entry
->eaddr
= pte
->pte
.eaddr
;
82 __entry
->vpage
= pte
->pte
.vpage
;
83 __entry
->raddr
= pte
->pte
.raddr
;
84 __entry
->flags
= (pte
->pte
.may_read
? 0x4 : 0) |
85 (pte
->pte
.may_write
? 0x2 : 0) |
86 (pte
->pte
.may_execute
? 0x1 : 0);
89 TP_printk("Map: hvpn=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
90 __entry
->host_vpn
, __entry
->pfn
, __entry
->eaddr
,
91 __entry
->vpage
, __entry
->raddr
, __entry
->flags
)
94 TRACE_EVENT(kvm_book3s_mmu_invalidate
,
95 TP_PROTO(struct hpte_cache
*pte
),
99 __field( u64
, host_vpn
)
101 __field( ulong
, eaddr
)
102 __field( u64
, vpage
)
103 __field( ulong
, raddr
)
104 __field( int, flags
)
108 __entry
->host_vpn
= pte
->host_vpn
;
109 __entry
->pfn
= pte
->pfn
;
110 __entry
->eaddr
= pte
->pte
.eaddr
;
111 __entry
->vpage
= pte
->pte
.vpage
;
112 __entry
->raddr
= pte
->pte
.raddr
;
113 __entry
->flags
= (pte
->pte
.may_read
? 0x4 : 0) |
114 (pte
->pte
.may_write
? 0x2 : 0) |
115 (pte
->pte
.may_execute
? 0x1 : 0);
118 TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
119 __entry
->host_vpn
, __entry
->pfn
, __entry
->eaddr
,
120 __entry
->vpage
, __entry
->raddr
, __entry
->flags
)
123 TRACE_EVENT(kvm_book3s_mmu_flush
,
124 TP_PROTO(const char *type
, struct kvm_vcpu
*vcpu
, unsigned long long p1
,
125 unsigned long long p2
),
126 TP_ARGS(type
, vcpu
, p1
, p2
),
129 __field( int, count
)
130 __field( unsigned long long, p1
)
131 __field( unsigned long long, p2
)
132 __field( const char *, type
)
136 __entry
->count
= to_book3s(vcpu
)->hpte_cache_count
;
139 __entry
->type
= type
;
142 TP_printk("Flush %d %sPTEs: %llx - %llx",
143 __entry
->count
, __entry
->type
, __entry
->p1
, __entry
->p2
)
146 TRACE_EVENT(kvm_book3s_slb_found
,
147 TP_PROTO(unsigned long long gvsid
, unsigned long long hvsid
),
148 TP_ARGS(gvsid
, hvsid
),
151 __field( unsigned long long, gvsid
)
152 __field( unsigned long long, hvsid
)
156 __entry
->gvsid
= gvsid
;
157 __entry
->hvsid
= hvsid
;
160 TP_printk("%llx -> %llx", __entry
->gvsid
, __entry
->hvsid
)
163 TRACE_EVENT(kvm_book3s_slb_fail
,
164 TP_PROTO(u16 sid_map_mask
, unsigned long long gvsid
),
165 TP_ARGS(sid_map_mask
, gvsid
),
168 __field( unsigned short, sid_map_mask
)
169 __field( unsigned long long, gvsid
)
173 __entry
->sid_map_mask
= sid_map_mask
;
174 __entry
->gvsid
= gvsid
;
177 TP_printk("%x/%x: %llx", __entry
->sid_map_mask
,
178 SID_MAP_MASK
- __entry
->sid_map_mask
, __entry
->gvsid
)
181 TRACE_EVENT(kvm_book3s_slb_map
,
182 TP_PROTO(u16 sid_map_mask
, unsigned long long gvsid
,
183 unsigned long long hvsid
),
184 TP_ARGS(sid_map_mask
, gvsid
, hvsid
),
187 __field( unsigned short, sid_map_mask
)
188 __field( unsigned long long, guest_vsid
)
189 __field( unsigned long long, host_vsid
)
193 __entry
->sid_map_mask
= sid_map_mask
;
194 __entry
->guest_vsid
= gvsid
;
195 __entry
->host_vsid
= hvsid
;
198 TP_printk("%x: %llx -> %llx", __entry
->sid_map_mask
,
199 __entry
->guest_vsid
, __entry
->host_vsid
)
202 TRACE_EVENT(kvm_book3s_slbmte
,
203 TP_PROTO(u64 slb_vsid
, u64 slb_esid
),
204 TP_ARGS(slb_vsid
, slb_esid
),
207 __field( u64
, slb_vsid
)
208 __field( u64
, slb_esid
)
212 __entry
->slb_vsid
= slb_vsid
;
213 __entry
->slb_esid
= slb_esid
;
216 TP_printk("%llx, %llx", __entry
->slb_vsid
, __entry
->slb_esid
)
219 TRACE_EVENT(kvm_exit
,
220 TP_PROTO(unsigned int exit_nr
, struct kvm_vcpu
*vcpu
),
221 TP_ARGS(exit_nr
, vcpu
),
224 __field( unsigned int, exit_nr
)
225 __field( unsigned long, pc
)
226 __field( unsigned long, msr
)
227 __field( unsigned long, dar
)
228 __field( unsigned long, srr1
)
229 __field( unsigned long, last_inst
)
233 __entry
->exit_nr
= exit_nr
;
234 __entry
->pc
= kvmppc_get_pc(vcpu
);
235 __entry
->dar
= kvmppc_get_fault_dar(vcpu
);
236 __entry
->msr
= kvmppc_get_msr(vcpu
);
237 __entry
->srr1
= vcpu
->arch
.shadow_srr1
;
238 __entry
->last_inst
= vcpu
->arch
.last_inst
;
248 __print_symbolic(__entry
->exit_nr
, kvm_trace_symbol_exit
),
257 TRACE_EVENT(kvm_unmap_hva
,
258 TP_PROTO(unsigned long hva
),
262 __field( unsigned long, hva
)
269 TP_printk("unmap hva 0x%lx\n", __entry
->hva
)
272 #endif /* _TRACE_KVM_H */
274 /* This part must be outside protection */
275 #include <trace/define_trace.h>