2 #if !defined(_TRACE_KVM_PR_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define _TRACE_KVM_PR_H
5 #include <linux/tracepoint.h>
8 #define TRACE_SYSTEM kvm_pr
9 #define TRACE_INCLUDE_PATH .
10 #define TRACE_INCLUDE_FILE trace_pr
12 #define kvm_trace_symbol_exit \
13 {0x100, "SYSTEM_RESET"}, \
14 {0x200, "MACHINE_CHECK"}, \
15 {0x300, "DATA_STORAGE"}, \
16 {0x380, "DATA_SEGMENT"}, \
17 {0x400, "INST_STORAGE"}, \
18 {0x480, "INST_SEGMENT"}, \
19 {0x500, "EXTERNAL"}, \
20 {0x501, "EXTERNAL_LEVEL"}, \
21 {0x502, "EXTERNAL_HV"}, \
22 {0x600, "ALIGNMENT"}, \
24 {0x800, "FP_UNAVAIL"}, \
25 {0x900, "DECREMENTER"}, \
26 {0x980, "HV_DECREMENTER"}, \
29 {0xe00, "H_DATA_STORAGE"}, \
30 {0xe20, "H_INST_STORAGE"}, \
31 {0xe40, "H_EMUL_ASSIST"}, \
36 TRACE_EVENT(kvm_book3s_reenter
,
37 TP_PROTO(int r
, struct kvm_vcpu
*vcpu
),
41 __field( unsigned int, r
)
42 __field( unsigned long, pc
)
47 __entry
->pc
= kvmppc_get_pc(vcpu
);
50 TP_printk("reentry r=%d | pc=0x%lx", __entry
->r
, __entry
->pc
)
53 #ifdef CONFIG_PPC_BOOK3S_64
55 TRACE_EVENT(kvm_book3s_64_mmu_map
,
56 TP_PROTO(int rflags
, ulong hpteg
, ulong va
, pfn_t hpaddr
,
57 struct kvmppc_pte
*orig_pte
),
58 TP_ARGS(rflags
, hpteg
, va
, hpaddr
, orig_pte
),
61 __field( unsigned char, flag_w
)
62 __field( unsigned char, flag_x
)
63 __field( unsigned long, eaddr
)
64 __field( unsigned long, hpteg
)
65 __field( unsigned long, va
)
66 __field( unsigned long long, vpage
)
67 __field( unsigned long, hpaddr
)
71 __entry
->flag_w
= ((rflags
& HPTE_R_PP
) == 3) ? '-' : 'w';
72 __entry
->flag_x
= (rflags
& HPTE_R_N
) ? '-' : 'x';
73 __entry
->eaddr
= orig_pte
->eaddr
;
74 __entry
->hpteg
= hpteg
;
76 __entry
->vpage
= orig_pte
->vpage
;
77 __entry
->hpaddr
= hpaddr
;
80 TP_printk("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx",
81 __entry
->flag_w
, __entry
->flag_x
, __entry
->eaddr
,
82 __entry
->hpteg
, __entry
->va
, __entry
->vpage
, __entry
->hpaddr
)
85 #endif /* CONFIG_PPC_BOOK3S_64 */
87 TRACE_EVENT(kvm_book3s_mmu_map
,
88 TP_PROTO(struct hpte_cache
*pte
),
92 __field( u64
, host_vpn
)
94 __field( ulong
, eaddr
)
96 __field( ulong
, raddr
)
101 __entry
->host_vpn
= pte
->host_vpn
;
102 __entry
->pfn
= pte
->pfn
;
103 __entry
->eaddr
= pte
->pte
.eaddr
;
104 __entry
->vpage
= pte
->pte
.vpage
;
105 __entry
->raddr
= pte
->pte
.raddr
;
106 __entry
->flags
= (pte
->pte
.may_read
? 0x4 : 0) |
107 (pte
->pte
.may_write
? 0x2 : 0) |
108 (pte
->pte
.may_execute
? 0x1 : 0);
111 TP_printk("Map: hvpn=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
112 __entry
->host_vpn
, __entry
->pfn
, __entry
->eaddr
,
113 __entry
->vpage
, __entry
->raddr
, __entry
->flags
)
116 TRACE_EVENT(kvm_book3s_mmu_invalidate
,
117 TP_PROTO(struct hpte_cache
*pte
),
121 __field( u64
, host_vpn
)
123 __field( ulong
, eaddr
)
124 __field( u64
, vpage
)
125 __field( ulong
, raddr
)
126 __field( int, flags
)
130 __entry
->host_vpn
= pte
->host_vpn
;
131 __entry
->pfn
= pte
->pfn
;
132 __entry
->eaddr
= pte
->pte
.eaddr
;
133 __entry
->vpage
= pte
->pte
.vpage
;
134 __entry
->raddr
= pte
->pte
.raddr
;
135 __entry
->flags
= (pte
->pte
.may_read
? 0x4 : 0) |
136 (pte
->pte
.may_write
? 0x2 : 0) |
137 (pte
->pte
.may_execute
? 0x1 : 0);
140 TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
141 __entry
->host_vpn
, __entry
->pfn
, __entry
->eaddr
,
142 __entry
->vpage
, __entry
->raddr
, __entry
->flags
)
145 TRACE_EVENT(kvm_book3s_mmu_flush
,
146 TP_PROTO(const char *type
, struct kvm_vcpu
*vcpu
, unsigned long long p1
,
147 unsigned long long p2
),
148 TP_ARGS(type
, vcpu
, p1
, p2
),
151 __field( int, count
)
152 __field( unsigned long long, p1
)
153 __field( unsigned long long, p2
)
154 __field( const char *, type
)
158 __entry
->count
= to_book3s(vcpu
)->hpte_cache_count
;
161 __entry
->type
= type
;
164 TP_printk("Flush %d %sPTEs: %llx - %llx",
165 __entry
->count
, __entry
->type
, __entry
->p1
, __entry
->p2
)
168 TRACE_EVENT(kvm_book3s_slb_found
,
169 TP_PROTO(unsigned long long gvsid
, unsigned long long hvsid
),
170 TP_ARGS(gvsid
, hvsid
),
173 __field( unsigned long long, gvsid
)
174 __field( unsigned long long, hvsid
)
178 __entry
->gvsid
= gvsid
;
179 __entry
->hvsid
= hvsid
;
182 TP_printk("%llx -> %llx", __entry
->gvsid
, __entry
->hvsid
)
185 TRACE_EVENT(kvm_book3s_slb_fail
,
186 TP_PROTO(u16 sid_map_mask
, unsigned long long gvsid
),
187 TP_ARGS(sid_map_mask
, gvsid
),
190 __field( unsigned short, sid_map_mask
)
191 __field( unsigned long long, gvsid
)
195 __entry
->sid_map_mask
= sid_map_mask
;
196 __entry
->gvsid
= gvsid
;
199 TP_printk("%x/%x: %llx", __entry
->sid_map_mask
,
200 SID_MAP_MASK
- __entry
->sid_map_mask
, __entry
->gvsid
)
203 TRACE_EVENT(kvm_book3s_slb_map
,
204 TP_PROTO(u16 sid_map_mask
, unsigned long long gvsid
,
205 unsigned long long hvsid
),
206 TP_ARGS(sid_map_mask
, gvsid
, hvsid
),
209 __field( unsigned short, sid_map_mask
)
210 __field( unsigned long long, guest_vsid
)
211 __field( unsigned long long, host_vsid
)
215 __entry
->sid_map_mask
= sid_map_mask
;
216 __entry
->guest_vsid
= gvsid
;
217 __entry
->host_vsid
= hvsid
;
220 TP_printk("%x: %llx -> %llx", __entry
->sid_map_mask
,
221 __entry
->guest_vsid
, __entry
->host_vsid
)
224 TRACE_EVENT(kvm_book3s_slbmte
,
225 TP_PROTO(u64 slb_vsid
, u64 slb_esid
),
226 TP_ARGS(slb_vsid
, slb_esid
),
229 __field( u64
, slb_vsid
)
230 __field( u64
, slb_esid
)
234 __entry
->slb_vsid
= slb_vsid
;
235 __entry
->slb_esid
= slb_esid
;
238 TP_printk("%llx, %llx", __entry
->slb_vsid
, __entry
->slb_esid
)
241 TRACE_EVENT(kvm_exit
,
242 TP_PROTO(unsigned int exit_nr
, struct kvm_vcpu
*vcpu
),
243 TP_ARGS(exit_nr
, vcpu
),
246 __field( unsigned int, exit_nr
)
247 __field( unsigned long, pc
)
248 __field( unsigned long, msr
)
249 __field( unsigned long, dar
)
250 __field( unsigned long, srr1
)
251 __field( unsigned long, last_inst
)
255 __entry
->exit_nr
= exit_nr
;
256 __entry
->pc
= kvmppc_get_pc(vcpu
);
257 __entry
->dar
= kvmppc_get_fault_dar(vcpu
);
258 __entry
->msr
= vcpu
->arch
.shared
->msr
;
259 __entry
->srr1
= vcpu
->arch
.shadow_srr1
;
260 __entry
->last_inst
= vcpu
->arch
.last_inst
;
270 __print_symbolic(__entry
->exit_nr
, kvm_trace_symbol_exit
),
279 TRACE_EVENT(kvm_unmap_hva
,
280 TP_PROTO(unsigned long hva
),
284 __field( unsigned long, hva
)
291 TP_printk("unmap hva 0x%lx\n", __entry
->hva
)
294 #endif /* _TRACE_KVM_H */
296 /* This part must be outside protection */
297 #include <trace/define_trace.h>