trace.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. #if !defined(_TRACE_ARM64_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
  2. #define _TRACE_ARM64_KVM_H
  3. #include <linux/tracepoint.h>
  4. #undef TRACE_SYSTEM
  5. #define TRACE_SYSTEM kvm
  6. TRACE_EVENT(kvm_wfx_arm64,
  7. TP_PROTO(unsigned long vcpu_pc, bool is_wfe),
  8. TP_ARGS(vcpu_pc, is_wfe),
  9. TP_STRUCT__entry(
  10. __field(unsigned long, vcpu_pc)
  11. __field(bool, is_wfe)
  12. ),
  13. TP_fast_assign(
  14. __entry->vcpu_pc = vcpu_pc;
  15. __entry->is_wfe = is_wfe;
  16. ),
  17. TP_printk("guest executed wf%c at: 0x%08lx",
  18. __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc)
  19. );
  20. TRACE_EVENT(kvm_hvc_arm64,
  21. TP_PROTO(unsigned long vcpu_pc, unsigned long r0, unsigned long imm),
  22. TP_ARGS(vcpu_pc, r0, imm),
  23. TP_STRUCT__entry(
  24. __field(unsigned long, vcpu_pc)
  25. __field(unsigned long, r0)
  26. __field(unsigned long, imm)
  27. ),
  28. TP_fast_assign(
  29. __entry->vcpu_pc = vcpu_pc;
  30. __entry->r0 = r0;
  31. __entry->imm = imm;
  32. ),
  33. TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx)",
  34. __entry->vcpu_pc, __entry->r0, __entry->imm)
  35. );
  36. TRACE_EVENT(kvm_arm_setup_debug,
  37. TP_PROTO(struct kvm_vcpu *vcpu, __u32 guest_debug),
  38. TP_ARGS(vcpu, guest_debug),
  39. TP_STRUCT__entry(
  40. __field(struct kvm_vcpu *, vcpu)
  41. __field(__u32, guest_debug)
  42. ),
  43. TP_fast_assign(
  44. __entry->vcpu = vcpu;
  45. __entry->guest_debug = guest_debug;
  46. ),
  47. TP_printk("vcpu: %p, flags: 0x%08x", __entry->vcpu, __entry->guest_debug)
  48. );
  49. TRACE_EVENT(kvm_arm_clear_debug,
  50. TP_PROTO(__u32 guest_debug),
  51. TP_ARGS(guest_debug),
  52. TP_STRUCT__entry(
  53. __field(__u32, guest_debug)
  54. ),
  55. TP_fast_assign(
  56. __entry->guest_debug = guest_debug;
  57. ),
  58. TP_printk("flags: 0x%08x", __entry->guest_debug)
  59. );
  60. TRACE_EVENT(kvm_arm_set_dreg32,
  61. TP_PROTO(const char *name, __u32 value),
  62. TP_ARGS(name, value),
  63. TP_STRUCT__entry(
  64. __field(const char *, name)
  65. __field(__u32, value)
  66. ),
  67. TP_fast_assign(
  68. __entry->name = name;
  69. __entry->value = value;
  70. ),
  71. TP_printk("%s: 0x%08x", __entry->name, __entry->value)
  72. );
  73. TRACE_EVENT(kvm_arm_set_regset,
  74. TP_PROTO(const char *type, int len, __u64 *control, __u64 *value),
  75. TP_ARGS(type, len, control, value),
  76. TP_STRUCT__entry(
  77. __field(const char *, name)
  78. __field(int, len)
  79. __array(u64, ctrls, 16)
  80. __array(u64, values, 16)
  81. ),
  82. TP_fast_assign(
  83. __entry->name = type;
  84. __entry->len = len;
  85. memcpy(__entry->ctrls, control, len << 3);
  86. memcpy(__entry->values, value, len << 3);
  87. ),
  88. TP_printk("%d %s CTRL:%s VALUE:%s", __entry->len, __entry->name,
  89. __print_array(__entry->ctrls, __entry->len, sizeof(__u64)),
  90. __print_array(__entry->values, __entry->len, sizeof(__u64)))
  91. );
  92. TRACE_EVENT(trap_reg,
  93. TP_PROTO(const char *fn, int reg, bool is_write, u64 write_value),
  94. TP_ARGS(fn, reg, is_write, write_value),
  95. TP_STRUCT__entry(
  96. __field(const char *, fn)
  97. __field(int, reg)
  98. __field(bool, is_write)
  99. __field(u64, write_value)
  100. ),
  101. TP_fast_assign(
  102. __entry->fn = fn;
  103. __entry->reg = reg;
  104. __entry->is_write = is_write;
  105. __entry->write_value = write_value;
  106. ),
  107. TP_printk("%s %s reg %d (0x%08llx)", __entry->fn, __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value)
  108. );
  109. TRACE_EVENT(kvm_handle_sys_reg,
  110. TP_PROTO(unsigned long hsr),
  111. TP_ARGS(hsr),
  112. TP_STRUCT__entry(
  113. __field(unsigned long, hsr)
  114. ),
  115. TP_fast_assign(
  116. __entry->hsr = hsr;
  117. ),
  118. TP_printk("HSR 0x%08lx", __entry->hsr)
  119. );
  120. TRACE_EVENT(kvm_set_guest_debug,
  121. TP_PROTO(struct kvm_vcpu *vcpu, __u32 guest_debug),
  122. TP_ARGS(vcpu, guest_debug),
  123. TP_STRUCT__entry(
  124. __field(struct kvm_vcpu *, vcpu)
  125. __field(__u32, guest_debug)
  126. ),
  127. TP_fast_assign(
  128. __entry->vcpu = vcpu;
  129. __entry->guest_debug = guest_debug;
  130. ),
  131. TP_printk("vcpu: %p, flags: 0x%08x", __entry->vcpu, __entry->guest_debug)
  132. );
  133. #endif /* _TRACE_ARM64_KVM_H */
  134. #undef TRACE_INCLUDE_PATH
  135. #define TRACE_INCLUDE_PATH .
  136. #undef TRACE_INCLUDE_FILE
  137. #define TRACE_INCLUDE_FILE trace
  138. /* This part must be outside protection */
  139. #include <trace/define_trace.h>