KVM: SVM: Create trace events for VMGEXIT MSR protocol processing
[linux-2.6-microblaze.git] / arch / x86 / kvm / trace.h
index aef960f..2de30c2 100644 (file)
@@ -1578,6 +1578,103 @@ TRACE_EVENT(kvm_hv_syndbg_get_msr,
                  __entry->vcpu_id, __entry->vp_index, __entry->msr,
                  __entry->data)
 );
+
+/*
+ * Tracepoint for the start of VMGEXIT processing
+ */
+TRACE_EVENT(kvm_vmgexit_enter,
+       TP_PROTO(unsigned int vcpu_id, struct ghcb *ghcb),
+       TP_ARGS(vcpu_id, ghcb),
+
+       TP_STRUCT__entry(
+               __field(unsigned int, vcpu_id)
+               __field(u64, exit_reason)
+               __field(u64, info1)
+               __field(u64, info2)
+       ),
+
+       TP_fast_assign(
+               __entry->vcpu_id     = vcpu_id;
+               __entry->exit_reason = ghcb->save.sw_exit_code;
+               __entry->info1       = ghcb->save.sw_exit_info_1;
+               __entry->info2       = ghcb->save.sw_exit_info_2;
+       ),
+
+       TP_printk("vcpu %u, exit_reason %llx, exit_info1 %llx, exit_info2 %llx",
+                 __entry->vcpu_id, __entry->exit_reason,
+                 __entry->info1, __entry->info2)
+);
+
+/*
+ * Tracepoint for the end of VMGEXIT processing
+ */
+TRACE_EVENT(kvm_vmgexit_exit,
+       TP_PROTO(unsigned int vcpu_id, struct ghcb *ghcb),
+       TP_ARGS(vcpu_id, ghcb),
+
+       TP_STRUCT__entry(
+               __field(unsigned int, vcpu_id)
+               __field(u64, exit_reason)
+               __field(u64, info1)
+               __field(u64, info2)
+       ),
+
+       TP_fast_assign(
+               __entry->vcpu_id     = vcpu_id;
+               __entry->exit_reason = ghcb->save.sw_exit_code;
+               __entry->info1       = ghcb->save.sw_exit_info_1;
+               __entry->info2       = ghcb->save.sw_exit_info_2;
+       ),
+
+       TP_printk("vcpu %u, exit_reason %llx, exit_info1 %llx, exit_info2 %llx",
+                 __entry->vcpu_id, __entry->exit_reason,
+                 __entry->info1, __entry->info2)
+);
+
+/*
+ * Tracepoint for the start of VMGEXIT MSR procotol processing
+ */
+TRACE_EVENT(kvm_vmgexit_msr_protocol_enter,
+       TP_PROTO(unsigned int vcpu_id, u64 ghcb_gpa),
+       TP_ARGS(vcpu_id, ghcb_gpa),
+
+       TP_STRUCT__entry(
+               __field(unsigned int, vcpu_id)
+               __field(u64, ghcb_gpa)
+       ),
+
+       TP_fast_assign(
+               __entry->vcpu_id  = vcpu_id;
+               __entry->ghcb_gpa = ghcb_gpa;
+       ),
+
+       TP_printk("vcpu %u, ghcb_gpa %016llx",
+                 __entry->vcpu_id, __entry->ghcb_gpa)
+);
+
+/*
+ * Tracepoint for the end of VMGEXIT MSR procotol processing
+ */
+TRACE_EVENT(kvm_vmgexit_msr_protocol_exit,
+       TP_PROTO(unsigned int vcpu_id, u64 ghcb_gpa, int result),
+       TP_ARGS(vcpu_id, ghcb_gpa, result),
+
+       TP_STRUCT__entry(
+               __field(unsigned int, vcpu_id)
+               __field(u64, ghcb_gpa)
+               __field(int, result)
+       ),
+
+       TP_fast_assign(
+               __entry->vcpu_id  = vcpu_id;
+               __entry->ghcb_gpa = ghcb_gpa;
+               __entry->result   = result;
+       ),
+
+       TP_printk("vcpu %u, ghcb_gpa %016llx, result %d",
+                 __entry->vcpu_id, __entry->ghcb_gpa, __entry->result)
+);
+
 #endif /* _TRACE_KVM_H */
 
 #undef TRACE_INCLUDE_PATH