trace.h 3.8 KB

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