1 #if !defined(_TRACE_KVM_MAIN_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _TRACE_KVM_MAIN_H
4 #include <linux/tracepoint.h>
7 #define TRACE_SYSTEM kvm
9 #if defined(__KVM_HAVE_IOAPIC)
10 TRACE_EVENT(kvm_set_irq
,
11 TP_PROTO(unsigned int gsi
, int level
, int irq_source_id
),
12 TP_ARGS(gsi
, level
, irq_source_id
),
15 __field( unsigned int, gsi
)
17 __field( int, irq_source_id
)
22 __entry
->level
= level
;
23 __entry
->irq_source_id
= irq_source_id
;
26 TP_printk("gsi %u level %d source %d",
27 __entry
->gsi
, __entry
->level
, __entry
->irq_source_id
)
30 #define kvm_deliver_mode \
40 TRACE_EVENT(kvm_ioapic_set_irq
,
41 TP_PROTO(__u64 e
, int pin
, bool coalesced
),
42 TP_ARGS(e
, pin
, coalesced
),
47 __field( bool, coalesced
)
53 __entry
->coalesced
= coalesced
;
56 TP_printk("pin %u dst %x vec=%u (%s|%s|%s%s)%s",
57 __entry
->pin
, (u8
)(__entry
->e
>> 56), (u8
)__entry
->e
,
58 __print_symbolic((__entry
->e
>> 8 & 0x7), kvm_deliver_mode
),
59 (__entry
->e
& (1<<11)) ? "logical" : "physical",
60 (__entry
->e
& (1<<15)) ? "level" : "edge",
61 (__entry
->e
& (1<<16)) ? "|masked" : "",
62 __entry
->coalesced
? " (coalesced)" : "")
65 TRACE_EVENT(kvm_msi_set_irq
,
66 TP_PROTO(__u64 address
, __u64 data
),
67 TP_ARGS(address
, data
),
70 __field( __u64
, address
)
71 __field( __u64
, data
)
75 __entry
->address
= address
;
79 TP_printk("dst %u vec %x (%s|%s|%s%s)",
80 (u8
)(__entry
->address
>> 12), (u8
)__entry
->data
,
81 __print_symbolic((__entry
->data
>> 8 & 0x7), kvm_deliver_mode
),
82 (__entry
->address
& (1<<2)) ? "logical" : "physical",
83 (__entry
->data
& (1<<15)) ? "level" : "edge",
84 (__entry
->address
& (1<<3)) ? "|rh" : "")
87 #define kvm_irqchips \
88 {KVM_IRQCHIP_PIC_MASTER, "PIC master"}, \
89 {KVM_IRQCHIP_PIC_SLAVE, "PIC slave"}, \
90 {KVM_IRQCHIP_IOAPIC, "IOAPIC"}
92 TRACE_EVENT(kvm_ack_irq
,
93 TP_PROTO(unsigned int irqchip
, unsigned int pin
),
94 TP_ARGS(irqchip
, pin
),
97 __field( unsigned int, irqchip
)
98 __field( unsigned int, pin
)
102 __entry
->irqchip
= irqchip
;
106 TP_printk("irqchip %s pin %u",
107 __print_symbolic(__entry
->irqchip
, kvm_irqchips
),
113 #endif /* defined(__KVM_HAVE_IOAPIC) */
115 #define KVM_TRACE_MMIO_READ_UNSATISFIED 0
116 #define KVM_TRACE_MMIO_READ 1
117 #define KVM_TRACE_MMIO_WRITE 2
119 #define kvm_trace_symbol_mmio \
120 { KVM_TRACE_MMIO_READ_UNSATISFIED, "unsatisfied-read" }, \
121 { KVM_TRACE_MMIO_READ, "read" }, \
122 { KVM_TRACE_MMIO_WRITE, "write" }
124 TRACE_EVENT(kvm_mmio
,
125 TP_PROTO(int type
, int len
, u64 gpa
, u64 val
),
126 TP_ARGS(type
, len
, gpa
, val
),
136 __entry
->type
= type
;
142 TP_printk("mmio %s len %u gpa 0x%llx val 0x%llx",
143 __print_symbolic(__entry
->type
, kvm_trace_symbol_mmio
),
144 __entry
->len
, __entry
->gpa
, __entry
->val
)
147 #define kvm_fpu_load_symbol \
160 __entry
->load
= load
;
163 TP_printk("%s", __print_symbolic(__entry
->load
, kvm_fpu_load_symbol
))
166 TRACE_EVENT(kvm_age_page
,
167 TP_PROTO(ulong hva
, struct kvm_memory_slot
*slot
, int ref
),
168 TP_ARGS(hva
, slot
, ref
),
173 __field( u8
, referenced
)
179 slot
->base_gfn
+ ((hva
- slot
->userspace_addr
) >> PAGE_SHIFT
);
180 __entry
->referenced
= ref
;
183 TP_printk("hva %llx gfn %llx %s",
184 __entry
->hva
, __entry
->gfn
,
185 __entry
->referenced
? "YOUNG" : "OLD")
188 #endif /* _TRACE_KVM_MAIN_H */
190 /* This part must be outside protection */
191 #include <trace/define_trace.h>